EC2 - Detach Volume

Declaration

<AMAWSEC2 ACTIVITY="detach_volume" VOLUMEID="text" />

See Also

EC2 - Attach Volume | EC2 - Create Volume | EC2 - Delete Volume | EC2 - Detach Volume | EC2 - End Session | EC2 - List Volumes | EC2 - Reboot Instance | EC2 - Release Address | EC2 - Revoke Security Group | EC2 - Start Instance | EC2 - Stop Instance | EC2 - Terminate Instance

Description

Detaches an Amazon EBS (Elastic Block Store) volume from an instance.  

Amazon EBS provides block level storage volumes for use with EC2 instances. EBS volumes are off-instance storage that persists independently from the life of an instance. Elastic Block Store provides highly available, highly reliable storage volumes that can be attached to a running EC2 instance and exposed as a device within the instance.

NOTE: If an Amazon EBS volume is the root device of an instance, it cannot be detached while the instance is in the ‘running’ state. To detach the root volume, stop the instance first. Also, make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to unmount file systems, or otherwise properly release the device from use, can result in lost data and will corrupt the file system.

 

IMPORTANT: The EC2 activities are performed using Amazon's EC2 engine. You must enter a valid Amazon EC2 service account in order for these activities to work properly.

Practical Usage

Mainly used to detach an EBS volume from an instance in order to delete that volume. By default, you cannot delete an EBS Volume unless it is currently detached from a running instance.

Parameters

Volume Properties

Property

Type

Req'd

Default

Markup

Description

Volume ID

Text

Yes

(Empty)

VOLUMEID="4282672b"

The ID of the volume to detach.

Instance ID

Text

No

(Empty)

INSTANCEID="6058a509"

The ID of the instance.

Device

Text

No

(Empty)

DEVICE="/dev/sdh"

The device name.

Force

Yes/No

No

No

FORCE="YES"

If set to YES, forces detachment if the previous detachment attempt did not occur cleanly (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 will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures. The default value is NO.

 

Credentials Properties

These properties allow you to create a custom session for this activity or link this activity to an existing session.

Property

Type

Req'd

Default

Markup

Description

Provide Credentials

 

 

 

 

Indicates where this activity's credentials should originate from. Different properties apply depending on the option selected. This is a design-time parameter used interactively during  construction mode, thus, contains no markups. The available options are:

  • Custom (Default) - Specifies that a custom set of credentials will be entered for this EC2 activity. Select this option if performing a single EC2 activity.

  • Session Based - Specifies that credentials should derive from a session created in a previous step with the use of the Create Session activity. This allows several EC2 activities to be linked to a specific session.

Access Key

Text

Yes

(Empty)

ACCESSKEY="MyAccessKey"

A 20-character, alphanumeric string that uniquely identifies a user who owns a EC2 account (i.e. 022QF06E7MXBSH9DHM02). This along with a Secret Access Key forms a secure information set that EC2 uses to confirm a valid user's identity.

This property is active only if Custom is selected under the Provide Credentials property.

Secret Access Key

Text

Yes

(Empty)

SECRETKEY="SecretKey"

A 40-character string that serves the role as Password to access EC2 (i.e. kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct). This along with an associated Access Key forms a secure information set that EC2 uses to confirm a valid user's identity.

This property is active only if Custom is selected under the Provide Credentials property.

User Agent

Text

No

AutoMate

USERAGENT="AutoMate"

The User-Agent header name. The User-Agent request-header field contains information about the user agent originating the request such as timeouts, proxies, name, etc. The default User Agent name is AutoMate.

This property is active only if Custom is selected under the Provide Credentials property.

Service URL

Text

No

(Empty)

SERVICEURL=

"https://sdb.eu-west-1.amazonaws.com"

The Service URL used to make requests to the EC2 service. The Service URL provides the service endpoint. For example, To make the service call to a different region, you can pass the region-specific endpoint, such as 'https://sdb.eu-west-1.amazonaws.com'.

This property is active only if Custom is selected under the Provide Credentials property.

Maximum retry on error

Number

No

(Empty)

MAXERRORRETRY="4"

Signifies how many times the Amazon EC2 engine should retry the request before returning an error.

This property is active only if Custom is selected under the Provide Credentials property.

Proxy Host

Text

No

(Empty)

PROXYHOST="proxy.host.com"

The host name (server.domain.com) or IP address (xxx.xxx.xxx.xxx) of the proxy server.

This property is active only if Custom is selected under the Provide Credentials property.

Proxy Port

Number

No

(Empty)

PROXYPORT="1028"

The port that should be used to connect to the proxy server.

This property is active only if Custom is selected under the Provide Credentials property.

Signature Method

Text

No

(Empty)

SIGNMETHOD="HmacSHA256"

The Signature Method for signing the request.

This property is active only if Custom is selected under the Provide Credentials property.

Signature Version

Number

No

(Empty)

SIGNVERSION="2"

The Signature Version for signing the request. The version refers to the particular algorithm for signing the request.

This property is active only if Custom is selected under the Provide Credentials property.

Session Name

Text

Yes

EC2Session

SESSION="EC2Session1"

The session name to be created. This allows several EC2 activities to be linked to this  session, eliminating redundancy. Numerous sessions can be used within a single task. The default value is EC2Session.

NOTE: Use the End Session activity to end an EC2 session.

This property is active only if Session Based is selected under the Provide Credentials property.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Detach amazon EBS volume "vol-0753f76e". Use default EC2 session.

 

<AMAWSEC2 ACTIVITY="detach_volume" VOLUMEID="vol-0753f76e" />

 

↑ [Top of Page]