detach_volume¶
Operation¶
detach_volume
async
¶
detach_volume(input: DetachVolumeInput, plugins: list[Plugin] | None = None) -> DetachVolumeOutput
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
Web Services-managed resources. Attempting to do this results in the
UnsupportedOperationException exception.
For more information, see Detach an Amazon EBS volume in the Amazon EBS User Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
DetachVolumeInput
|
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 |
|---|---|
DetachVolumeOutput
|
An instance of |
Input¶
DetachVolumeInput
dataclass
¶
Bases: _SerdeShape
Dataclass for DetachVolumeInput structure.
Attributes¶
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.
force
class-attribute
instance-attribute
¶
force: bool | None = ...
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.
Output¶
DetachVolumeOutput
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.