Amazon Elastic Compute Cloud

2017/09/18 - Amazon Elastic Compute Cloud - 4 updated api methods

Changes  Amazon EC2 now lets you opt for Spot instances to be stopped in the event of an interruption instead of being terminated. Your Spot request can be fulfilled again by restarting instances from a previously stopped state, subject to availability of capacity at or below your preferred price. When you submit a persistent Spot request, you can choose from "terminate" or "stop" as the instance interruption behavior. Choosing "stop" will shutdown your Spot instances so you can continue from this stopped state later on. This feature is only available for instances with Amazon EBS volume as their root device.

DescribeSpotFleetRequests (updated) Link ¶
Changes (response)
{'SpotFleetRequestConfigs': {'SpotFleetRequestConfig': {'InstanceInterruptionBehavior': 'stop '
                                                                                        '| '
                                                                                        'terminate'}}}

Describes your Spot fleet requests.

Spot fleet requests are deleted 48 hours after they are canceled and their instances are terminated.

See also: AWS API Documentation

Request Syntax

client.describe_spot_fleet_requests(
    DryRun=True|False,
    MaxResults=123,
    NextToken='string',
    SpotFleetRequestIds=[
        'string',
    ]
)
type DryRun

boolean

param DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

type MaxResults

integer

param MaxResults

The maximum number of results to return in a single call. Specify a value between 1 and 1000. The default value is 1000. To retrieve the remaining results, make another call with the returned NextToken value.

type NextToken

string

param NextToken

The token for the next set of results.

type SpotFleetRequestIds

list

param SpotFleetRequestIds

The IDs of the Spot fleet requests.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'SpotFleetRequestConfigs': [
        {
            'ActivityStatus': 'error'|'pending_fulfillment'|'pending_termination'|'fulfilled',
            'CreateTime': datetime(2015, 1, 1),
            'SpotFleetRequestConfig': {
                'AllocationStrategy': 'lowestPrice'|'diversified',
                'ClientToken': 'string',
                'ExcessCapacityTerminationPolicy': 'noTermination'|'default',
                'FulfilledCapacity': 123.0,
                'IamFleetRole': 'string',
                'LaunchSpecifications': [
                    {
                        'SecurityGroups': [
                            {
                                'GroupName': 'string',
                                'GroupId': 'string'
                            },
                        ],
                        'AddressingType': 'string',
                        'BlockDeviceMappings': [
                            {
                                'DeviceName': 'string',
                                'VirtualName': 'string',
                                'Ebs': {
                                    'Encrypted': True|False,
                                    'DeleteOnTermination': True|False,
                                    'Iops': 123,
                                    'SnapshotId': 'string',
                                    'VolumeSize': 123,
                                    'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1'
                                },
                                'NoDevice': 'string'
                            },
                        ],
                        'EbsOptimized': True|False,
                        'IamInstanceProfile': {
                            'Arn': 'string',
                            'Name': 'string'
                        },
                        'ImageId': 'string',
                        'InstanceType': 't1.micro'|'t2.nano'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'t2.xlarge'|'t2.2xlarge'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'m4.16xlarge'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'r4.large'|'r4.xlarge'|'r4.2xlarge'|'r4.4xlarge'|'r4.8xlarge'|'r4.16xlarge'|'x1.16xlarge'|'x1.32xlarge'|'x1e.32xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'i3.large'|'i3.xlarge'|'i3.2xlarge'|'i3.4xlarge'|'i3.8xlarge'|'i3.16xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'g2.8xlarge'|'g3.4xlarge'|'g3.8xlarge'|'g3.16xlarge'|'cg1.4xlarge'|'p2.xlarge'|'p2.8xlarge'|'p2.16xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'|'f1.2xlarge'|'f1.16xlarge',
                        'KernelId': 'string',
                        'KeyName': 'string',
                        'Monitoring': {
                            'Enabled': True|False
                        },
                        'NetworkInterfaces': [
                            {
                                'AssociatePublicIpAddress': True|False,
                                'DeleteOnTermination': True|False,
                                'Description': 'string',
                                'DeviceIndex': 123,
                                'Groups': [
                                    'string',
                                ],
                                'Ipv6AddressCount': 123,
                                'Ipv6Addresses': [
                                    {
                                        'Ipv6Address': 'string'
                                    },
                                ],
                                'NetworkInterfaceId': 'string',
                                'PrivateIpAddress': 'string',
                                'PrivateIpAddresses': [
                                    {
                                        'Primary': True|False,
                                        'PrivateIpAddress': 'string'
                                    },
                                ],
                                'SecondaryPrivateIpAddressCount': 123,
                                'SubnetId': 'string'
                            },
                        ],
                        'Placement': {
                            'AvailabilityZone': 'string',
                            'GroupName': 'string',
                            'Tenancy': 'default'|'dedicated'|'host'
                        },
                        'RamdiskId': 'string',
                        'SpotPrice': 'string',
                        'SubnetId': 'string',
                        'UserData': 'string',
                        'WeightedCapacity': 123.0,
                        'TagSpecifications': [
                            {
                                'ResourceType': 'customer-gateway'|'dhcp-options'|'image'|'instance'|'internet-gateway'|'network-acl'|'network-interface'|'reserved-instances'|'route-table'|'snapshot'|'spot-instances-request'|'subnet'|'security-group'|'volume'|'vpc'|'vpn-connection'|'vpn-gateway',
                                'Tags': [
                                    {
                                        'Key': 'string',
                                        'Value': 'string'
                                    },
                                ]
                            },
                        ]
                    },
                ],
                'SpotPrice': 'string',
                'TargetCapacity': 123,
                'TerminateInstancesWithExpiration': True|False,
                'Type': 'request'|'maintain',
                'ValidFrom': datetime(2015, 1, 1),
                'ValidUntil': datetime(2015, 1, 1),
                'ReplaceUnhealthyInstances': True|False,
                'InstanceInterruptionBehavior': 'stop'|'terminate'
            },
            'SpotFleetRequestId': 'string',
            'SpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating'|'modifying'
        },
    ]
}

Response Structure

  • (dict) --

    Contains the output of DescribeSpotFleetRequests.

    • NextToken (string) --

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

    • SpotFleetRequestConfigs (list) --

      Information about the configuration of your Spot fleet.

      • (dict) --

        Describes a Spot fleet request.

        • ActivityStatus (string) --

          The progress of the Spot fleet request. If there is an error, the status is error . After all bids are placed, the status is pending_fulfillment . If the size of the fleet is equal to or greater than its target capacity, the status is fulfilled . If the size of the fleet is decreased, the status is pending_termination while Spot instances are terminating.

        • CreateTime (datetime) --

          The creation date and time of the request.

        • SpotFleetRequestConfig (dict) --

          Information about the configuration of the Spot fleet request.

          • AllocationStrategy (string) --

            Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is lowestPrice .

          • ClientToken (string) --

            A unique, case-sensitive identifier you provide to ensure idempotency of your listings. This helps avoid duplicate listings. For more information, see Ensuring Idempotency.

          • ExcessCapacityTerminationPolicy (string) --

            Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.

          • FulfilledCapacity (float) --

            The number of units fulfilled by this request compared to the set target capacity.

          • IamFleetRole (string) --

            Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration .

          • LaunchSpecifications (list) --

            Information about the launch specifications for the Spot fleet request.

            • (dict) --

              Describes the launch specification for one or more Spot instances.

              • SecurityGroups (list) --

                One or more security groups. When requesting instances in a VPC, you must specify the IDs of the security groups. When requesting instances in EC2-Classic, you can specify the names or the IDs of the security groups.

                • (dict) --

                  Describes a security group.

                  • GroupName (string) --

                    The name of the security group.

                  • GroupId (string) --

                    The ID of the security group.

              • AddressingType (string) --

                Deprecated.

              • BlockDeviceMappings (list) --

                One or more block device mapping entries.

                • (dict) --

                  Describes a block device mapping.

                  • DeviceName (string) --

                    The device name exposed to the instance (for example, /dev/sdh or xvdh ).

                  • VirtualName (string) --

                    The virtual device name ( ephemeral N). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 .The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

                    Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

                  • Ebs (dict) --

                    Parameters used to automatically set up EBS volumes when the instance is launched.

                    • Encrypted (boolean) --

                      Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption.

                    • DeleteOnTermination (boolean) --

                      Indicates whether the EBS volume is deleted on instance termination.

                    • Iops (integer) --

                      The number of I/O operations per second (IOPS) that the volume supports. For io1 , this represents the number of IOPS that are provisioned for the volume. For gp2 , this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .

                      Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.

                      Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2 , st1 , sc1 , or standard volumes.

                    • SnapshotId (string) --

                      The ID of the snapshot.

                    • VolumeSize (integer) --

                      The size of the volume, in GiB.

                      Constraints: 1-16384 for General Purpose SSD ( gp2 ), 4-16384 for Provisioned IOPS SSD ( io1 ), 500-16384 for Throughput Optimized HDD ( st1 ), 500-16384 for Cold HDD ( sc1 ), and 1-1024 for Magnetic ( standard ) volumes. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

                      Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

                    • VolumeType (string) --

                      The volume type: gp2 , io1 , st1 , sc1 , or standard .

                      Default: standard

                  • NoDevice (string) --

                    Suppresses the specified device included in the block device mapping of the AMI.

              • EbsOptimized (boolean) --

                Indicates whether the instances are optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

                Default: false

              • IamInstanceProfile (dict) --

                The IAM instance profile.

                • Arn (string) --

                  The Amazon Resource Name (ARN) of the instance profile.

                • Name (string) --

                  The name of the instance profile.

              • ImageId (string) --

                The ID of the AMI.

              • InstanceType (string) --

                The instance type. Note that T2 and HS1 instance types are not supported.

              • KernelId (string) --

                The ID of the kernel.

              • KeyName (string) --

                The name of the key pair.

              • Monitoring (dict) --

                Enable or disable monitoring for the instances.

                • Enabled (boolean) --

                  Enables monitoring for the instance.

                  Default: false

              • NetworkInterfaces (list) --

                One or more network interfaces. If you specify a network interface, you must specify subnet IDs and security group IDs using the network interface.

                • (dict) --

                  Describes a network interface.

                  • AssociatePublicIpAddress (boolean) --

                    Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true .

                  • DeleteOnTermination (boolean) --

                    If set to true , the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

                  • Description (string) --

                    The description of the network interface. Applies only if creating a network interface when launching an instance.

                  • DeviceIndex (integer) --

                    The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

                  • Groups (list) --

                    The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

                    • (string) --

                  • Ipv6AddressCount (integer) --

                    A number of IPv6 addresses to assign to the network interface. Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

                  • Ipv6Addresses (list) --

                    One or more IPv6 addresses to assign to the network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

                    • (dict) --

                      Describes an IPv6 address.

                      • Ipv6Address (string) --

                        The IPv6 address.

                  • NetworkInterfaceId (string) --

                    The ID of the network interface.

                  • PrivateIpAddress (string) --

                    The private IPv4 address of the network interface. Applies only if creating a network interface when launching an instance. You cannot specify this option if you're launching more than one instance in a RunInstances request.

                  • PrivateIpAddresses (list) --

                    One or more private IPv4 addresses to assign to the network interface. Only one private IPv4 address can be designated as primary. You cannot specify this option if you're launching more than one instance in a RunInstances request.

                    • (dict) --

                      Describes a secondary private IPv4 address for a network interface.

                      • Primary (boolean) --

                        Indicates whether the private IPv4 address is the primary private IPv4 address. Only one IPv4 address can be designated as primary.

                      • PrivateIpAddress (string) --

                        The private IPv4 addresses.

                  • SecondaryPrivateIpAddressCount (integer) --

                    The number of secondary private IPv4 addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option. You cannot specify this option if you're launching more than one instance in a RunInstances request.

                  • SubnetId (string) --

                    The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

              • Placement (dict) --

                The placement information.

                • AvailabilityZone (string) --

                  The Availability Zone.

                  [Spot fleet only] To specify multiple Availability Zones, separate them using commas; for example, "us-west-2a, us-west-2b".

                • GroupName (string) --

                  The name of the placement group (for cluster instances).

                • Tenancy (string) --

                  The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for Spot instances.

              • RamdiskId (string) --

                The ID of the RAM disk.

              • SpotPrice (string) --

                The bid price per unit hour for the specified instance type. If this value is not specified, the default is the Spot bid price specified for the fleet. To determine the bid price per unit hour, divide the Spot bid price by the value of WeightedCapacity .

              • SubnetId (string) --

                The ID of the subnet in which to launch the instances. To specify multiple subnets, separate them using commas; for example, "subnet-a61dafcf, subnet-65ea5f08".

              • UserData (string) --

                The user data to make available to the instances. If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.

              • WeightedCapacity (float) --

                The number of units provided by the specified instance type. These are the same units that you chose to set the target capacity in terms (instances or a performance characteristic such as vCPUs, memory, or I/O).

                If the target capacity divided by this value is not a whole number, we round the number of instances to the next whole number. If this value is not specified, the default is 1.

              • TagSpecifications (list) --

                The tags to apply during creation.

                • (dict) --

                  The tags for a Spot fleet resource.

                  • ResourceType (string) --

                    The type of resource. Currently, the only resource type that is supported is instance .

                  • Tags (list) --

                    The tags.

                    • (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.

          • SpotPrice (string) --

            The bid price per unit hour.

          • TargetCapacity (integer) --

            The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.

          • TerminateInstancesWithExpiration (boolean) --

            Indicates whether running Spot instances should be terminated when the Spot fleet request expires.

          • Type (string) --

            The type of request. Indicates whether the fleet will only request the target capacity or also attempt to maintain it. When you request a certain target capacity, the fleet will only place the required bids. It will not attempt to replenish Spot instances if capacity is diminished, nor will it submit bids in alternative Spot pools if capacity is not available. When you want to maintain a certain target capacity, fleet will place the required bids to meet this target capacity. It will also automatically replenish any interrupted instances. Default: maintain .

          • ValidFrom (datetime) --

            The start date and time of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). The default is to start fulfilling the request immediately.

          • ValidUntil (datetime) --

            The end date and time of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). At this point, no new Spot instance requests are placed or enabled to fulfill the request.

          • ReplaceUnhealthyInstances (boolean) --

            Indicates whether Spot fleet should replace unhealthy instances.

          • InstanceInterruptionBehavior (string) --

            Indicates whether a Spot instance stops or terminates when it is interrupted.

        • SpotFleetRequestId (string) --

          The ID of the Spot fleet request.

        • SpotFleetRequestState (string) --

          The state of the Spot fleet request.

DescribeSpotInstanceRequests (updated) Link ¶
Changes (response)
{'SpotInstanceRequests': {'InstanceInterruptionBehavior': 'stop | terminate'}}

Describes the Spot instance requests that belong to your account. Spot instances are instances that Amazon EC2 launches when the bid price that you specify exceeds the current Spot price. Amazon EC2 periodically sets the Spot price based on available Spot instance capacity and current Spot instance requests. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide .

You can use DescribeSpotInstanceRequests to find a running Spot instance by examining the response. If the status of the Spot instance is fulfilled , the instance ID appears in the response and contains the identifier of the instance. Alternatively, you can use DescribeInstances with a filter to look for instances where the instance lifecycle is spot .

Spot instance requests are deleted 4 hours after they are canceled and their instances are terminated.

See also: AWS API Documentation

Request Syntax

client.describe_spot_instance_requests(
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    DryRun=True|False,
    SpotInstanceRequestIds=[
        'string',
    ]
)
type Filters

list

param Filters

One or more filters.

  • availability-zone-group - The Availability Zone group.

  • create-time - The time stamp when the Spot instance request was created.

  • fault-code - The fault code related to the request.

  • fault-message - The fault message related to the request.

  • instance-id - The ID of the instance that fulfilled the request.

  • launch-group - The Spot instance launch group.

  • launch.block-device-mapping.delete-on-termination - Indicates whether the Amazon EBS volume is deleted on instance termination.

  • launch.block-device-mapping.device-name - The device name for the Amazon EBS volume (for example, /dev/sdh ).

  • launch.block-device-mapping.snapshot-id - The ID of the snapshot used for the Amazon EBS volume.

  • launch.block-device-mapping.volume-size - The size of the Amazon EBS volume, in GiB.

  • launch.block-device-mapping.volume-type - The type of the Amazon EBS volume: gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic.

  • launch.group-id - The security group for the instance.

  • launch.image-id - The ID of the AMI.

  • launch.instance-type - The type of instance (for example, m3.medium ).

  • launch.kernel-id - The kernel ID.

  • launch.key-name - The name of the key pair the instance launched with.

  • launch.monitoring-enabled - Whether monitoring is enabled for the Spot instance.

  • launch.ramdisk-id - The RAM disk ID.

  • network-interface.network-interface-id - The ID of the network interface.

  • network-interface.device-index - The index of the device for the network interface attachment on the instance.

  • network-interface.subnet-id - The ID of the subnet for the instance.

  • network-interface.description - A description of the network interface.

  • network-interface.private-ip-address - The primary private IP address of the network interface.

  • network-interface.delete-on-termination - Indicates whether the network interface is deleted when the instance is terminated.

  • network-interface.group-id - The ID of the security group associated with the network interface.

  • network-interface.group-name - The name of the security group associated with the network interface.

  • network-interface.addresses.primary - Indicates whether the IP address is the primary private IP address.

  • product-description - The product description associated with the instance ( Linux/UNIX | Windows ).

  • spot-instance-request-id - The Spot instance request ID.

  • spot-price - The maximum hourly price for any Spot instance launched to fulfill the request.

  • state - The state of the Spot instance request ( open | active | closed | cancelled | failed ). Spot bid status information can help you track your Amazon EC2 Spot instance requests. For more information, see Spot Bid Status in the Amazon Elastic Compute Cloud User Guide.

  • status-code - The short code describing the most recent evaluation of your Spot instance request.

  • status-message - The message explaining the status of the Spot instance request.

  • tag :key =*value* - The key/value combination of a tag assigned to the resource. Specify the key of the tag in the filter name and the value of the tag in the filter value. For example, for the tag Purpose=X, specify tag:Purpose for the filter name and X for the filter value.

  • tag-key - The key of a tag assigned to the resource. This filter is independent of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" and the filter "tag-value=X", you get any resources assigned both the tag key Purpose (regardless of what the tag's value is), and the tag value X (regardless of what the tag's key is). If you want to list only resources where Purpose is X, see the tag :key =*value* filter.

  • tag-value - The value of a tag assigned to the resource. This filter is independent of the tag-key filter.

  • type - The type of Spot instance request ( one-time | persistent ).

  • launched-availability-zone - The Availability Zone in which the bid is launched.

  • valid-from - The start date of the request.

  • valid-until - The end date of the request.

  • (dict) --

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

    • Name (string) --

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

    • Values (list) --

      One or more filter values. Filter values are case-sensitive.

      • (string) --

type DryRun

boolean

param DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

type SpotInstanceRequestIds

list

param SpotInstanceRequestIds

One or more Spot instance request IDs.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'SpotInstanceRequests': [
        {
            'ActualBlockHourlyPrice': 'string',
            'AvailabilityZoneGroup': 'string',
            'BlockDurationMinutes': 123,
            'CreateTime': datetime(2015, 1, 1),
            'Fault': {
                'Code': 'string',
                'Message': 'string'
            },
            'InstanceId': 'string',
            'LaunchGroup': 'string',
            'LaunchSpecification': {
                'UserData': 'string',
                'SecurityGroups': [
                    {
                        'GroupName': 'string',
                        'GroupId': 'string'
                    },
                ],
                'AddressingType': 'string',
                'BlockDeviceMappings': [
                    {
                        'DeviceName': 'string',
                        'VirtualName': 'string',
                        'Ebs': {
                            'Encrypted': True|False,
                            'DeleteOnTermination': True|False,
                            'Iops': 123,
                            'SnapshotId': 'string',
                            'VolumeSize': 123,
                            'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1'
                        },
                        'NoDevice': 'string'
                    },
                ],
                'EbsOptimized': True|False,
                'IamInstanceProfile': {
                    'Arn': 'string',
                    'Name': 'string'
                },
                'ImageId': 'string',
                'InstanceType': 't1.micro'|'t2.nano'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'t2.xlarge'|'t2.2xlarge'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'m4.16xlarge'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'r4.large'|'r4.xlarge'|'r4.2xlarge'|'r4.4xlarge'|'r4.8xlarge'|'r4.16xlarge'|'x1.16xlarge'|'x1.32xlarge'|'x1e.32xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'i3.large'|'i3.xlarge'|'i3.2xlarge'|'i3.4xlarge'|'i3.8xlarge'|'i3.16xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'g2.8xlarge'|'g3.4xlarge'|'g3.8xlarge'|'g3.16xlarge'|'cg1.4xlarge'|'p2.xlarge'|'p2.8xlarge'|'p2.16xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'|'f1.2xlarge'|'f1.16xlarge',
                'KernelId': 'string',
                'KeyName': 'string',
                'NetworkInterfaces': [
                    {
                        'AssociatePublicIpAddress': True|False,
                        'DeleteOnTermination': True|False,
                        'Description': 'string',
                        'DeviceIndex': 123,
                        'Groups': [
                            'string',
                        ],
                        'Ipv6AddressCount': 123,
                        'Ipv6Addresses': [
                            {
                                'Ipv6Address': 'string'
                            },
                        ],
                        'NetworkInterfaceId': 'string',
                        'PrivateIpAddress': 'string',
                        'PrivateIpAddresses': [
                            {
                                'Primary': True|False,
                                'PrivateIpAddress': 'string'
                            },
                        ],
                        'SecondaryPrivateIpAddressCount': 123,
                        'SubnetId': 'string'
                    },
                ],
                'Placement': {
                    'AvailabilityZone': 'string',
                    'GroupName': 'string',
                    'Tenancy': 'default'|'dedicated'|'host'
                },
                'RamdiskId': 'string',
                'SubnetId': 'string',
                'Monitoring': {
                    'Enabled': True|False
                }
            },
            'LaunchedAvailabilityZone': 'string',
            'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
            'SpotInstanceRequestId': 'string',
            'SpotPrice': 'string',
            'State': 'open'|'active'|'closed'|'cancelled'|'failed',
            'Status': {
                'Code': 'string',
                'Message': 'string',
                'UpdateTime': datetime(2015, 1, 1)
            },
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'Type': 'one-time'|'persistent',
            'ValidFrom': datetime(2015, 1, 1),
            'ValidUntil': datetime(2015, 1, 1),
            'InstanceInterruptionBehavior': 'stop'|'terminate'
        },
    ]
}

Response Structure

  • (dict) --

    Contains the output of DescribeSpotInstanceRequests.

    • SpotInstanceRequests (list) --

      One or more Spot instance requests.

      • (dict) --

        Describes a Spot instance request.

        • ActualBlockHourlyPrice (string) --

          If you specified a duration and your Spot instance request was fulfilled, this is the fixed hourly price in effect for the Spot instance while it runs.

        • AvailabilityZoneGroup (string) --

          The Availability Zone group. If you specify the same Availability Zone group for all Spot instance requests, all Spot instances are launched in the same Availability Zone.

        • BlockDurationMinutes (integer) --

          The duration for the Spot instance, in minutes.

        • CreateTime (datetime) --

          The date and time when the Spot instance request was created, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z).

        • Fault (dict) --

          The fault codes for the Spot instance request, if any.

          • Code (string) --

            The reason code for the Spot instance state change.

          • Message (string) --

            The message for the Spot instance state change.

        • InstanceId (string) --

          The instance ID, if an instance has been launched to fulfill the Spot instance request.

        • LaunchGroup (string) --

          The instance launch group. Launch groups are Spot instances that launch together and terminate together.

        • LaunchSpecification (dict) --

          Additional information for launching instances.

          • UserData (string) --

            The user data to make available to the instances. If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.

          • SecurityGroups (list) --

            One or more security groups. When requesting instances in a VPC, you must specify the IDs of the security groups. When requesting instances in EC2-Classic, you can specify the names or the IDs of the security groups.

            • (dict) --

              Describes a security group.

              • GroupName (string) --

                The name of the security group.

              • GroupId (string) --

                The ID of the security group.

          • AddressingType (string) --

            Deprecated.

          • BlockDeviceMappings (list) --

            One or more block device mapping entries.

            Although you can specify encrypted EBS volumes in this block device mapping for your Spot Instances, these volumes are not encrypted.

            • (dict) --

              Describes a block device mapping.

              • DeviceName (string) --

                The device name exposed to the instance (for example, /dev/sdh or xvdh ).

              • VirtualName (string) --

                The virtual device name ( ephemeral N). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 .The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

                Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

              • Ebs (dict) --

                Parameters used to automatically set up EBS volumes when the instance is launched.

                • Encrypted (boolean) --

                  Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption.

                • DeleteOnTermination (boolean) --

                  Indicates whether the EBS volume is deleted on instance termination.

                • Iops (integer) --

                  The number of I/O operations per second (IOPS) that the volume supports. For io1 , this represents the number of IOPS that are provisioned for the volume. For gp2 , this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .

                  Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.

                  Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2 , st1 , sc1 , or standard volumes.

                • SnapshotId (string) --

                  The ID of the snapshot.

                • VolumeSize (integer) --

                  The size of the volume, in GiB.

                  Constraints: 1-16384 for General Purpose SSD ( gp2 ), 4-16384 for Provisioned IOPS SSD ( io1 ), 500-16384 for Throughput Optimized HDD ( st1 ), 500-16384 for Cold HDD ( sc1 ), and 1-1024 for Magnetic ( standard ) volumes. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

                  Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

                • VolumeType (string) --

                  The volume type: gp2 , io1 , st1 , sc1 , or standard .

                  Default: standard

              • NoDevice (string) --

                Suppresses the specified device included in the block device mapping of the AMI.

          • EbsOptimized (boolean) --

            Indicates whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

            Default: false

          • IamInstanceProfile (dict) --

            The IAM instance profile.

            • Arn (string) --

              The Amazon Resource Name (ARN) of the instance profile.

            • Name (string) --

              The name of the instance profile.

          • ImageId (string) --

            The ID of the AMI.

          • InstanceType (string) --

            The instance type.

          • KernelId (string) --

            The ID of the kernel.

          • KeyName (string) --

            The name of the key pair.

          • NetworkInterfaces (list) --

            One or more network interfaces. If you specify a network interface, you must specify subnet IDs and security group IDs using the network interface.

            • (dict) --

              Describes a network interface.

              • AssociatePublicIpAddress (boolean) --

                Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true .

              • DeleteOnTermination (boolean) --

                If set to true , the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

              • Description (string) --

                The description of the network interface. Applies only if creating a network interface when launching an instance.

              • DeviceIndex (integer) --

                The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

              • Groups (list) --

                The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

                • (string) --

              • Ipv6AddressCount (integer) --

                A number of IPv6 addresses to assign to the network interface. Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

              • Ipv6Addresses (list) --

                One or more IPv6 addresses to assign to the network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

                • (dict) --

                  Describes an IPv6 address.

                  • Ipv6Address (string) --

                    The IPv6 address.

              • NetworkInterfaceId (string) --

                The ID of the network interface.

              • PrivateIpAddress (string) --

                The private IPv4 address of the network interface. Applies only if creating a network interface when launching an instance. You cannot specify this option if you're launching more than one instance in a RunInstances request.

              • PrivateIpAddresses (list) --

                One or more private IPv4 addresses to assign to the network interface. Only one private IPv4 address can be designated as primary. You cannot specify this option if you're launching more than one instance in a RunInstances request.

                • (dict) --

                  Describes a secondary private IPv4 address for a network interface.

                  • Primary (boolean) --

                    Indicates whether the private IPv4 address is the primary private IPv4 address. Only one IPv4 address can be designated as primary.

                  • PrivateIpAddress (string) --

                    The private IPv4 addresses.

              • SecondaryPrivateIpAddressCount (integer) --

                The number of secondary private IPv4 addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option. You cannot specify this option if you're launching more than one instance in a RunInstances request.

              • SubnetId (string) --

                The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

          • Placement (dict) --

            The placement information for the instance.

            • AvailabilityZone (string) --

              The Availability Zone.

              [Spot fleet only] To specify multiple Availability Zones, separate them using commas; for example, "us-west-2a, us-west-2b".

            • GroupName (string) --

              The name of the placement group (for cluster instances).

            • Tenancy (string) --

              The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for Spot instances.

          • RamdiskId (string) --

            The ID of the RAM disk.

          • SubnetId (string) --

            The ID of the subnet in which to launch the instance.

          • Monitoring (dict) --

            Describes the monitoring of an instance.

            • Enabled (boolean) --

              Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.

        • LaunchedAvailabilityZone (string) --

          The Availability Zone in which the bid is launched.

        • ProductDescription (string) --

          The product description associated with the Spot instance.

        • SpotInstanceRequestId (string) --

          The ID of the Spot instance request.

        • SpotPrice (string) --

          The maximum hourly price (bid) for the Spot instance launched to fulfill the request.

        • State (string) --

          The state of the Spot instance request. Spot bid status information can help you track your Spot instance requests. For more information, see Spot Bid Status in the Amazon Elastic Compute Cloud User Guide .

        • Status (dict) --

          The status code and status message describing the Spot instance request.

          • Code (string) --

            The status code. For a list of status codes, see Spot Bid Status Codes in the Amazon Elastic Compute Cloud User Guide .

          • Message (string) --

            The description for the status code.

          • UpdateTime (datetime) --

            The date and time of the most recent status update, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z).

        • Tags (list) --

          Any tags assigned 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.

        • Type (string) --

          The Spot instance request type.

        • ValidFrom (datetime) --

          The start date of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). The request becomes active at this date and time.

        • ValidUntil (datetime) --

          The end date of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). If this is a one-time request, it remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date is reached.

        • InstanceInterruptionBehavior (string) --

          Indicates whether a Spot instance stops or terminates when it is interrupted.

RequestSpotFleet (updated) Link ¶
Changes (request)
{'SpotFleetRequestConfig': {'InstanceInterruptionBehavior': 'stop | terminate'}}

Creates a Spot fleet request.

You can submit a single request that includes multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet.

By default, the Spot fleet requests Spot instances in the Spot pool where the price per unit is the lowest. Each launch specification can include its own instance weighting that reflects the value of the instance type to your application workload.

Alternatively, you can specify that the Spot fleet distribute the target capacity across the Spot pools included in its launch specifications. By ensuring that the Spot instances in your Spot fleet are in different Spot pools, you can improve the availability of your fleet.

For more information, see Spot Fleet Requests in the Amazon Elastic Compute Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.request_spot_fleet(
    DryRun=True|False,
    SpotFleetRequestConfig={
        'AllocationStrategy': 'lowestPrice'|'diversified',
        'ClientToken': 'string',
        'ExcessCapacityTerminationPolicy': 'noTermination'|'default',
        'FulfilledCapacity': 123.0,
        'IamFleetRole': 'string',
        'LaunchSpecifications': [
            {
                'SecurityGroups': [
                    {
                        'GroupName': 'string',
                        'GroupId': 'string'
                    },
                ],
                'AddressingType': 'string',
                'BlockDeviceMappings': [
                    {
                        'DeviceName': 'string',
                        'VirtualName': 'string',
                        'Ebs': {
                            'Encrypted': True|False,
                            'DeleteOnTermination': True|False,
                            'Iops': 123,
                            'SnapshotId': 'string',
                            'VolumeSize': 123,
                            'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1'
                        },
                        'NoDevice': 'string'
                    },
                ],
                'EbsOptimized': True|False,
                'IamInstanceProfile': {
                    'Arn': 'string',
                    'Name': 'string'
                },
                'ImageId': 'string',
                'InstanceType': 't1.micro'|'t2.nano'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'t2.xlarge'|'t2.2xlarge'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'m4.16xlarge'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'r4.large'|'r4.xlarge'|'r4.2xlarge'|'r4.4xlarge'|'r4.8xlarge'|'r4.16xlarge'|'x1.16xlarge'|'x1.32xlarge'|'x1e.32xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'i3.large'|'i3.xlarge'|'i3.2xlarge'|'i3.4xlarge'|'i3.8xlarge'|'i3.16xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'g2.8xlarge'|'g3.4xlarge'|'g3.8xlarge'|'g3.16xlarge'|'cg1.4xlarge'|'p2.xlarge'|'p2.8xlarge'|'p2.16xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'|'f1.2xlarge'|'f1.16xlarge',
                'KernelId': 'string',
                'KeyName': 'string',
                'Monitoring': {
                    'Enabled': True|False
                },
                'NetworkInterfaces': [
                    {
                        'AssociatePublicIpAddress': True|False,
                        'DeleteOnTermination': True|False,
                        'Description': 'string',
                        'DeviceIndex': 123,
                        'Groups': [
                            'string',
                        ],
                        'Ipv6AddressCount': 123,
                        'Ipv6Addresses': [
                            {
                                'Ipv6Address': 'string'
                            },
                        ],
                        'NetworkInterfaceId': 'string',
                        'PrivateIpAddress': 'string',
                        'PrivateIpAddresses': [
                            {
                                'Primary': True|False,
                                'PrivateIpAddress': 'string'
                            },
                        ],
                        'SecondaryPrivateIpAddressCount': 123,
                        'SubnetId': 'string'
                    },
                ],
                'Placement': {
                    'AvailabilityZone': 'string',
                    'GroupName': 'string',
                    'Tenancy': 'default'|'dedicated'|'host'
                },
                'RamdiskId': 'string',
                'SpotPrice': 'string',
                'SubnetId': 'string',
                'UserData': 'string',
                'WeightedCapacity': 123.0,
                'TagSpecifications': [
                    {
                        'ResourceType': 'customer-gateway'|'dhcp-options'|'image'|'instance'|'internet-gateway'|'network-acl'|'network-interface'|'reserved-instances'|'route-table'|'snapshot'|'spot-instances-request'|'subnet'|'security-group'|'volume'|'vpc'|'vpn-connection'|'vpn-gateway',
                        'Tags': [
                            {
                                'Key': 'string',
                                'Value': 'string'
                            },
                        ]
                    },
                ]
            },
        ],
        'SpotPrice': 'string',
        'TargetCapacity': 123,
        'TerminateInstancesWithExpiration': True|False,
        'Type': 'request'|'maintain',
        'ValidFrom': datetime(2015, 1, 1),
        'ValidUntil': datetime(2015, 1, 1),
        'ReplaceUnhealthyInstances': True|False,
        'InstanceInterruptionBehavior': 'stop'|'terminate'
    }
)
type DryRun

boolean

param DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

type SpotFleetRequestConfig

dict

param SpotFleetRequestConfig

[REQUIRED]

The configuration for the Spot fleet request.

  • AllocationStrategy (string) --

    Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is lowestPrice .

  • ClientToken (string) --

    A unique, case-sensitive identifier you provide to ensure idempotency of your listings. This helps avoid duplicate listings. For more information, see Ensuring Idempotency.

  • ExcessCapacityTerminationPolicy (string) --

    Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.

  • FulfilledCapacity (float) --

    The number of units fulfilled by this request compared to the set target capacity.

  • IamFleetRole (string) -- [REQUIRED]

    Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration .

  • LaunchSpecifications (list) -- [REQUIRED]

    Information about the launch specifications for the Spot fleet request.

    • (dict) --

      Describes the launch specification for one or more Spot instances.

      • SecurityGroups (list) --

        One or more security groups. When requesting instances in a VPC, you must specify the IDs of the security groups. When requesting instances in EC2-Classic, you can specify the names or the IDs of the security groups.

        • (dict) --

          Describes a security group.

          • GroupName (string) --

            The name of the security group.

          • GroupId (string) --

            The ID of the security group.

      • AddressingType (string) --

        Deprecated.

      • BlockDeviceMappings (list) --

        One or more block device mapping entries.

        • (dict) --

          Describes a block device mapping.

          • DeviceName (string) --

            The device name exposed to the instance (for example, /dev/sdh or xvdh ).

          • VirtualName (string) --

            The virtual device name ( ephemeral N). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 .The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

            Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

          • Ebs (dict) --

            Parameters used to automatically set up EBS volumes when the instance is launched.

            • Encrypted (boolean) --

              Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption.

            • DeleteOnTermination (boolean) --

              Indicates whether the EBS volume is deleted on instance termination.

            • Iops (integer) --

              The number of I/O operations per second (IOPS) that the volume supports. For io1 , this represents the number of IOPS that are provisioned for the volume. For gp2 , this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .

              Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.

              Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2 , st1 , sc1 , or standard volumes.

            • SnapshotId (string) --

              The ID of the snapshot.

            • VolumeSize (integer) --

              The size of the volume, in GiB.

              Constraints: 1-16384 for General Purpose SSD ( gp2 ), 4-16384 for Provisioned IOPS SSD ( io1 ), 500-16384 for Throughput Optimized HDD ( st1 ), 500-16384 for Cold HDD ( sc1 ), and 1-1024 for Magnetic ( standard ) volumes. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

              Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

            • VolumeType (string) --

              The volume type: gp2 , io1 , st1 , sc1 , or standard .

              Default: standard

          • NoDevice (string) --

            Suppresses the specified device included in the block device mapping of the AMI.

      • EbsOptimized (boolean) --

        Indicates whether the instances are optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

        Default: false

      • IamInstanceProfile (dict) --

        The IAM instance profile.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the instance profile.

        • Name (string) --

          The name of the instance profile.

      • ImageId (string) --

        The ID of the AMI.

      • InstanceType (string) --

        The instance type. Note that T2 and HS1 instance types are not supported.

      • KernelId (string) --

        The ID of the kernel.

      • KeyName (string) --

        The name of the key pair.

      • Monitoring (dict) --

        Enable or disable monitoring for the instances.

        • Enabled (boolean) --

          Enables monitoring for the instance.

          Default: false

      • NetworkInterfaces (list) --

        One or more network interfaces. If you specify a network interface, you must specify subnet IDs and security group IDs using the network interface.

        • (dict) --

          Describes a network interface.

          • AssociatePublicIpAddress (boolean) --

            Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true .

          • DeleteOnTermination (boolean) --

            If set to true , the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

          • Description (string) --

            The description of the network interface. Applies only if creating a network interface when launching an instance.

          • DeviceIndex (integer) --

            The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

          • Groups (list) --

            The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

            • (string) --

          • Ipv6AddressCount (integer) --

            A number of IPv6 addresses to assign to the network interface. Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

          • Ipv6Addresses (list) --

            One or more IPv6 addresses to assign to the network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

            • (dict) --

              Describes an IPv6 address.

              • Ipv6Address (string) --

                The IPv6 address.

          • NetworkInterfaceId (string) --

            The ID of the network interface.

          • PrivateIpAddress (string) --

            The private IPv4 address of the network interface. Applies only if creating a network interface when launching an instance. You cannot specify this option if you're launching more than one instance in a RunInstances request.

          • PrivateIpAddresses (list) --

            One or more private IPv4 addresses to assign to the network interface. Only one private IPv4 address can be designated as primary. You cannot specify this option if you're launching more than one instance in a RunInstances request.

            • (dict) --

              Describes a secondary private IPv4 address for a network interface.

              • Primary (boolean) --

                Indicates whether the private IPv4 address is the primary private IPv4 address. Only one IPv4 address can be designated as primary.

              • PrivateIpAddress (string) -- [REQUIRED]

                The private IPv4 addresses.

          • SecondaryPrivateIpAddressCount (integer) --

            The number of secondary private IPv4 addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option. You cannot specify this option if you're launching more than one instance in a RunInstances request.

          • SubnetId (string) --

            The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

      • Placement (dict) --

        The placement information.

        • AvailabilityZone (string) --

          The Availability Zone.

          [Spot fleet only] To specify multiple Availability Zones, separate them using commas; for example, "us-west-2a, us-west-2b".

        • GroupName (string) --

          The name of the placement group (for cluster instances).

        • Tenancy (string) --

          The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for Spot instances.

      • RamdiskId (string) --

        The ID of the RAM disk.

      • SpotPrice (string) --

        The bid price per unit hour for the specified instance type. If this value is not specified, the default is the Spot bid price specified for the fleet. To determine the bid price per unit hour, divide the Spot bid price by the value of WeightedCapacity .

      • SubnetId (string) --

        The ID of the subnet in which to launch the instances. To specify multiple subnets, separate them using commas; for example, "subnet-a61dafcf, subnet-65ea5f08".

      • UserData (string) --

        The user data to make available to the instances. If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.

      • WeightedCapacity (float) --

        The number of units provided by the specified instance type. These are the same units that you chose to set the target capacity in terms (instances or a performance characteristic such as vCPUs, memory, or I/O).

        If the target capacity divided by this value is not a whole number, we round the number of instances to the next whole number. If this value is not specified, the default is 1.

      • TagSpecifications (list) --

        The tags to apply during creation.

        • (dict) --

          The tags for a Spot fleet resource.

          • ResourceType (string) --

            The type of resource. Currently, the only resource type that is supported is instance .

          • Tags (list) --

            The tags.

            • (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.

  • SpotPrice (string) -- [REQUIRED]

    The bid price per unit hour.

  • TargetCapacity (integer) -- [REQUIRED]

    The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.

  • TerminateInstancesWithExpiration (boolean) --

    Indicates whether running Spot instances should be terminated when the Spot fleet request expires.

  • Type (string) --

    The type of request. Indicates whether the fleet will only request the target capacity or also attempt to maintain it. When you request a certain target capacity, the fleet will only place the required bids. It will not attempt to replenish Spot instances if capacity is diminished, nor will it submit bids in alternative Spot pools if capacity is not available. When you want to maintain a certain target capacity, fleet will place the required bids to meet this target capacity. It will also automatically replenish any interrupted instances. Default: maintain .

  • ValidFrom (datetime) --

    The start date and time of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). The default is to start fulfilling the request immediately.

  • ValidUntil (datetime) --

    The end date and time of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). At this point, no new Spot instance requests are placed or enabled to fulfill the request.

  • ReplaceUnhealthyInstances (boolean) --

    Indicates whether Spot fleet should replace unhealthy instances.

  • InstanceInterruptionBehavior (string) --

    Indicates whether a Spot instance stops or terminates when it is interrupted.

rtype

dict

returns

Response Syntax

{
    'SpotFleetRequestId': 'string'
}

Response Structure

  • (dict) --

    Contains the output of RequestSpotFleet.

    • SpotFleetRequestId (string) --

      The ID of the Spot fleet request.

RequestSpotInstances (updated) Link ¶
Changes (request, response)
Request
{'InstanceInterruptionBehavior': 'stop | terminate'}
Response
{'SpotInstanceRequests': {'InstanceInterruptionBehavior': 'stop | terminate'}}

Creates a Spot instance request. Spot instances are instances that Amazon EC2 launches when the bid price that you specify exceeds the current Spot price. Amazon EC2 periodically sets the Spot price based on available Spot Instance capacity and current Spot instance requests. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.request_spot_instances(
    AvailabilityZoneGroup='string',
    BlockDurationMinutes=123,
    ClientToken='string',
    DryRun=True|False,
    InstanceCount=123,
    LaunchGroup='string',
    LaunchSpecification={
        'SecurityGroupIds': [
            'string',
        ],
        'SecurityGroups': [
            'string',
        ],
        'AddressingType': 'string',
        'BlockDeviceMappings': [
            {
                'DeviceName': 'string',
                'VirtualName': 'string',
                'Ebs': {
                    'Encrypted': True|False,
                    'DeleteOnTermination': True|False,
                    'Iops': 123,
                    'SnapshotId': 'string',
                    'VolumeSize': 123,
                    'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1'
                },
                'NoDevice': 'string'
            },
        ],
        'EbsOptimized': True|False,
        'IamInstanceProfile': {
            'Arn': 'string',
            'Name': 'string'
        },
        'ImageId': 'string',
        'InstanceType': 't1.micro'|'t2.nano'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'t2.xlarge'|'t2.2xlarge'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'m4.16xlarge'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'r4.large'|'r4.xlarge'|'r4.2xlarge'|'r4.4xlarge'|'r4.8xlarge'|'r4.16xlarge'|'x1.16xlarge'|'x1.32xlarge'|'x1e.32xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'i3.large'|'i3.xlarge'|'i3.2xlarge'|'i3.4xlarge'|'i3.8xlarge'|'i3.16xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'g2.8xlarge'|'g3.4xlarge'|'g3.8xlarge'|'g3.16xlarge'|'cg1.4xlarge'|'p2.xlarge'|'p2.8xlarge'|'p2.16xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'|'f1.2xlarge'|'f1.16xlarge',
        'KernelId': 'string',
        'KeyName': 'string',
        'Monitoring': {
            'Enabled': True|False
        },
        'NetworkInterfaces': [
            {
                'AssociatePublicIpAddress': True|False,
                'DeleteOnTermination': True|False,
                'Description': 'string',
                'DeviceIndex': 123,
                'Groups': [
                    'string',
                ],
                'Ipv6AddressCount': 123,
                'Ipv6Addresses': [
                    {
                        'Ipv6Address': 'string'
                    },
                ],
                'NetworkInterfaceId': 'string',
                'PrivateIpAddress': 'string',
                'PrivateIpAddresses': [
                    {
                        'Primary': True|False,
                        'PrivateIpAddress': 'string'
                    },
                ],
                'SecondaryPrivateIpAddressCount': 123,
                'SubnetId': 'string'
            },
        ],
        'Placement': {
            'AvailabilityZone': 'string',
            'GroupName': 'string',
            'Tenancy': 'default'|'dedicated'|'host'
        },
        'RamdiskId': 'string',
        'SubnetId': 'string',
        'UserData': 'string'
    },
    SpotPrice='string',
    Type='one-time'|'persistent',
    ValidFrom=datetime(2015, 1, 1),
    ValidUntil=datetime(2015, 1, 1),
    InstanceInterruptionBehavior='stop'|'terminate'
)
type AvailabilityZoneGroup

string

param AvailabilityZoneGroup

The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

type BlockDurationMinutes

integer

param BlockDurationMinutes

The required duration for the Spot instances (also known as Spot blocks), in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360).

The duration period starts as soon as your Spot instance receives its instance ID. At the end of the duration period, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates.

Note that you can't specify an Availability Zone group or a launch group if you specify a duration.

type ClientToken

string

param ClientToken

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud User Guide .

type DryRun

boolean

param DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

type InstanceCount

integer

param InstanceCount

The maximum number of Spot instances to launch.

Default: 1

type LaunchGroup

string

param LaunchGroup

The instance launch group. Launch groups are Spot instances that launch together and terminate together.

Default: Instances are launched and terminated individually

type LaunchSpecification

dict

param LaunchSpecification

The launch specification.

  • SecurityGroupIds (list) --

    One or more security group IDs.

    • (string) --

  • SecurityGroups (list) --

    One or more security groups. When requesting instances in a VPC, you must specify the IDs of the security groups. When requesting instances in EC2-Classic, you can specify the names or the IDs of the security groups.

    • (string) --

  • AddressingType (string) --

    Deprecated.

  • BlockDeviceMappings (list) --

    One or more block device mapping entries.

    Although you can specify encrypted EBS volumes in this block device mapping for your Spot Instances, these volumes are not encrypted.

    • (dict) --

      Describes a block device mapping.

      • DeviceName (string) --

        The device name exposed to the instance (for example, /dev/sdh or xvdh ).

      • VirtualName (string) --

        The virtual device name ( ephemeral N). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 .The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

        Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

      • Ebs (dict) --

        Parameters used to automatically set up EBS volumes when the instance is launched.

        • Encrypted (boolean) --

          Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption.

        • DeleteOnTermination (boolean) --

          Indicates whether the EBS volume is deleted on instance termination.

        • Iops (integer) --

          The number of I/O operations per second (IOPS) that the volume supports. For io1 , this represents the number of IOPS that are provisioned for the volume. For gp2 , this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .

          Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.

          Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2 , st1 , sc1 , or standard volumes.

        • SnapshotId (string) --

          The ID of the snapshot.

        • VolumeSize (integer) --

          The size of the volume, in GiB.

          Constraints: 1-16384 for General Purpose SSD ( gp2 ), 4-16384 for Provisioned IOPS SSD ( io1 ), 500-16384 for Throughput Optimized HDD ( st1 ), 500-16384 for Cold HDD ( sc1 ), and 1-1024 for Magnetic ( standard ) volumes. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

          Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

        • VolumeType (string) --

          The volume type: gp2 , io1 , st1 , sc1 , or standard .

          Default: standard

      • NoDevice (string) --

        Suppresses the specified device included in the block device mapping of the AMI.

  • EbsOptimized (boolean) --

    Indicates whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

    Default: false

  • IamInstanceProfile (dict) --

    The IAM instance profile.

    • Arn (string) --

      The Amazon Resource Name (ARN) of the instance profile.

    • Name (string) --

      The name of the instance profile.

  • ImageId (string) --

    The ID of the AMI.

  • InstanceType (string) --

    The instance type.

  • KernelId (string) --

    The ID of the kernel.

  • KeyName (string) --

    The name of the key pair.

  • Monitoring (dict) --

    Indicates whether basic or detailed monitoring is enabled for the instance.

    Default: Disabled

    • Enabled (boolean) -- [REQUIRED]

      Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.

  • NetworkInterfaces (list) --

    One or more network interfaces. If you specify a network interface, you must specify subnet IDs and security group IDs using the network interface.

    • (dict) --

      Describes a network interface.

      • AssociatePublicIpAddress (boolean) --

        Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true .

      • DeleteOnTermination (boolean) --

        If set to true , the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

      • Description (string) --

        The description of the network interface. Applies only if creating a network interface when launching an instance.

      • DeviceIndex (integer) --

        The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

      • Groups (list) --

        The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

        • (string) --

      • Ipv6AddressCount (integer) --

        A number of IPv6 addresses to assign to the network interface. Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

      • Ipv6Addresses (list) --

        One or more IPv6 addresses to assign to the network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

        • (dict) --

          Describes an IPv6 address.

          • Ipv6Address (string) --

            The IPv6 address.

      • NetworkInterfaceId (string) --

        The ID of the network interface.

      • PrivateIpAddress (string) --

        The private IPv4 address of the network interface. Applies only if creating a network interface when launching an instance. You cannot specify this option if you're launching more than one instance in a RunInstances request.

      • PrivateIpAddresses (list) --

        One or more private IPv4 addresses to assign to the network interface. Only one private IPv4 address can be designated as primary. You cannot specify this option if you're launching more than one instance in a RunInstances request.

        • (dict) --

          Describes a secondary private IPv4 address for a network interface.

          • Primary (boolean) --

            Indicates whether the private IPv4 address is the primary private IPv4 address. Only one IPv4 address can be designated as primary.

          • PrivateIpAddress (string) -- [REQUIRED]

            The private IPv4 addresses.

      • SecondaryPrivateIpAddressCount (integer) --

        The number of secondary private IPv4 addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option. You cannot specify this option if you're launching more than one instance in a RunInstances request.

      • SubnetId (string) --

        The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

  • Placement (dict) --

    The placement information for the instance.

    • AvailabilityZone (string) --

      The Availability Zone.

      [Spot fleet only] To specify multiple Availability Zones, separate them using commas; for example, "us-west-2a, us-west-2b".

    • GroupName (string) --

      The name of the placement group (for cluster instances).

    • Tenancy (string) --

      The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for Spot instances.

  • RamdiskId (string) --

    The ID of the RAM disk.

  • SubnetId (string) --

    The ID of the subnet in which to launch the instance.

  • UserData (string) --

    The user data to make available to the instances. If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.

type SpotPrice

string

param SpotPrice

[REQUIRED]

The maximum hourly price (bid) for any Spot instance launched to fulfill the request.

type Type

string

param Type

The Spot instance request type.

Default: one-time

type ValidFrom

datetime

param ValidFrom

The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

type ValidUntil

datetime

param ValidUntil

The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

type InstanceInterruptionBehavior

string

param InstanceInterruptionBehavior

Indicates whether a Spot instance stops or terminates when it is interrupted.

rtype

dict

returns

Response Syntax

{
    'SpotInstanceRequests': [
        {
            'ActualBlockHourlyPrice': 'string',
            'AvailabilityZoneGroup': 'string',
            'BlockDurationMinutes': 123,
            'CreateTime': datetime(2015, 1, 1),
            'Fault': {
                'Code': 'string',
                'Message': 'string'
            },
            'InstanceId': 'string',
            'LaunchGroup': 'string',
            'LaunchSpecification': {
                'UserData': 'string',
                'SecurityGroups': [
                    {
                        'GroupName': 'string',
                        'GroupId': 'string'
                    },
                ],
                'AddressingType': 'string',
                'BlockDeviceMappings': [
                    {
                        'DeviceName': 'string',
                        'VirtualName': 'string',
                        'Ebs': {
                            'Encrypted': True|False,
                            'DeleteOnTermination': True|False,
                            'Iops': 123,
                            'SnapshotId': 'string',
                            'VolumeSize': 123,
                            'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1'
                        },
                        'NoDevice': 'string'
                    },
                ],
                'EbsOptimized': True|False,
                'IamInstanceProfile': {
                    'Arn': 'string',
                    'Name': 'string'
                },
                'ImageId': 'string',
                'InstanceType': 't1.micro'|'t2.nano'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'t2.xlarge'|'t2.2xlarge'|'m1.small'|'m1.medium'|'m1.large'|'m1.xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge'|'m4.16xlarge'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'r4.large'|'r4.xlarge'|'r4.2xlarge'|'r4.4xlarge'|'r4.8xlarge'|'r4.16xlarge'|'x1.16xlarge'|'x1.32xlarge'|'x1e.32xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'i3.large'|'i3.xlarge'|'i3.2xlarge'|'i3.4xlarge'|'i3.8xlarge'|'i3.16xlarge'|'hi1.4xlarge'|'hs1.8xlarge'|'c1.medium'|'c1.xlarge'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'cc1.4xlarge'|'cc2.8xlarge'|'g2.2xlarge'|'g2.8xlarge'|'g3.4xlarge'|'g3.8xlarge'|'g3.16xlarge'|'cg1.4xlarge'|'p2.xlarge'|'p2.8xlarge'|'p2.16xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge'|'f1.2xlarge'|'f1.16xlarge',
                'KernelId': 'string',
                'KeyName': 'string',
                'NetworkInterfaces': [
                    {
                        'AssociatePublicIpAddress': True|False,
                        'DeleteOnTermination': True|False,
                        'Description': 'string',
                        'DeviceIndex': 123,
                        'Groups': [
                            'string',
                        ],
                        'Ipv6AddressCount': 123,
                        'Ipv6Addresses': [
                            {
                                'Ipv6Address': 'string'
                            },
                        ],
                        'NetworkInterfaceId': 'string',
                        'PrivateIpAddress': 'string',
                        'PrivateIpAddresses': [
                            {
                                'Primary': True|False,
                                'PrivateIpAddress': 'string'
                            },
                        ],
                        'SecondaryPrivateIpAddressCount': 123,
                        'SubnetId': 'string'
                    },
                ],
                'Placement': {
                    'AvailabilityZone': 'string',
                    'GroupName': 'string',
                    'Tenancy': 'default'|'dedicated'|'host'
                },
                'RamdiskId': 'string',
                'SubnetId': 'string',
                'Monitoring': {
                    'Enabled': True|False
                }
            },
            'LaunchedAvailabilityZone': 'string',
            'ProductDescription': 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)',
            'SpotInstanceRequestId': 'string',
            'SpotPrice': 'string',
            'State': 'open'|'active'|'closed'|'cancelled'|'failed',
            'Status': {
                'Code': 'string',
                'Message': 'string',
                'UpdateTime': datetime(2015, 1, 1)
            },
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'Type': 'one-time'|'persistent',
            'ValidFrom': datetime(2015, 1, 1),
            'ValidUntil': datetime(2015, 1, 1),
            'InstanceInterruptionBehavior': 'stop'|'terminate'
        },
    ]
}

Response Structure

  • (dict) --

    Contains the output of RequestSpotInstances.

    • SpotInstanceRequests (list) --

      One or more Spot instance requests.

      • (dict) --

        Describes a Spot instance request.

        • ActualBlockHourlyPrice (string) --

          If you specified a duration and your Spot instance request was fulfilled, this is the fixed hourly price in effect for the Spot instance while it runs.

        • AvailabilityZoneGroup (string) --

          The Availability Zone group. If you specify the same Availability Zone group for all Spot instance requests, all Spot instances are launched in the same Availability Zone.

        • BlockDurationMinutes (integer) --

          The duration for the Spot instance, in minutes.

        • CreateTime (datetime) --

          The date and time when the Spot instance request was created, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z).

        • Fault (dict) --

          The fault codes for the Spot instance request, if any.

          • Code (string) --

            The reason code for the Spot instance state change.

          • Message (string) --

            The message for the Spot instance state change.

        • InstanceId (string) --

          The instance ID, if an instance has been launched to fulfill the Spot instance request.

        • LaunchGroup (string) --

          The instance launch group. Launch groups are Spot instances that launch together and terminate together.

        • LaunchSpecification (dict) --

          Additional information for launching instances.

          • UserData (string) --

            The user data to make available to the instances. If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.

          • SecurityGroups (list) --

            One or more security groups. When requesting instances in a VPC, you must specify the IDs of the security groups. When requesting instances in EC2-Classic, you can specify the names or the IDs of the security groups.

            • (dict) --

              Describes a security group.

              • GroupName (string) --

                The name of the security group.

              • GroupId (string) --

                The ID of the security group.

          • AddressingType (string) --

            Deprecated.

          • BlockDeviceMappings (list) --

            One or more block device mapping entries.

            Although you can specify encrypted EBS volumes in this block device mapping for your Spot Instances, these volumes are not encrypted.

            • (dict) --

              Describes a block device mapping.

              • DeviceName (string) --

                The device name exposed to the instance (for example, /dev/sdh or xvdh ).

              • VirtualName (string) --

                The virtual device name ( ephemeral N). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 .The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

                Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

              • Ebs (dict) --

                Parameters used to automatically set up EBS volumes when the instance is launched.

                • Encrypted (boolean) --

                  Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption.

                • DeleteOnTermination (boolean) --

                  Indicates whether the EBS volume is deleted on instance termination.

                • Iops (integer) --

                  The number of I/O operations per second (IOPS) that the volume supports. For io1 , this represents the number of IOPS that are provisioned for the volume. For gp2 , this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .

                  Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.

                  Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2 , st1 , sc1 , or standard volumes.

                • SnapshotId (string) --

                  The ID of the snapshot.

                • VolumeSize (integer) --

                  The size of the volume, in GiB.

                  Constraints: 1-16384 for General Purpose SSD ( gp2 ), 4-16384 for Provisioned IOPS SSD ( io1 ), 500-16384 for Throughput Optimized HDD ( st1 ), 500-16384 for Cold HDD ( sc1 ), and 1-1024 for Magnetic ( standard ) volumes. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

                  Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

                • VolumeType (string) --

                  The volume type: gp2 , io1 , st1 , sc1 , or standard .

                  Default: standard

              • NoDevice (string) --

                Suppresses the specified device included in the block device mapping of the AMI.

          • EbsOptimized (boolean) --

            Indicates whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

            Default: false

          • IamInstanceProfile (dict) --

            The IAM instance profile.

            • Arn (string) --

              The Amazon Resource Name (ARN) of the instance profile.

            • Name (string) --

              The name of the instance profile.

          • ImageId (string) --

            The ID of the AMI.

          • InstanceType (string) --

            The instance type.

          • KernelId (string) --

            The ID of the kernel.

          • KeyName (string) --

            The name of the key pair.

          • NetworkInterfaces (list) --

            One or more network interfaces. If you specify a network interface, you must specify subnet IDs and security group IDs using the network interface.

            • (dict) --

              Describes a network interface.

              • AssociatePublicIpAddress (boolean) --

                Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true .

              • DeleteOnTermination (boolean) --

                If set to true , the interface is deleted when the instance is terminated. You can specify true only if creating a new network interface when launching an instance.

              • Description (string) --

                The description of the network interface. Applies only if creating a network interface when launching an instance.

              • DeviceIndex (integer) --

                The index of the device on the instance for the network interface attachment. If you are specifying a network interface in a RunInstances request, you must provide the device index.

              • Groups (list) --

                The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

                • (string) --

              • Ipv6AddressCount (integer) --

                A number of IPv6 addresses to assign to the network interface. Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

              • Ipv6Addresses (list) --

                One or more IPv6 addresses to assign to the network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

                • (dict) --

                  Describes an IPv6 address.

                  • Ipv6Address (string) --

                    The IPv6 address.

              • NetworkInterfaceId (string) --

                The ID of the network interface.

              • PrivateIpAddress (string) --

                The private IPv4 address of the network interface. Applies only if creating a network interface when launching an instance. You cannot specify this option if you're launching more than one instance in a RunInstances request.

              • PrivateIpAddresses (list) --

                One or more private IPv4 addresses to assign to the network interface. Only one private IPv4 address can be designated as primary. You cannot specify this option if you're launching more than one instance in a RunInstances request.

                • (dict) --

                  Describes a secondary private IPv4 address for a network interface.

                  • Primary (boolean) --

                    Indicates whether the private IPv4 address is the primary private IPv4 address. Only one IPv4 address can be designated as primary.

                  • PrivateIpAddress (string) --

                    The private IPv4 addresses.

              • SecondaryPrivateIpAddressCount (integer) --

                The number of secondary private IPv4 addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option. You cannot specify this option if you're launching more than one instance in a RunInstances request.

              • SubnetId (string) --

                The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an instance.

          • Placement (dict) --

            The placement information for the instance.

            • AvailabilityZone (string) --

              The Availability Zone.

              [Spot fleet only] To specify multiple Availability Zones, separate them using commas; for example, "us-west-2a, us-west-2b".

            • GroupName (string) --

              The name of the placement group (for cluster instances).

            • Tenancy (string) --

              The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for Spot instances.

          • RamdiskId (string) --

            The ID of the RAM disk.

          • SubnetId (string) --

            The ID of the subnet in which to launch the instance.

          • Monitoring (dict) --

            Describes the monitoring of an instance.

            • Enabled (boolean) --

              Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.

        • LaunchedAvailabilityZone (string) --

          The Availability Zone in which the bid is launched.

        • ProductDescription (string) --

          The product description associated with the Spot instance.

        • SpotInstanceRequestId (string) --

          The ID of the Spot instance request.

        • SpotPrice (string) --

          The maximum hourly price (bid) for the Spot instance launched to fulfill the request.

        • State (string) --

          The state of the Spot instance request. Spot bid status information can help you track your Spot instance requests. For more information, see Spot Bid Status in the Amazon Elastic Compute Cloud User Guide .

        • Status (dict) --

          The status code and status message describing the Spot instance request.

          • Code (string) --

            The status code. For a list of status codes, see Spot Bid Status Codes in the Amazon Elastic Compute Cloud User Guide .

          • Message (string) --

            The description for the status code.

          • UpdateTime (datetime) --

            The date and time of the most recent status update, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z).

        • Tags (list) --

          Any tags assigned 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.

        • Type (string) --

          The Spot instance request type.

        • ValidFrom (datetime) --

          The start date of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). The request becomes active at this date and time.

        • ValidUntil (datetime) --

          The end date of the request, in UTC format (for example, YYYY -MM -DD T*HH* :MM :SS Z). If this is a one-time request, it remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date is reached.

        • InstanceInterruptionBehavior (string) --

          Indicates whether a Spot instance stops or terminates when it is interrupted.