amazonka-ec2-2.0: Amazon Elastic Compute Cloud SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.EC2.DetachVolume

Description

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.

For more information, see Detach an Amazon EBS volume in the Amazon Elastic Compute Cloud User Guide.

Synopsis

Creating a Request

data DetachVolume Source #

See: newDetachVolume smart constructor.

Constructors

DetachVolume' 

Fields

  • device :: Maybe Text

    The device name.

  • dryRun :: Maybe Bool

    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 :: Maybe Bool

    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.

  • instanceId :: Maybe Text

    The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.

  • volumeId :: Text

    The ID of the volume.

Instances

Instances details
ToHeaders DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

ToPath DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

ToQuery DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

AWSRequest DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

Associated Types

type AWSResponse DetachVolume #

Generic DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

Associated Types

type Rep DetachVolume :: Type -> Type #

Read DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

Show DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

NFData DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

Methods

rnf :: DetachVolume -> () #

Eq DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

Hashable DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

type AWSResponse DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

type Rep DetachVolume Source # 
Instance details

Defined in Amazonka.EC2.DetachVolume

type Rep DetachVolume = D1 ('MetaData "DetachVolume" "Amazonka.EC2.DetachVolume" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "DetachVolume'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "device") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "dryRun") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool))) :*: (S1 ('MetaSel ('Just "force") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: (S1 ('MetaSel ('Just "instanceId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "volumeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

newDetachVolume Source #

Create a value of DetachVolume with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

DetachVolume, detachVolume_device - The device name.

$sel:dryRun:DetachVolume', detachVolume_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.

$sel:force:DetachVolume', detachVolume_force - 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.

DetachVolume, detachVolume_instanceId - The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.

DetachVolume, detachVolume_volumeId - The ID of the volume.

Request Lenses

detachVolume_dryRun :: Lens' DetachVolume (Maybe Bool) Source #

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.

detachVolume_force :: Lens' DetachVolume (Maybe Bool) Source #

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.

detachVolume_instanceId :: Lens' DetachVolume (Maybe Text) Source #

The ID of the instance. If you are detaching a Multi-Attach enabled volume, you must specify an instance ID.

Destructuring the Response

data VolumeAttachment Source #

Describes volume attachment details.

See: newVolumeAttachment smart constructor.

Constructors

VolumeAttachment' 

Fields

Instances

Instances details
FromXML VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

Generic VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

Associated Types

type Rep VolumeAttachment :: Type -> Type #

Read VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

Show VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

NFData VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

Methods

rnf :: VolumeAttachment -> () #

Eq VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

Hashable VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

type Rep VolumeAttachment Source # 
Instance details

Defined in Amazonka.EC2.Types.VolumeAttachment

type Rep VolumeAttachment = D1 ('MetaData "VolumeAttachment" "Amazonka.EC2.Types.VolumeAttachment" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "VolumeAttachment'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "attachTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ISO8601)) :*: (S1 ('MetaSel ('Just "deleteOnTermination") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "device") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)))) :*: (S1 ('MetaSel ('Just "instanceId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "state") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe VolumeAttachmentState)) :*: S1 ('MetaSel ('Just "volumeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))))))

newVolumeAttachment :: VolumeAttachment Source #

Create a value of VolumeAttachment with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:attachTime:VolumeAttachment', volumeAttachment_attachTime - The time stamp when the attachment initiated.

$sel:deleteOnTermination:VolumeAttachment', volumeAttachment_deleteOnTermination - Indicates whether the EBS volume is deleted on instance termination.

$sel:device:VolumeAttachment', volumeAttachment_device - The device name.

$sel:instanceId:VolumeAttachment', volumeAttachment_instanceId - The ID of the instance.

$sel:state:VolumeAttachment', volumeAttachment_state - The attachment state of the volume.

$sel:volumeId:VolumeAttachment', volumeAttachment_volumeId - The ID of the volume.

Response Lenses

volumeAttachment_attachTime :: Lens' VolumeAttachment (Maybe UTCTime) Source #

The time stamp when the attachment initiated.

volumeAttachment_deleteOnTermination :: Lens' VolumeAttachment (Maybe Bool) Source #

Indicates whether the EBS volume is deleted on instance termination.