Amazon Elastic Compute Cloud

2015/09/15 - Amazon Elastic Compute Cloud - 4 updated api methods

CreateSnapshot (updated) Link ¶
Changes (response)
{'DataEncryptionKeyId': 'string', 'StateMessage': 'string'}

Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.

When a snapshot is created, any AWS Marketplace product codes that are associated with the source volume are propagated to the snapshot.

You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your EBS volume at the time the snapshot command is issued; this may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is pending .

To create a snapshot for EBS volumes that serve as root devices, you should stop the instance before taking the snapshot.

Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected.

For more information, see Amazon Elastic Block Store and Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .

Request Syntax

client.create_snapshot(
    DryRun=True|False,
    VolumeId='string',
    Description='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 VolumeId

string

param VolumeId

[REQUIRED]

The ID of the EBS volume.

type Description

string

param Description

A description for the snapshot.

rtype

dict

returns

Response Syntax

{
    'SnapshotId': 'string',
    'VolumeId': 'string',
    'State': 'pending'|'completed'|'error',
    'StateMessage': 'string',
    'StartTime': datetime(2015, 1, 1),
    'Progress': 'string',
    'OwnerId': 'string',
    'Description': 'string',
    'VolumeSize': 123,
    'OwnerAlias': 'string',
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    'Encrypted': True|False,
    'KmsKeyId': 'string',
    'DataEncryptionKeyId': 'string'
}

Response Structure

  • (dict) --

    Information about the snapshot.

    • SnapshotId (string) --

      The ID of the snapshot. Each snapshot receives a unique identifier when it is created.

    • VolumeId (string) --

      The ID of the volume that was used to create the snapshot.

    • State (string) --

      The snapshot state.

    • StateMessage (string) --

      Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper AWS Key Management Service (AWS KMS) permissions are not obtained) this field displays error state details to help you diagnose why the error occurred. This parameter is only returned by the DescribeSnapshots API operation.

    • StartTime (datetime) --

      The time stamp when the snapshot was initiated.

    • Progress (string) --

      The progress of the snapshot, as a percentage.

    • OwnerId (string) --

      The AWS account ID of the EBS snapshot owner.

    • Description (string) --

      The description for the snapshot.

    • VolumeSize (integer) --

      The size of the volume, in GiB.

    • OwnerAlias (string) --

      The AWS account alias (for example, amazon , self ) or AWS account ID that owns the snapshot.

    • Tags (list) --

      Any tags assigned to the snapshot.

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

    • Encrypted (boolean) --

      Indicates whether the snapshot is encrypted.

    • KmsKeyId (string) --

      The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the parent volume.

    • DataEncryptionKeyId (string) --

      The data encryption key identifier for the snapshot. This value is a unique identifier that corresponds to the data encryption key that was used to encrypt the original volume or snapshot copy. Because data encryption keys are inherited by volumes created from snapshots, and vice versa, if snapshots share the same data encryption key identifier, then they belong to the same volume/snapshot lineage. This parameter is only returned by the DescribeSnapshots API operation.

DescribeSnapshots (updated) Link ¶
Changes (response)
{'Snapshots': {'DataEncryptionKeyId': 'string', 'StateMessage': 'string'}}

Describes one or more of the EBS snapshots available to you. Available snapshots include public snapshots available for any AWS account to launch, private snapshots that you own, and private snapshots owned by another AWS account but for which you've been given explicit create volume permissions.

The create volume permissions fall into the following categories:

  • public : The owner of the snapshot granted create volume permissions for the snapshot to the all group. All AWS accounts have create volume permissions for these snapshots.

  • explicit : The owner of the snapshot granted create volume permissions to a specific AWS account.

  • implicit : An AWS account has implicit create volume permissions for all snapshots it owns.

The list of snapshots returned can be modified by specifying snapshot IDs, snapshot owners, or AWS accounts with create volume permissions. If no options are specified, Amazon EC2 returns all snapshots for which you have create volume permissions.

If you specify one or more snapshot IDs, only snapshots that have the specified IDs are returned. If you specify an invalid snapshot ID, an error is returned. If you specify a snapshot ID for which you do not have access, it is not included in the returned results.

If you specify one or more snapshot owners, only snapshots from the specified owners and for which you have access are returned. The results can include the AWS account IDs of the specified owners, amazon for snapshots owned by Amazon, or self for snapshots that you own.

If you specify a list of restorable users, only snapshots with create snapshot permissions for those users are returned. You can specify AWS account IDs (if you own the snapshots), self for snapshots for which you own or have explicit permissions, or all for public snapshots.

If you are describing a long list of snapshots, you can paginate the output to make the list more manageable. The MaxResults parameter sets the maximum number of results returned in a single page. If the list of results exceeds your MaxResults value, then that number of results is returned along with a NextToken value that can be passed to a subsequent DescribeSnapshots request to retrieve the remaining results.

For more information about EBS snapshots, see Amazon EBS Snapshots in the Amazon Elastic Compute Cloud User Guide .

Request Syntax

client.describe_snapshots(
    DryRun=True|False,
    SnapshotIds=[
        'string',
    ],
    OwnerIds=[
        'string',
    ],
    RestorableByUserIds=[
        'string',
    ],
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    NextToken='string',
    MaxResults=123
)
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 SnapshotIds

list

param SnapshotIds

One or more snapshot IDs.

Default: Describes snapshots for which you have launch permissions.

  • (string) --

type OwnerIds

list

param OwnerIds

Returns the snapshots owned by the specified owner. Multiple owners can be specified.

  • (string) --

type RestorableByUserIds

list

param RestorableByUserIds

One or more AWS accounts IDs that can create volumes from the snapshot.

  • (string) --

type Filters

list

param Filters

One or more filters.

  • description - A description of the snapshot.

  • owner-alias - The AWS account alias (for example, amazon ) that owns the snapshot.

  • owner-id - The ID of the AWS account that owns the snapshot.

  • progress - The progress of the snapshot, as a percentage (for example, 80%).

  • snapshot-id - The snapshot ID.

  • start-time - The time stamp when the snapshot was initiated.

  • status - The status of the snapshot ( pending | completed | error ).

  • tag :key =*value* - The key/value combination of a tag assigned to the resource.

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

  • volume-id - The ID of the volume the snapshot is for.

  • volume-size - The size of the volume, in GiB.

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

string

param NextToken

The NextToken value returned from a previous paginated DescribeSnapshots request where MaxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the NextToken value. This value is null when there are no more results to return.

type MaxResults

integer

param MaxResults

The maximum number of snapshot results returned by DescribeSnapshots in paginated output. When this parameter is used, DescribeSnapshots only returns MaxResults results in a single page along with a NextToken response element. The remaining results of the initial request can be seen by sending another DescribeSnapshots request with the returned NextToken value. This value can be between 5 and 1000; if MaxResults is given a value larger than 1000, only 1000 results are returned. If this parameter is not used, then DescribeSnapshots returns all results. You cannot specify this parameter and the snapshot IDs parameter in the same request.

rtype

dict

returns

Response Syntax

{
    'Snapshots': [
        {
            'SnapshotId': 'string',
            'VolumeId': 'string',
            'State': 'pending'|'completed'|'error',
            'StateMessage': 'string',
            'StartTime': datetime(2015, 1, 1),
            'Progress': 'string',
            'OwnerId': 'string',
            'Description': 'string',
            'VolumeSize': 123,
            'OwnerAlias': 'string',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'Encrypted': True|False,
            'KmsKeyId': 'string',
            'DataEncryptionKeyId': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Snapshots (list) --

      Information about the snapshots.

      • (dict) --

        Describes a snapshot.

        • SnapshotId (string) --

          The ID of the snapshot. Each snapshot receives a unique identifier when it is created.

        • VolumeId (string) --

          The ID of the volume that was used to create the snapshot.

        • State (string) --

          The snapshot state.

        • StateMessage (string) --

          Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper AWS Key Management Service (AWS KMS) permissions are not obtained) this field displays error state details to help you diagnose why the error occurred. This parameter is only returned by the DescribeSnapshots API operation.

        • StartTime (datetime) --

          The time stamp when the snapshot was initiated.

        • Progress (string) --

          The progress of the snapshot, as a percentage.

        • OwnerId (string) --

          The AWS account ID of the EBS snapshot owner.

        • Description (string) --

          The description for the snapshot.

        • VolumeSize (integer) --

          The size of the volume, in GiB.

        • OwnerAlias (string) --

          The AWS account alias (for example, amazon , self ) or AWS account ID that owns the snapshot.

        • Tags (list) --

          Any tags assigned to the snapshot.

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

        • Encrypted (boolean) --

          Indicates whether the snapshot is encrypted.

        • KmsKeyId (string) --

          The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the parent volume.

        • DataEncryptionKeyId (string) --

          The data encryption key identifier for the snapshot. This value is a unique identifier that corresponds to the data encryption key that was used to encrypt the original volume or snapshot copy. Because data encryption keys are inherited by volumes created from snapshots, and vice versa, if snapshots share the same data encryption key identifier, then they belong to the same volume/snapshot lineage. This parameter is only returned by the DescribeSnapshots API operation.

    • NextToken (string) --

      The NextToken value to include in a future DescribeSnapshots request. When the results of a DescribeSnapshots request exceed MaxResults , this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

DescribeSpotFleetRequests (updated) Link ¶
Changes (response)
{'SpotFleetRequestConfigs': {'SpotFleetRequestConfig': {'AllocationStrategy': 'lowestPrice '
                                                                              '| '
                                                                              'diversified'}}}

Describes your Spot fleet requests.

Request Syntax

client.describe_spot_fleet_requests(
    DryRun=True|False,
    SpotFleetRequestIds=[
        'string',
    ],
    NextToken='string',
    MaxResults=123
)
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 SpotFleetRequestIds

list

param SpotFleetRequestIds

The IDs of the Spot fleet requests.

  • (string) --

type NextToken

string

param NextToken

The token for the next set of results.

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.

rtype

dict

returns

Response Syntax

{
    'SpotFleetRequestConfigs': [
        {
            'SpotFleetRequestId': 'string',
            'SpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating',
            'SpotFleetRequestConfig': {
                'ClientToken': 'string',
                'SpotPrice': 'string',
                'TargetCapacity': 123,
                'ValidFrom': datetime(2015, 1, 1),
                'ValidUntil': datetime(2015, 1, 1),
                'TerminateInstancesWithExpiration': True|False,
                'IamFleetRole': 'string',
                'LaunchSpecifications': [
                    {
                        'ImageId': 'string',
                        'KeyName': 'string',
                        'SecurityGroups': [
                            {
                                'GroupName': 'string',
                                'GroupId': 'string'
                            },
                        ],
                        'UserData': 'string',
                        'AddressingType': 'string',
                        'InstanceType': 't1.micro'|'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'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'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'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
                        'Placement': {
                            'AvailabilityZone': 'string',
                            'GroupName': 'string'
                        },
                        'KernelId': 'string',
                        'RamdiskId': 'string',
                        'BlockDeviceMappings': [
                            {
                                'VirtualName': 'string',
                                'DeviceName': 'string',
                                'Ebs': {
                                    'SnapshotId': 'string',
                                    'VolumeSize': 123,
                                    'DeleteOnTermination': True|False,
                                    'VolumeType': 'standard'|'io1'|'gp2',
                                    'Iops': 123,
                                    'Encrypted': True|False
                                },
                                'NoDevice': 'string'
                            },
                        ],
                        'Monitoring': {
                            'Enabled': True|False
                        },
                        'SubnetId': 'string',
                        'NetworkInterfaces': [
                            {
                                'NetworkInterfaceId': 'string',
                                'DeviceIndex': 123,
                                'SubnetId': 'string',
                                'Description': 'string',
                                'PrivateIpAddress': 'string',
                                'Groups': [
                                    'string',
                                ],
                                'DeleteOnTermination': True|False,
                                'PrivateIpAddresses': [
                                    {
                                        'PrivateIpAddress': 'string',
                                        'Primary': True|False
                                    },
                                ],
                                'SecondaryPrivateIpAddressCount': 123,
                                'AssociatePublicIpAddress': True|False
                            },
                        ],
                        'IamInstanceProfile': {
                            'Arn': 'string',
                            'Name': 'string'
                        },
                        'EbsOptimized': True|False,
                        'WeightedCapacity': 123.0,
                        'SpotPrice': 'string'
                    },
                ],
                'AllocationStrategy': 'lowestPrice'|'diversified'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    Contains the output of DescribeSpotFleetRequests.

    • SpotFleetRequestConfigs (list) --

      Information about the configuration of your Spot fleet.

      • (dict) --

        Describes a Spot fleet request.

        • SpotFleetRequestId (string) --

          The ID of the Spot fleet request.

        • SpotFleetRequestState (string) --

          The state of the Spot fleet request.

        • SpotFleetRequestConfig (dict) --

          Information about the configuration of the Spot fleet request.

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

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

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

          • TerminateInstancesWithExpiration (boolean) --

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

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

              • ImageId (string) --

                The ID of the AMI.

              • KeyName (string) --

                The name of the key pair.

              • SecurityGroups (list) --

                One or more security groups. To request an instance in a nondefault VPC, you must specify the ID of the security group. To request an instance in EC2-Classic or a default VPC, you can specify the name or the ID of the security group.

                • (dict) --

                  Describes a security group.

                  • GroupName (string) --

                    The name of the security group.

                  • GroupId (string) --

                    The ID of the security group.

              • UserData (string) --

                The Base64-encoded MIME user data to make available to the instances.

              • AddressingType (string) --

                Deprecated.

              • InstanceType (string) --

                The instance type.

              • Placement (dict) --

                The placement information.

                • AvailabilityZone (string) --

                  The Availability Zone.

                • GroupName (string) --

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

              • KernelId (string) --

                The ID of the kernel.

              • RamdiskId (string) --

                The ID of the RAM disk.

              • BlockDeviceMappings (list) --

                One or more block device mapping entries.

                • (dict) --

                  Describes a block device mapping.

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

                  • DeviceName (string) --

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

                  • Ebs (dict) --

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

                    • SnapshotId (string) --

                      The ID of the snapshot.

                    • VolumeSize (integer) --

                      The size of the volume, in GiB.

                      Constraints: 1-1024 for standard volumes, 1-16384 for gp2 volumes, and 4-16384 for io1 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.

                    • DeleteOnTermination (boolean) --

                      Indicates whether the EBS volume is deleted on instance termination.

                    • VolumeType (string) --

                      The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.

                      Default: standard

                    • Iops (integer) --

                      The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on 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 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

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

                    • Encrypted (boolean) --

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

                  • NoDevice (string) --

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

              • Monitoring (dict) --

                Enable or disable monitoring for the instances.

                • Enabled (boolean) --

                  Enables monitoring for the instance.

                  Default: false

              • SubnetId (string) --

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

              • NetworkInterfaces (list) --

                One or more network interfaces.

                • (dict) --

                  Describes a network interface.

                  • NetworkInterfaceId (string) --

                    The ID of the network interface.

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

                  • SubnetId (string) --

                    The ID of the subnet associated with the network string. Applies only if creating a 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.

                  • PrivateIpAddress (string) --

                    The private IP address of the network interface. Applies only if creating a network interface when launching an instance.

                  • Groups (list) --

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

                    • (string) --

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

                  • PrivateIpAddresses (list) --

                    One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.

                    • (dict) --

                      Describes a secondary private IP address for a network interface.

                      • PrivateIpAddress (string) --

                        The private IP addresses.

                      • Primary (boolean) --

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

                  • SecondaryPrivateIpAddressCount (integer) --

                    The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.

                  • AssociatePublicIpAddress (boolean) --

                    Indicates whether to assign a public IP 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 .

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

              • 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

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

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

          • AllocationStrategy (string) --

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

    • NextToken (string) --

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

RequestSpotFleet (updated) Link ¶
Changes (request)
{'SpotFleetRequestConfig': {'AllocationStrategy': 'lowestPrice | diversified'}}

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 .

Request Syntax

client.request_spot_fleet(
    DryRun=True|False,
    SpotFleetRequestConfig={
        'ClientToken': 'string',
        'SpotPrice': 'string',
        'TargetCapacity': 123,
        'ValidFrom': datetime(2015, 1, 1),
        'ValidUntil': datetime(2015, 1, 1),
        'TerminateInstancesWithExpiration': True|False,
        'IamFleetRole': 'string',
        'LaunchSpecifications': [
            {
                'ImageId': 'string',
                'KeyName': 'string',
                'SecurityGroups': [
                    {
                        'GroupName': 'string',
                        'GroupId': 'string'
                    },
                ],
                'UserData': 'string',
                'AddressingType': 'string',
                'InstanceType': 't1.micro'|'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'|'t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'m2.xlarge'|'m2.2xlarge'|'m2.4xlarge'|'cr1.8xlarge'|'i2.xlarge'|'i2.2xlarge'|'i2.4xlarge'|'i2.8xlarge'|'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'|'cg1.4xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'d2.xlarge'|'d2.2xlarge'|'d2.4xlarge'|'d2.8xlarge',
                'Placement': {
                    'AvailabilityZone': 'string',
                    'GroupName': 'string'
                },
                'KernelId': 'string',
                'RamdiskId': 'string',
                'BlockDeviceMappings': [
                    {
                        'VirtualName': 'string',
                        'DeviceName': 'string',
                        'Ebs': {
                            'SnapshotId': 'string',
                            'VolumeSize': 123,
                            'DeleteOnTermination': True|False,
                            'VolumeType': 'standard'|'io1'|'gp2',
                            'Iops': 123,
                            'Encrypted': True|False
                        },
                        'NoDevice': 'string'
                    },
                ],
                'Monitoring': {
                    'Enabled': True|False
                },
                'SubnetId': 'string',
                'NetworkInterfaces': [
                    {
                        'NetworkInterfaceId': 'string',
                        'DeviceIndex': 123,
                        'SubnetId': 'string',
                        'Description': 'string',
                        'PrivateIpAddress': 'string',
                        'Groups': [
                            'string',
                        ],
                        'DeleteOnTermination': True|False,
                        'PrivateIpAddresses': [
                            {
                                'PrivateIpAddress': 'string',
                                'Primary': True|False
                            },
                        ],
                        'SecondaryPrivateIpAddressCount': 123,
                        'AssociatePublicIpAddress': True|False
                    },
                ],
                'IamInstanceProfile': {
                    'Arn': 'string',
                    'Name': 'string'
                },
                'EbsOptimized': True|False,
                'WeightedCapacity': 123.0,
                'SpotPrice': 'string'
            },
        ],
        'AllocationStrategy': 'lowestPrice'|'diversified'
    }
)
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.

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

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

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

  • TerminateInstancesWithExpiration (boolean) --

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

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

      • ImageId (string) --

        The ID of the AMI.

      • KeyName (string) --

        The name of the key pair.

      • SecurityGroups (list) --

        One or more security groups. To request an instance in a nondefault VPC, you must specify the ID of the security group. To request an instance in EC2-Classic or a default VPC, you can specify the name or the ID of the security group.

        • (dict) --

          Describes a security group.

          • GroupName (string) --

            The name of the security group.

          • GroupId (string) --

            The ID of the security group.

      • UserData (string) --

        The Base64-encoded MIME user data to make available to the instances.

      • AddressingType (string) --

        Deprecated.

      • InstanceType (string) --

        The instance type.

      • Placement (dict) --

        The placement information.

        • AvailabilityZone (string) --

          The Availability Zone.

        • GroupName (string) --

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

      • KernelId (string) --

        The ID of the kernel.

      • RamdiskId (string) --

        The ID of the RAM disk.

      • BlockDeviceMappings (list) --

        One or more block device mapping entries.

        • (dict) --

          Describes a block device mapping.

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

          • DeviceName (string) --

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

          • Ebs (dict) --

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

            • SnapshotId (string) --

              The ID of the snapshot.

            • VolumeSize (integer) --

              The size of the volume, in GiB.

              Constraints: 1-1024 for standard volumes, 1-16384 for gp2 volumes, and 4-16384 for io1 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.

            • DeleteOnTermination (boolean) --

              Indicates whether the EBS volume is deleted on instance termination.

            • VolumeType (string) --

              The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.

              Default: standard

            • Iops (integer) --

              The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on 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 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.

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

            • Encrypted (boolean) --

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

          • NoDevice (string) --

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

      • Monitoring (dict) --

        Enable or disable monitoring for the instances.

        • Enabled (boolean) --

          Enables monitoring for the instance.

          Default: false

      • SubnetId (string) --

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

      • NetworkInterfaces (list) --

        One or more network interfaces.

        • (dict) --

          Describes a network interface.

          • NetworkInterfaceId (string) --

            The ID of the network interface.

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

          • SubnetId (string) --

            The ID of the subnet associated with the network string. Applies only if creating a 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.

          • PrivateIpAddress (string) --

            The private IP address of the network interface. Applies only if creating a network interface when launching an instance.

          • Groups (list) --

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

            • (string) --

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

          • PrivateIpAddresses (list) --

            One or more private IP addresses to assign to the network interface. Only one private IP address can be designated as primary.

            • (dict) --

              Describes a secondary private IP address for a network interface.

              • PrivateIpAddress (string) -- [REQUIRED]

                The private IP addresses.

              • Primary (boolean) --

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

          • SecondaryPrivateIpAddressCount (integer) --

            The number of secondary private IP addresses. You can't specify this option and specify more than one private IP address using the private IP addresses option.

          • AssociatePublicIpAddress (boolean) --

            Indicates whether to assign a public IP 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 .

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

      • 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

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

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

  • AllocationStrategy (string) --

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

rtype

dict

returns

Response Syntax

{
    'SpotFleetRequestId': 'string'
}

Response Structure

  • (dict) --

    Contains the output of RequestSpotFleet.

    • SpotFleetRequestId (string) --

      The ID of the Spot fleet request.