2020/02/14 - Amazon Elastic Compute Cloud - 3 updated api methods
Changes Update ec2 client to latest version
{'MultiAttachEnabled': 'boolean'}
Creates an EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the regional endpoint that you send the HTTP request to. For more information see Regions and Endpoints.
You can create a new empty volume or restore a volume from an EBS snapshot. Any AWS Marketplace product codes from the snapshot are propagated to the volume.
You can create encrypted volumes. Encrypted volumes must be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.
You can tag your volumes during creation. For more information, see Tagging Your Amazon EC2 Resources in the Amazon Elastic Compute Cloud User Guide.
For more information, see Creating an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide.
See also: AWS API Documentation
Request Syntax
client.create_volume( AvailabilityZone='string', Encrypted=True|False, Iops=123, KmsKeyId='string', OutpostArn='string', Size=123, SnapshotId='string', VolumeType='standard'|'io1'|'gp2'|'sc1'|'st1', DryRun=True|False, TagSpecifications=[ { 'ResourceType': 'client-vpn-endpoint'|'customer-gateway'|'dedicated-host'|'dhcp-options'|'elastic-ip'|'fleet'|'fpga-image'|'host-reservation'|'image'|'instance'|'internet-gateway'|'key-pair'|'launch-template'|'natgateway'|'network-acl'|'network-interface'|'placement-group'|'reserved-instances'|'route-table'|'security-group'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-multicast-domain'|'transit-gateway-route-table'|'volume'|'vpc'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], MultiAttachEnabled=True|False )
string
[REQUIRED]
The Availability Zone in which to create the volume.
boolean
Specifies whether the volume should be encrypted. The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by Default in the Amazon Elastic Compute Cloud User Guide.
Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types.
integer
The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB. Range is 100 to 64,000 IOPS for volumes in most Regions. Maximum IOPS of 64,000 is guaranteed only on Nitro-based instances. Other instance families guarantee performance up to 32,000 IOPS. For more information, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide.
This parameter is valid only for Provisioned IOPS SSD (io1) volumes.
string
The identifier of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use for Amazon EBS encryption. If this parameter is not specified, your AWS managed CMK for EBS is used. If KmsKeyId is specified, the encrypted state must be true.
You can specify the CMK using any of the following:
Key ID. For example, key/1234abcd-12ab-34cd-56ef-1234567890ab.
Key alias. For example, alias/ExampleAlias.
Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef.
Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.
AWS authenticates the CMK asynchronously. Therefore, if you specify an ID, alias, or ARN that is not valid, the action can appear to complete, but eventually fails.
string
The Amazon Resource Name (ARN) of the Outpost.
integer
The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size.
Constraints: 1-16,384 for gp2, 4-16,384 for io1, 500-16,384 for st1, 500-16,384 for sc1, and 1-1,024 for standard. 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.
string
The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size.
string
The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.
Default: gp2
boolean
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.
list
The tags to apply to the volume during creation.
(dict) --
The tags to apply to a resource when the resource is being created.
ResourceType (string) --
The type of resource to tag. Currently, the resource types that support tagging on creation are: capacity-reservation | client-vpn-endpoint | dedicated-host | fleet | fpga-image | instance | key-pair | launch-template | placement-group | snapshot | traffic-mirror-filter | traffic-mirror-session | traffic-mirror-target | transit-gateway | transit-gateway-attachment | transit-gateway-route-table | volume.
To tag a resource after it has been created, see CreateTags.
Tags (list) --
The tags to apply to the resource.
(dict) --
Describes a tag.
Key (string) --
The key of the tag.
Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.
Value (string) --
The value of the tag.
Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.
boolean
Specifies whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 Nitro-based instances in the same Availability Zone. For more information, see Amazon EBS Multi-Attach in the Amazon Elastic Compute Cloud User Guide.
dict
Response Syntax
{ 'Attachments': [ { 'AttachTime': datetime(2015, 1, 1), 'Device': 'string', 'InstanceId': 'string', 'State': 'attaching'|'attached'|'detaching'|'detached'|'busy', 'VolumeId': 'string', 'DeleteOnTermination': True|False }, ], 'AvailabilityZone': 'string', 'CreateTime': datetime(2015, 1, 1), 'Encrypted': True|False, 'KmsKeyId': 'string', 'OutpostArn': 'string', 'Size': 123, 'SnapshotId': 'string', 'State': 'creating'|'available'|'in-use'|'deleting'|'deleted'|'error', 'VolumeId': 'string', 'Iops': 123, 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ], 'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1', 'FastRestored': True|False, 'MultiAttachEnabled': True|False }
Response Structure
(dict) --
Describes a volume.
Attachments (list) --
Information about the volume attachments.
(dict) --
Describes volume attachment details.
AttachTime (datetime) --
The time stamp when the attachment initiated.
Device (string) --
The device name.
InstanceId (string) --
The ID of the instance.
State (string) --
The attachment state of the volume.
VolumeId (string) --
The ID of the volume.
DeleteOnTermination (boolean) --
Indicates whether the EBS volume is deleted on instance termination.
AvailabilityZone (string) --
The Availability Zone for the volume.
CreateTime (datetime) --
The time stamp when volume creation was initiated.
Encrypted (boolean) --
Indicates whether the volume is encrypted.
KmsKeyId (string) --
The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the volume.
OutpostArn (string) --
The Amazon Resource Name (ARN) of the Outpost.
Size (integer) --
The size of the volume, in GiBs.
SnapshotId (string) --
The snapshot from which the volume was created, if applicable.
State (string) --
The volume state.
VolumeId (string) --
The ID of the volume.
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, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide.
Constraints: Range is 100-16,000 IOPS for gp2 volumes and 100 to 64,000IOPS for io1 volumes, in most Regions. The maximum IOPS for io1 of 64,000 is guaranteed only on Nitro-based instances. Other instance families guarantee performance up to 32,000 IOPS.
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.
Tags (list) --
Any tags assigned to the volume.
(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.
VolumeType (string) --
The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.
FastRestored (boolean) --
Indicates whether the volume was created using fast snapshot restore.
MultiAttachEnabled (boolean) --
Indicates whether Amazon EBS Multi-Attach is enabled.
{'VolumeStatuses': {'AttachmentStatuses': [{'InstanceId': 'string', 'IoPerformance': 'string'}], 'Events': {'InstanceId': 'string'}}}
Describes the status of the specified volumes. Volume status provides the result of the checks performed on your volumes to determine events that can impair the performance of your volumes. The performance of a volume can be affected if an issue occurs on the volume's underlying host. If the volume's underlying host experiences a power outage or system issue, after the system is restored, there could be data inconsistencies on the volume. Volume events notify you if this occurs. Volume actions notify you if any action needs to be taken in response to the event.
The DescribeVolumeStatus operation provides the following information about the specified volumes:
Status: Reflects the current status of the volume. The possible values are ok, impaired , warning, or insufficient-data. If all checks pass, the overall status of the volume is ok. If the check fails, the overall status is impaired. If the status is insufficient-data, then the checks may still be taking place on your volume at the time. We recommend that you retry the request. For more information about volume status, see Monitoring the Status of Your Volumes in the Amazon Elastic Compute Cloud User Guide.
Events: Reflect the cause of a volume status and may require you to take action. For example, if your volume returns an impaired status, then the volume event might be potential-data-inconsistency. This means that your volume has been affected by an issue with the underlying host, has all I/O operations disabled, and may have inconsistent data.
Actions: Reflect the actions you may have to take in response to an event. For example, if the status of the volume is impaired and the volume event shows potential-data-inconsistency, then the action shows enable-volume-io. This means that you may want to enable the I/O operations for the volume by calling the EnableVolumeIO action and then check the volume for data consistency.
Volume status is based on the volume status checks, and does not reflect the volume state. Therefore, volume status does not indicate volumes in the error state (for example, when a volume is incapable of accepting I/O.)
See also: AWS API Documentation
Request Syntax
client.describe_volume_status( Filters=[ { 'Name': 'string', 'Values': [ 'string', ] }, ], MaxResults=123, NextToken='string', VolumeIds=[ 'string', ], DryRun=True|False )
list
The filters.
action.code - The action code for the event (for example, enable-volume-io).
action.description - A description of the action.
action.event-id - The event ID associated with the action.
availability-zone - The Availability Zone of the instance.
event.description - A description of the event.
event.event-id - The event ID.
event.event-type - The event type (for io-enabled: passed | failed; for io-performance: io-performance:degraded | io-performance:severely-degraded | io-performance:stalled).
event.not-after - The latest end time for the event.
event.not-before - The earliest start time for the event.
volume-status.details-name - The cause for volume-status.status ( io-enabled | io-performance).
volume-status.details-status - The status of volume-status.details-name (for io-enabled: passed | failed; for io-performance: normal | degraded | severely-degraded | stalled).
volume-status.status - The status of the volume ( ok | impaired | warning | insufficient-data).
(dict) --
A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs. The filters supported by a describe operation are documented with the describe operation. For example:
DescribeAvailabilityZones
DescribeImages
DescribeInstances
DescribeKeyPairs
DescribeSecurityGroups
DescribeSnapshots
DescribeSubnets
DescribeTags
DescribeVolumes
DescribeVpcs
Name (string) --
The name of the filter. Filter names are case-sensitive.
Values (list) --
The filter values. Filter values are case-sensitive.
(string) --
integer
The maximum number of volume results returned by DescribeVolumeStatus in paginated output. When this parameter is used, the request 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 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 DescribeVolumeStatus returns all results. You cannot specify this parameter and the volume IDs parameter in the same request.
string
The NextToken value to include in a future DescribeVolumeStatus request. When the results of the 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.
list
The IDs of the volumes.
Default: Describes all your volumes.
(string) --
boolean
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.
dict
Response Syntax
{ 'NextToken': 'string', 'VolumeStatuses': [ { 'Actions': [ { 'Code': 'string', 'Description': 'string', 'EventId': 'string', 'EventType': 'string' }, ], 'AvailabilityZone': 'string', 'OutpostArn': 'string', 'Events': [ { 'Description': 'string', 'EventId': 'string', 'EventType': 'string', 'NotAfter': datetime(2015, 1, 1), 'NotBefore': datetime(2015, 1, 1), 'InstanceId': 'string' }, ], 'VolumeId': 'string', 'VolumeStatus': { 'Details': [ { 'Name': 'io-enabled'|'io-performance', 'Status': 'string' }, ], 'Status': 'ok'|'impaired'|'insufficient-data' }, 'AttachmentStatuses': [ { 'IoPerformance': 'string', 'InstanceId': 'string' }, ] }, ] }
Response Structure
(dict) --
NextToken (string) --
The token to use to retrieve the next page of results. This value is null when there are no more results to return.
VolumeStatuses (list) --
Information about the status of the volumes.
(dict) --
Describes the volume status.
Actions (list) --
The details of the operation.
(dict) --
Describes a volume status operation code.
Code (string) --
The code identifying the operation, for example, enable-volume-io.
Description (string) --
A description of the operation.
EventId (string) --
The ID of the event associated with this operation.
EventType (string) --
The event type associated with this operation.
AvailabilityZone (string) --
The Availability Zone of the volume.
OutpostArn (string) --
The Amazon Resource Name (ARN) of the Outpost.
Events (list) --
A list of events associated with the volume.
(dict) --
Describes a volume status event.
Description (string) --
A description of the event.
EventId (string) --
The ID of this event.
EventType (string) --
The type of this event.
NotAfter (datetime) --
The latest end time of the event.
NotBefore (datetime) --
The earliest start time of the event.
InstanceId (string) --
The ID of the instance associated with the event.
VolumeId (string) --
The volume ID.
VolumeStatus (dict) --
The volume status.
Details (list) --
The details of the volume status.
(dict) --
Describes a volume status.
Name (string) --
The name of the volume status.
Status (string) --
The intended status of the volume status.
Status (string) --
The status of the volume.
AttachmentStatuses (list) --
Information about the instances to which the volume is attached.
(dict) --
Information about the instances to which the volume is attached.
IoPerformance (string) --
The maximum IOPS supported by the attached instance.
InstanceId (string) --
The ID of the attached instance.
{'Volumes': {'MultiAttachEnabled': 'boolean'}}
Describes the specified EBS volumes or all of your EBS volumes.
If you are describing a long list of volumes, 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 DescribeVolumes request to retrieve the remaining results.
For more information about EBS volumes, see Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide.
See also: AWS API Documentation
Request Syntax
client.describe_volumes( Filters=[ { 'Name': 'string', 'Values': [ 'string', ] }, ], VolumeIds=[ 'string', ], DryRun=True|False, MaxResults=123, NextToken='string' )
list
The filters.
attachment.attach-time - The time stamp when the attachment initiated.
attachment.delete-on-termination - Whether the volume is deleted on instance termination.
attachment.device - The device name specified in the block device mapping (for example, /dev/sda1).
attachment.instance-id - The ID of the instance the volume is attached to.
attachment.status - The attachment state ( attaching | attached | detaching).
availability-zone - The Availability Zone in which the volume was created.
create-time - The time stamp when the volume was created.
encrypted - Indicates whether the volume is encrypted ( true | false)
multi-attach-enabled - Indicates whether the volume is enabled for Multi-Attach ( true | false)
fast-restored - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore ( true | false).
size - The size of the volume, in GiB.
snapshot-id - The snapshot from which the volume was created.
status - The status of the volume ( creating | available | in-use | deleting | deleted | error).
tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.
tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
volume-id - The volume ID.
volume-type - The Amazon EBS volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.
(dict) --
A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs. The filters supported by a describe operation are documented with the describe operation. For example:
DescribeAvailabilityZones
DescribeImages
DescribeInstances
DescribeKeyPairs
DescribeSecurityGroups
DescribeSnapshots
DescribeSubnets
DescribeTags
DescribeVolumes
DescribeVpcs
Name (string) --
The name of the filter. Filter names are case-sensitive.
Values (list) --
The filter values. Filter values are case-sensitive.
(string) --
list
The volume IDs.
(string) --
boolean
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.
integer
The maximum number of volume results returned by DescribeVolumes in paginated output. When this parameter is used, DescribeVolumes 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 DescribeVolumes request with the returned NextToken value. This value can be between 5 and 500; if MaxResults is given a value larger than 500, only 500 results are returned. If this parameter is not used, then DescribeVolumes returns all results. You cannot specify this parameter and the volume IDs parameter in the same request.
string
The NextToken value returned from a previous paginated DescribeVolumes 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.
dict
Response Syntax
{ 'Volumes': [ { 'Attachments': [ { 'AttachTime': datetime(2015, 1, 1), 'Device': 'string', 'InstanceId': 'string', 'State': 'attaching'|'attached'|'detaching'|'detached'|'busy', 'VolumeId': 'string', 'DeleteOnTermination': True|False }, ], 'AvailabilityZone': 'string', 'CreateTime': datetime(2015, 1, 1), 'Encrypted': True|False, 'KmsKeyId': 'string', 'OutpostArn': 'string', 'Size': 123, 'SnapshotId': 'string', 'State': 'creating'|'available'|'in-use'|'deleting'|'deleted'|'error', 'VolumeId': 'string', 'Iops': 123, 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ], 'VolumeType': 'standard'|'io1'|'gp2'|'sc1'|'st1', 'FastRestored': True|False, 'MultiAttachEnabled': True|False }, ], 'NextToken': 'string' }
Response Structure
(dict) --
Volumes (list) --
Information about the volumes.
(dict) --
Describes a volume.
Attachments (list) --
Information about the volume attachments.
(dict) --
Describes volume attachment details.
AttachTime (datetime) --
The time stamp when the attachment initiated.
Device (string) --
The device name.
InstanceId (string) --
The ID of the instance.
State (string) --
The attachment state of the volume.
VolumeId (string) --
The ID of the volume.
DeleteOnTermination (boolean) --
Indicates whether the EBS volume is deleted on instance termination.
AvailabilityZone (string) --
The Availability Zone for the volume.
CreateTime (datetime) --
The time stamp when volume creation was initiated.
Encrypted (boolean) --
Indicates whether the volume is encrypted.
KmsKeyId (string) --
The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the volume.
OutpostArn (string) --
The Amazon Resource Name (ARN) of the Outpost.
Size (integer) --
The size of the volume, in GiBs.
SnapshotId (string) --
The snapshot from which the volume was created, if applicable.
State (string) --
The volume state.
VolumeId (string) --
The ID of the volume.
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, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide.
Constraints: Range is 100-16,000 IOPS for gp2 volumes and 100 to 64,000IOPS for io1 volumes, in most Regions. The maximum IOPS for io1 of 64,000 is guaranteed only on Nitro-based instances. Other instance families guarantee performance up to 32,000 IOPS.
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.
Tags (list) --
Any tags assigned to the volume.
(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.
VolumeType (string) --
The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.
FastRestored (boolean) --
Indicates whether the volume was created using fast snapshot restore.
MultiAttachEnabled (boolean) --
Indicates whether Amazon EBS Multi-Attach is enabled.
NextToken (string) --
The NextToken value to include in a future DescribeVolumes request. When the results of a DescribeVolumes 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.