2019/06/04 - Amazon Elastic Compute Cloud - 3 updated api methods
Changes This release adds support for Host Recovery feature which automatically restarts instances on to a new replacement host if failures are detected on Dedicated Host.
{'HostRecovery': 'on | off'}
Allocates a Dedicated Host to your account. At a minimum, specify the instance size type, Availability Zone, and quantity of hosts to allocate.
See also: AWS API Documentation
Request Syntax
client.allocate_hosts( AutoPlacement='on'|'off', AvailabilityZone='string', ClientToken='string', InstanceType='string', Quantity=123, TagSpecifications=[ { 'ResourceType': 'client-vpn-endpoint'|'customer-gateway'|'dedicated-host'|'dhcp-options'|'elastic-ip'|'fleet'|'fpga-image'|'host-reservation'|'image'|'instance'|'internet-gateway'|'launch-template'|'natgateway'|'network-acl'|'network-interface'|'reserved-instances'|'route-table'|'security-group'|'snapshot'|'spot-instances-request'|'subnet'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-route-table'|'volume'|'vpc'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], HostRecovery='on'|'off' )
string
Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see Understanding Instance Placement and Host Affinity in the Amazon EC2 User Guide for Linux Instances .
Default: on
string
[REQUIRED]
The Availability Zone in which to allocate the Dedicated Host.
string
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency .
string
[REQUIRED]
Specifies the instance type for which to configure your Dedicated Hosts. When you specify the instance type, that is the only instance type that you can launch onto that host.
integer
[REQUIRED]
The number of Dedicated Hosts to allocate to your account with these parameters.
list
The tags to apply to the Dedicated Host during creation.
(dict) --
The tags to apply to a resource when the resource is being created.
ResourceType (string) --
The type of resource to tag. Currently, the resource types that support tagging on creation are fleet , dedicated-host , instance , snapshot , and volume . To tag a resource after it has been created, see CreateTags .
Tags (list) --
The tags to apply to the resource.
(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 255 Unicode characters.
string
Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default. For more information, see Host Recovery in the Amazon Elastic Compute Cloud User Guide .
Default: off
dict
Response Syntax
{ 'HostIds': [ 'string', ] }
Response Structure
(dict) --
Contains the output of AllocateHosts.
HostIds (list) --
The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.
(string) --
{'Hosts': {'HostRecovery': 'on | off', 'State': ['pending']}}
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
client.describe_hosts( Filter=[ { 'Name': 'string', 'Values': [ 'string', ] }, ], HostIds=[ 'string', ], MaxResults=123, NextToken='string' )
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. The filters supported by a describe operation are documented with the describe operation. For example:
DescribeAvailabilityZones
DescribeImages
DescribeInstances
DescribeKeyPairs
DescribeSecurityGroups
DescribeSnapshots
DescribeSubnets
DescribeTags
DescribeVolumes
DescribeVpcs
Name (string) --
The name of the filter. Filter names are case-sensitive.
Values (list) --
The filter values. Filter values are case-sensitive.
(string) --
list
The IDs of the Dedicated Hosts. The IDs are used for targeted instance launches.
(string) --
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.
string
The token to use to retrieve the next page of results.
dict
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', 'Sockets': 123, 'TotalVCpus': 123 }, 'HostReservationId': 'string', 'Instances': [ { 'InstanceId': 'string', 'InstanceType': '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' }, ], '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) --
The number of new instances that can be launched onto the Dedicated Host.
AvailableInstanceCapacity (list) --
The total number of instances supported by the Dedicated Host.
(dict) --
Information about the instance type that the Dedicated Host supports.
AvailableCapacity (integer) --
The number of instances that can still be launched onto the Dedicated Host.
InstanceType (string) --
The instance type size supported by the Dedicated Host.
TotalCapacity (integer) --
The total number of instances that can be launched onto the Dedicated Host.
AvailableVCpus (integer) --
The number of vCPUs available on the Dedicated Host.
ClientToken (string) --
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to Ensure 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 size that the Dedicated Host supports (for example, m3.medium ).
Sockets (integer) --
The number of sockets on the Dedicated Host.
TotalVCpus (integer) --
The 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 IDs of instances that are running on the Dedicated Host.
InstanceType (string) --
The instance type size (for example, m3.medium ) of the running 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 255 Unicode characters.
HostRecovery (string) --
Indicates whether host recovery 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.
{'HostRecovery': 'on | off'}
Modify the auto-placement setting of a Dedicated Host. When auto-placement is enabled, any instances that you launch with a tenancy of host but without a specific host ID are placed onto any available Dedicated Host in your account that has auto-placement enabled. When auto-placement is disabled, you need to provide a host ID to have the instance launch onto a specific host. If no host ID is provided, the instance is launched onto a suitable host with auto-placement enabled.
See also: AWS API Documentation
Request Syntax
client.modify_hosts( AutoPlacement='on'|'off', HostIds=[ 'string', ], HostRecovery='on'|'off' )
string
Specify whether to enable or disable auto-placement.
list
[REQUIRED]
The IDs of the Dedicated Hosts to modify.
(string) --
string
Indicates whether to enable or disable host recovery for the Dedicated Host. For more information, see Host Recovery in the Amazon Elastic Compute Cloud User Guide .
dict
Response Syntax
{ 'Successful': [ 'string', ], 'Unsuccessful': [ { 'Error': { 'Code': 'string', 'Message': 'string' }, 'ResourceId': 'string' }, ] }
Response Structure
(dict) --
Successful (list) --
The IDs of the Dedicated Hosts that were successfully modified.
(string) --
Unsuccessful (list) --
The IDs of the Dedicated Hosts that could not be modified. Check whether the setting you requested can be used.
(dict) --
Information about items that were not successfully processed in a batch call.
Error (dict) --
Information about the error.
Code (string) --
The error code.
Message (string) --
The error message accompanying the error code.
ResourceId (string) --
The ID of the resource.