describe_hosts

EC2.Client.describe_hosts(**kwargs)

Describes the specified Dedicated Hosts or all your Dedicated Hosts.

The results describe only the Dedicated Hosts in the Region you're currently using. All listed instances consume capacity on your Dedicated Host. Dedicated Hosts that have recently been released are listed with the state released .

See also: AWS API Documentation

Request Syntax

response = client.describe_hosts(
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    HostIds=[
        'string',
    ],
    MaxResults=123,
    NextToken='string'
)
Parameters
  • Filters (list) --

    The filters.

    • auto-placement - Whether auto-placement is enabled or disabled ( on | off ).
    • availability-zone - The Availability Zone of the host.
    • client-token - The idempotency token that you provided when you allocated the host.
    • host-reservation-id - The ID of the reservation assigned to this host.
    • instance-type - The instance type size that the Dedicated Host is configured to support.
    • state - The allocation state of the Dedicated Host ( available | under-assessment | permanent-failure | released | released-permanent-failure ).
    • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
    • (dict) --

      A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs.

      If you specify multiple filters, the filters are joined with an AND , and the request returns only results that match all of the specified filters.

      • Name (string) --

        The name of the filter. Filter names are case-sensitive.

      • Values (list) --

        The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR , and the request returns all results that match any of the specified values.

        • (string) --
  • HostIds (list) --

    The IDs of the Dedicated Hosts. The IDs are used for targeted instance launches.

    • (string) --
  • MaxResults (integer) --

    The maximum number of results to return for the request in a single page. The remaining results can be seen by sending another request with the returned nextToken value. This value can be between 5 and 500. If maxResults is given a larger value than 500, you receive an error.

    You cannot specify this parameter and the host IDs parameter in the same request.

  • NextToken (string) -- The token to use to retrieve the next page of results.
Return type

dict

Returns

Response Syntax

{
    'Hosts': [
        {
            'AutoPlacement': 'on'|'off',
            'AvailabilityZone': 'string',
            'AvailableCapacity': {
                'AvailableInstanceCapacity': [
                    {
                        'AvailableCapacity': 123,
                        'InstanceType': 'string',
                        'TotalCapacity': 123
                    },
                ],
                'AvailableVCpus': 123
            },
            'ClientToken': 'string',
            'HostId': 'string',
            'HostProperties': {
                'Cores': 123,
                'InstanceType': 'string',
                'InstanceFamily': 'string',
                'Sockets': 123,
                'TotalVCpus': 123
            },
            'HostReservationId': 'string',
            'Instances': [
                {
                    'InstanceId': 'string',
                    'InstanceType': 'string',
                    'OwnerId': 'string'
                },
            ],
            'State': 'available'|'under-assessment'|'permanent-failure'|'released'|'released-permanent-failure'|'pending',
            'AllocationTime': datetime(2015, 1, 1),
            'ReleaseTime': datetime(2015, 1, 1),
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'HostRecovery': 'on'|'off',
            'AllowsMultipleInstanceTypes': 'on'|'off',
            'OwnerId': 'string',
            'AvailabilityZoneId': 'string',
            'MemberOfServiceLinkedResourceGroup': True|False,
            'OutpostArn': 'string',
            'HostMaintenance': 'on'|'off'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Hosts (list) --

      Information about the Dedicated Hosts.

      • (dict) --

        Describes the properties of the Dedicated Host.

        • AutoPlacement (string) --

          Whether auto-placement is on or off.

        • AvailabilityZone (string) --

          The Availability Zone of the Dedicated Host.

        • AvailableCapacity (dict) --

          Information about the instances running on the Dedicated Host.

          • AvailableInstanceCapacity (list) --

            The number of instances that can be launched onto the Dedicated Host depending on the host's available capacity. For Dedicated Hosts that support multiple instance types, this parameter represents the number of instances for each instance size that is supported on the host.

            • (dict) --

              Information about the number of instances that can be launched onto the Dedicated Host.

              • AvailableCapacity (integer) --

                The number of instances that can be launched onto the Dedicated Host based on the host's available capacity.

              • InstanceType (string) --

                The instance type supported by the Dedicated Host.

              • TotalCapacity (integer) --

                The total number of instances that can be launched onto the Dedicated Host if there are no instances running on it.

          • AvailableVCpus (integer) --

            The number of vCPUs available for launching instances onto the Dedicated Host.

        • ClientToken (string) --

          Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

        • HostId (string) --

          The ID of the Dedicated Host.

        • HostProperties (dict) --

          The hardware specifications of the Dedicated Host.

          • Cores (integer) --

            The number of cores on the Dedicated Host.

          • InstanceType (string) --

            The instance type supported by the Dedicated Host. For example, m5.large . If the host supports multiple instance types, no instanceType is returned.

          • InstanceFamily (string) --

            The instance family supported by the Dedicated Host. For example, m5 .

          • Sockets (integer) --

            The number of sockets on the Dedicated Host.

          • TotalVCpus (integer) --

            The total number of vCPUs on the Dedicated Host.

        • HostReservationId (string) --

          The reservation ID of the Dedicated Host. This returns a null response if the Dedicated Host doesn't have an associated reservation.

        • Instances (list) --

          The IDs and instance type that are currently running on the Dedicated Host.

          • (dict) --

            Describes an instance running on a Dedicated Host.

            • InstanceId (string) --

              The ID of instance that is running on the Dedicated Host.

            • InstanceType (string) --

              The instance type (for example, m3.medium ) of the running instance.

            • OwnerId (string) --

              The ID of the Amazon Web Services account that owns the instance.

        • State (string) --

          The Dedicated Host's state.

        • AllocationTime (datetime) --

          The time that the Dedicated Host was allocated.

        • ReleaseTime (datetime) --

          The time that the Dedicated Host was released.

        • Tags (list) --

          Any tags assigned to the Dedicated Host.

          • (dict) --

            Describes a tag.

            • Key (string) --

              The key of the tag.

              Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws: .

            • Value (string) --

              The value of the tag.

              Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

        • HostRecovery (string) --

          Indicates whether host recovery is enabled or disabled for the Dedicated Host.

        • AllowsMultipleInstanceTypes (string) --

          Indicates whether the Dedicated Host supports multiple instance types of the same instance family. If the value is on , the Dedicated Host supports multiple instance types in the instance family. If the value is off , the Dedicated Host supports a single instance type only.

        • OwnerId (string) --

          The ID of the Amazon Web Services account that owns the Dedicated Host.

        • AvailabilityZoneId (string) --

          The ID of the Availability Zone in which the Dedicated Host is allocated.

        • MemberOfServiceLinkedResourceGroup (boolean) --

          Indicates whether the Dedicated Host is in a host resource group. If memberOfServiceLinkedResourceGroup is true , the host is in a host resource group; otherwise, it is not.

        • OutpostArn (string) --

          The Amazon Resource Name (ARN) of the Amazon Web Services Outpost on which the Dedicated Host is allocated.

        • HostMaintenance (string) --

          Indicates whether host maintenance is enabled or disabled for the Dedicated Host.

    • NextToken (string) --

      The token to use to retrieve the next page of results. This value is null when there are no more results to return.