attach_volume¶
Operation¶
attach_volume
async
¶
attach_volume(input: AttachVolumeInput, plugins: list[Plugin] | None = None) -> AttachVolumeOutput
Attaches an Amazon EBS volume to a running or stopped instance, and
exposes it to the instance with the specified device name.
Note
The maximum number of Amazon EBS volumes that you can attach to an
instance depends on the instance type. If you exceed the volume
attachment limit for an instance type, the attachment request fails with
the AttachmentLimitExceeded error. For more information, see Instance
volume
limits.
After you attach an EBS volume, you must make it available for use. 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 EBS User Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
AttachVolumeInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
AttachVolumeOutput
|
An instance of |
Input¶
AttachVolumeInput
dataclass
¶
Bases: _SerdeShape
Dataclass for AttachVolumeInput structure.
Attributes¶
device
class-attribute
instance-attribute
¶
device: str | None = ...
The device name (for example, /dev/sdh or xvdh).
dry_run
class-attribute
instance-attribute
¶
dry_run: bool | None = ...
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.
ebs_card_index
class-attribute
instance-attribute
¶
ebs_card_index: int | None = ...
The index of the EBS card. Some instance types support multiple EBS cards. The default EBS card index is 0.
Output¶
AttachVolumeOutput
dataclass
¶
Bases: _SerdeShape
Describes volume attachment details.
Attributes¶
associated_resource
class-attribute
instance-attribute
¶
associated_resource: str | None = ...
The ARN of the Amazon Web Services-managed resource to which the volume is attached.
attach_time
class-attribute
instance-attribute
¶
attach_time: datetime | None = ...
The time stamp when the attachment initiated.
delete_on_termination
class-attribute
instance-attribute
¶
delete_on_termination: bool | None = ...
Indicates whether the EBS volume is deleted on instance termination.
device
class-attribute
instance-attribute
¶
device: str | None = ...
The device name.
If the volume is attached to an Amazon Web Services-managed resource,
this parameter returns null.
ebs_card_index
class-attribute
instance-attribute
¶
ebs_card_index: int | None = ...
The index of the EBS card. Some instance types support multiple EBS cards. The default EBS card index is 0.
instance_id
class-attribute
instance-attribute
¶
instance_id: str | None = ...
The ID of the instance.
If the volume is attached to an Amazon Web Services-managed resource,
this parameter returns null.
instance_owning_service
class-attribute
instance-attribute
¶
instance_owning_service: str | None = ...
The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.
This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.