2024/01/11 - Amazon Elastic Compute Cloud - 7 updated api methods
Changes This release adds support for adding an ElasticBlockStorage volume configurations in ECS RunTask/StartTask/CreateService/UpdateService APIs. The configuration allows for attaching EBS volumes to ECS Tasks.
{'AssociatedResource': 'string', 'InstanceOwningService': 'string'}
Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.
Encrypted EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Amazon EBS encryption in the Amazon Elastic Compute Cloud User Guide.
After you attach an EBS volume, you must make it available. For more information, see Make an EBS volume available for use.
If a volume has an Amazon Web Services Marketplace product code:
The volume can be attached only to a stopped instance.
Amazon Web Services Marketplace product codes are copied from the volume to the instance.
You must be subscribed to the product.
The instance type and operating system of the instance must support the product. For example, you can't detach a volume from a Windows instance and attach it to a Linux instance.
For more information, see Attach an Amazon EBS volume to an instance in the Amazon Elastic Compute Cloud User Guide.
See also: AWS API Documentation
Request Syntax
client.attach_volume( Device='string', InstanceId='string', VolumeId='string', DryRun=True|False )
string
[REQUIRED]
The device name (for example, /dev/sdh or xvdh).
string
[REQUIRED]
The ID of the instance.
string
[REQUIRED]
The ID of the EBS volume. The volume and instance must be within the same Availability Zone.
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
{ 'AttachTime': datetime(2015, 1, 1), 'Device': 'string', 'InstanceId': 'string', 'State': 'attaching'|'attached'|'detaching'|'detached'|'busy', 'VolumeId': 'string', 'DeleteOnTermination': True|False, 'AssociatedResource': 'string', 'InstanceOwningService': 'string' }
Response Structure
(dict) --
Describes volume attachment details.
AttachTime (datetime) --
The time stamp when the attachment initiated.
Device (string) --
The device name.
If the volume is attached to a Fargate task, this parameter returns null.
InstanceId (string) --
The ID of the instance.
If the volume is attached to a Fargate task, this parameter returns null.
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.
AssociatedResource (string) --
The ARN of the Amazon ECS or Fargate task to which the volume is attached.
InstanceOwningService (string) --
The service principal of Amazon Web Services service that owns the underlying instance to which the volume is attached.
This parameter is returned only for volumes that are attached to Fargate tasks.
{'Attachments': {'AssociatedResource': 'string', 'InstanceOwningService': 'string'}}
Creates an EBS volume that can be attached to an instance in the same Availability Zone.
You can create a new empty volume or restore a volume from an EBS snapshot. Any Amazon Web Services 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 Tag your Amazon EC2 resources in the Amazon Elastic Compute Cloud User Guide.
For more information, see Create 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'|'io2'|'gp2'|'sc1'|'st1'|'gp3', DryRun=True|False, TagSpecifications=[ { 'ResourceType': 'capacity-reservation'|'client-vpn-endpoint'|'customer-gateway'|'carrier-gateway'|'coip-pool'|'dedicated-host'|'dhcp-options'|'egress-only-internet-gateway'|'elastic-ip'|'elastic-gpu'|'export-image-task'|'export-instance-task'|'fleet'|'fpga-image'|'host-reservation'|'image'|'import-image-task'|'import-snapshot-task'|'instance'|'instance-event-window'|'internet-gateway'|'ipam'|'ipam-pool'|'ipam-scope'|'ipv4pool-ec2'|'ipv6pool-ec2'|'key-pair'|'launch-template'|'local-gateway'|'local-gateway-route-table'|'local-gateway-virtual-interface'|'local-gateway-virtual-interface-group'|'local-gateway-route-table-vpc-association'|'local-gateway-route-table-virtual-interface-group-association'|'natgateway'|'network-acl'|'network-interface'|'network-insights-analysis'|'network-insights-path'|'network-insights-access-scope'|'network-insights-access-scope-analysis'|'placement-group'|'prefix-list'|'replace-root-volume-task'|'reserved-instances'|'route-table'|'security-group'|'security-group-rule'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'subnet-cidr-reservation'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-connect-peer'|'transit-gateway-multicast-domain'|'transit-gateway-policy-table'|'transit-gateway-route-table'|'transit-gateway-route-table-announcement'|'volume'|'vpc'|'vpc-endpoint'|'vpc-endpoint-connection'|'vpc-endpoint-service'|'vpc-endpoint-service-permission'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log'|'capacity-reservation-fleet'|'traffic-mirror-filter-rule'|'vpc-endpoint-connection-device-type'|'verified-access-instance'|'verified-access-group'|'verified-access-endpoint'|'verified-access-policy'|'verified-access-trust-provider'|'vpn-connection-device-type'|'vpc-block-public-access-exclusion'|'ipam-resource-discovery'|'ipam-resource-discovery-association'|'instance-connect-endpoint', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], MultiAttachEnabled=True|False, Throughput=123, ClientToken='string' )
string
[REQUIRED]
The ID of the Availability Zone in which to create the volume. For example, us-east-1a.
boolean
Indicates 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). For gp3, io1, and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
The following are the supported values for each volume type:
gp3: 3,000 - 16,000 IOPS
io1: 100 - 64,000 IOPS
io2: 100 - 256,000 IOPS
For io2 volumes, you can achieve up to 256,000 IOPS on instances built on the Nitro System. On other instances, you can achieve performance up to 32,000 IOPS.
This parameter is required for io1 and io2 volumes. The default for gp3 volumes is 3,000 IOPS. This parameter is not supported for gp2, st1, sc1, or standard volumes.
string
The identifier of the Key Management Service (KMS) KMS key to use for Amazon EBS encryption. If this parameter is not specified, your KMS key for Amazon EBS is used. If KmsKeyId is specified, the encrypted state must be true.
You can specify the KMS key using any of the following:
Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.
Key alias. For example, alias/ExampleAlias.
Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/1234abcd-12ab-34cd-56ef-1234567890ab.
Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.
Amazon Web Services authenticates the KMS key 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. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.
The following are the supported volumes sizes for each volume type:
gp2 and gp3: 1 - 16,384 GiB
io1: 4 - 16,384 GiB
io2: 4 - 65,536 GiB
st1 and sc1: 125 - 16,384 GiB
standard: 1 - 1024 GiB
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 parameter can be one of the following values:
General Purpose SSD: gp2 | gp3
Provisioned IOPS SSD: io1 | io2
Throughput Optimized HDD: st1
Cold HDD: sc1
Magnetic: standard
For more information, see Amazon EBS volume types in the Amazon Elastic Compute Cloud User Guide.
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. When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.
ResourceType (string) --
The type of resource to tag on creation.
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 256 Unicode characters.
boolean
Indicates whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 Instances built on the Nitro System in the same Availability Zone. This parameter is supported with io1 and io2 volumes only. For more information, see Amazon EBS Multi-Attach in the Amazon Elastic Compute Cloud User Guide.
integer
The throughput to provision for a volume, with a maximum of 1,000 MiB/s.
This parameter is valid only for gp3 volumes.
Valid Range: Minimum value of 125. Maximum value of 1000.
string
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.
This field is autopopulated if not provided.
dict
Response Syntax
{ 'Attachments': [ { 'AttachTime': datetime(2015, 1, 1), 'Device': 'string', 'InstanceId': 'string', 'State': 'attaching'|'attached'|'detaching'|'detached'|'busy', 'VolumeId': 'string', 'DeleteOnTermination': True|False, 'AssociatedResource': 'string', 'InstanceOwningService': 'string' }, ], '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'|'io2'|'gp2'|'sc1'|'st1'|'gp3', 'FastRestored': True|False, 'MultiAttachEnabled': True|False, 'Throughput': 123, 'SseType': 'sse-ebs'|'sse-kms'|'none' }
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.
If the volume is attached to a Fargate task, this parameter returns null.
InstanceId (string) --
The ID of the instance.
If the volume is attached to a Fargate task, this parameter returns null.
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.
AssociatedResource (string) --
The ARN of the Amazon ECS or Fargate task to which the volume is attached.
InstanceOwningService (string) --
The service principal of Amazon Web Services service that owns the underlying instance to which the volume is attached.
This parameter is returned only for volumes that are attached to Fargate tasks.
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 Key Management Service (KMS) KMS key 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). For gp3, io1, and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
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 256 Unicode characters.
VolumeType (string) --
The volume type.
FastRestored (boolean) --
Indicates whether the volume was created using fast snapshot restore.
MultiAttachEnabled (boolean) --
Indicates whether Amazon EBS Multi-Attach is enabled.
Throughput (integer) --
The throughput that the volume supports, in MiB/s.
SseType (string) --
Reserved for future use.
{'BlockDeviceMappings': {'Ebs': {'AssociatedResource': 'string', 'VolumeOwnerId': 'string'}}}
Describes the specified attribute of the specified instance. You can specify only one attribute at a time. Valid attribute values are: instanceType | kernel | ramdisk | userData | disableApiTermination | instanceInitiatedShutdownBehavior | rootDeviceName | blockDeviceMapping | productCodes | sourceDestCheck | groupSet | ebsOptimized | sriovNetSupport
See also: AWS API Documentation
Request Syntax
client.describe_instance_attribute( Attribute='instanceType'|'kernel'|'ramdisk'|'userData'|'disableApiTermination'|'instanceInitiatedShutdownBehavior'|'rootDeviceName'|'blockDeviceMapping'|'productCodes'|'sourceDestCheck'|'groupSet'|'ebsOptimized'|'sriovNetSupport'|'enaSupport'|'enclaveOptions'|'disableApiStop', DryRun=True|False, InstanceId='string' )
string
[REQUIRED]
The instance attribute.
Note: The enaSupport attribute is not supported at this time.
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.
string
[REQUIRED]
The ID of the instance.
dict
Response Syntax
{ 'Groups': [ { 'GroupName': 'string', 'GroupId': 'string' }, ], 'BlockDeviceMappings': [ { 'DeviceName': 'string', 'Ebs': { 'AttachTime': datetime(2015, 1, 1), 'DeleteOnTermination': True|False, 'Status': 'attaching'|'attached'|'detaching'|'detached', 'VolumeId': 'string', 'AssociatedResource': 'string', 'VolumeOwnerId': 'string' } }, ], 'DisableApiTermination': { 'Value': True|False }, 'EnaSupport': { 'Value': True|False }, 'EnclaveOptions': { 'Enabled': True|False }, 'EbsOptimized': { 'Value': True|False }, 'InstanceId': 'string', 'InstanceInitiatedShutdownBehavior': { 'Value': 'string' }, 'InstanceType': { 'Value': 'string' }, 'KernelId': { 'Value': 'string' }, 'ProductCodes': [ { 'ProductCodeId': 'string', 'ProductCodeType': 'devpay'|'marketplace' }, ], 'RamdiskId': { 'Value': 'string' }, 'RootDeviceName': { 'Value': 'string' }, 'SourceDestCheck': { 'Value': True|False }, 'SriovNetSupport': { 'Value': 'string' }, 'UserData': { 'Value': 'string' }, 'DisableApiStop': { 'Value': True|False } }
Response Structure
(dict) --
Describes an instance attribute.
Groups (list) --
The security groups associated with the instance.
(dict) --
Describes a security group.
GroupName (string) --
The name of the security group.
GroupId (string) --
The ID of the security group.
BlockDeviceMappings (list) --
The block device mapping of the instance.
(dict) --
Describes a block device mapping.
DeviceName (string) --
The device name (for example, /dev/sdh or xvdh).
Ebs (dict) --
Parameters used to automatically set up EBS volumes when the instance is launched.
AttachTime (datetime) --
The time stamp when the attachment initiated.
DeleteOnTermination (boolean) --
Indicates whether the volume is deleted on instance termination.
Status (string) --
The attachment state.
VolumeId (string) --
The ID of the EBS volume.
AssociatedResource (string) --
The ARN of the Amazon ECS or Fargate task to which the volume is attached.
VolumeOwnerId (string) --
The ID of the Amazon Web Services account that owns the volume.
This parameter is returned only for volumes that are attached to Fargate tasks.
DisableApiTermination (dict) --
If the value is true, you can't terminate the instance through the Amazon EC2 console, CLI, or API; otherwise, you can.
Value (boolean) --
The attribute value. The valid values are true or false.
EnaSupport (dict) --
Indicates whether enhanced networking with ENA is enabled.
Value (boolean) --
The attribute value. The valid values are true or false.
EnclaveOptions (dict) --
To enable the instance for Amazon Web Services Nitro Enclaves, set this parameter to true; otherwise, set it to false.
Enabled (boolean) --
If this parameter is set to true, the instance is enabled for Amazon Web Services Nitro Enclaves; otherwise, it is not enabled for Amazon Web Services Nitro Enclaves.
EbsOptimized (dict) --
Indicates whether the instance is optimized for Amazon EBS I/O.
Value (boolean) --
The attribute value. The valid values are true or false.
InstanceId (string) --
The ID of the instance.
InstanceInitiatedShutdownBehavior (dict) --
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
Value (string) --
The attribute value. The value is case-sensitive.
InstanceType (dict) --
The instance type.
Value (string) --
The attribute value. The value is case-sensitive.
KernelId (dict) --
The kernel ID.
Value (string) --
The attribute value. The value is case-sensitive.
ProductCodes (list) --
A list of product codes.
(dict) --
Describes a product code.
ProductCodeId (string) --
The product code.
ProductCodeType (string) --
The type of product code.
RamdiskId (dict) --
The RAM disk ID.
Value (string) --
The attribute value. The value is case-sensitive.
RootDeviceName (dict) --
The device name of the root device volume (for example, /dev/sda1).
Value (string) --
The attribute value. The value is case-sensitive.
SourceDestCheck (dict) --
Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is true, source/destination checks are enabled; otherwise, they are disabled. The default value is true. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.
Value (boolean) --
The attribute value. The valid values are true or false.
SriovNetSupport (dict) --
Indicates whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
Value (string) --
The attribute value. The value is case-sensitive.
UserData (dict) --
The user data.
Value (string) --
The attribute value. The value is case-sensitive.
DisableApiStop (dict) --
To enable the instance for Amazon Web Services Stop Protection, set this parameter to true; otherwise, set it to false.
Value (boolean) --
The attribute value. The valid values are true or false.
{'Reservations': {'Instances': {'BlockDeviceMappings': {'Ebs': {'AssociatedResource': 'string', 'VolumeOwnerId': 'string'}}}}}
{'Volumes': {'Attachments': {'AssociatedResource': 'string', 'InstanceOwningService': 'string'}}}
Describes the specified EBS volumes or all of your EBS volumes.
If you are describing a long list of volumes, we recommend that you paginate the output to make the list more manageable. For more information, see Pagination.
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 state 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 ( gp2 | gp3 | io1 | io2 | st1 | sc1``| ``standard)
(dict) --
A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs.
If you specify multiple filters, the filters are joined with an AND, and the request returns only results that match all of the specified filters.
Name (string) --
The name of the filter. Filter names are case-sensitive.
Values (list) --
The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values.
(string) --
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 volumes to return for this request. This value can be between 5 and 500; if you specify a value larger than 500, only 500 items are returned. If this parameter is not used, then all items are returned. You cannot specify this parameter and the volume IDs parameter in the same request. For more information, see Pagination.
string
The token returned from a previous paginated request. Pagination continues from the end of the items returned from the previous request.
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, 'AssociatedResource': 'string', 'InstanceOwningService': 'string' }, ], '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'|'io2'|'gp2'|'sc1'|'st1'|'gp3', 'FastRestored': True|False, 'MultiAttachEnabled': True|False, 'Throughput': 123, 'SseType': 'sse-ebs'|'sse-kms'|'none' }, ], '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.
If the volume is attached to a Fargate task, this parameter returns null.
InstanceId (string) --
The ID of the instance.
If the volume is attached to a Fargate task, this parameter returns null.
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.
AssociatedResource (string) --
The ARN of the Amazon ECS or Fargate task to which the volume is attached.
InstanceOwningService (string) --
The service principal of Amazon Web Services service that owns the underlying instance to which the volume is attached.
This parameter is returned only for volumes that are attached to Fargate tasks.
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 Key Management Service (KMS) KMS key 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). For gp3, io1, and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
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 256 Unicode characters.
VolumeType (string) --
The volume type.
FastRestored (boolean) --
Indicates whether the volume was created using fast snapshot restore.
MultiAttachEnabled (boolean) --
Indicates whether Amazon EBS Multi-Attach is enabled.
Throughput (integer) --
The throughput that the volume supports, in MiB/s.
SseType (string) --
Reserved for future use.
NextToken (string) --
The token to include in another request to get the next page of items. This value is null when there are no more items to return.
{'AssociatedResource': 'string', 'InstanceOwningService': 'string'}
Detaches an EBS volume from an instance. Make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to do so can result in the volume becoming stuck in the busy state while detaching. If this happens, detachment can be delayed indefinitely until you unmount the volume, force detachment, reboot the instance, or all three. If an EBS volume is the root device of an instance, it can't be detached while the instance is running. To detach the root volume, stop the instance first.
When a volume with an Amazon Web Services Marketplace product code is detached from an instance, the product code is no longer associated with the instance.
You can't detach or force detach volumes that are attached to Amazon ECS or Fargate tasks. Attempting to do this results in the UnsupportedOperationException exception with the Unable to detach volume attached to ECS tasks error message.
For more information, see Detach an Amazon EBS volume in the Amazon Elastic Compute Cloud User Guide.
See also: AWS API Documentation
Request Syntax
client.detach_volume( Device='string', Force=True|False, InstanceId='string', VolumeId='string', DryRun=True|False )
string
The device name.
boolean
Forces detachment if the previous detachment attempt did not occur cleanly (for example, logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.
string
The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.
string
[REQUIRED]
The ID of the volume.
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
{ 'AttachTime': datetime(2015, 1, 1), 'Device': 'string', 'InstanceId': 'string', 'State': 'attaching'|'attached'|'detaching'|'detached'|'busy', 'VolumeId': 'string', 'DeleteOnTermination': True|False, 'AssociatedResource': 'string', 'InstanceOwningService': 'string' }
Response Structure
(dict) --
Describes volume attachment details.
AttachTime (datetime) --
The time stamp when the attachment initiated.
Device (string) --
The device name.
If the volume is attached to a Fargate task, this parameter returns null.
InstanceId (string) --
The ID of the instance.
If the volume is attached to a Fargate task, this parameter returns null.
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.
AssociatedResource (string) --
The ARN of the Amazon ECS or Fargate task to which the volume is attached.
InstanceOwningService (string) --
The service principal of Amazon Web Services service that owns the underlying instance to which the volume is attached.
This parameter is returned only for volumes that are attached to Fargate tasks.
{'Instances': {'BlockDeviceMappings': {'Ebs': {'AssociatedResource': 'string', 'VolumeOwnerId': 'string'}}}}