AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

AWS::EC2::Volume

The AWS::EC2::Volume type creates a new Amazon Elastic Block Store volume.

You can set a deletion policy for your volume to control how AWS CloudFormation handles the volume when the stack is deleted. For Amazon Elastic Block Store volumes, you can choose to retain the volume, to delete the volume, or to create a snapshot of the volume. For more information, see DeletionPolicy Attribute.

Note

If you set a deletion policy that creates a snapshot, all tags on the volume are included in the snapshot.

Syntax

{
   "Type":"AWS::EC2::Volume",
   "Properties" : {
      "AvailabilityZone" : String,
      "Encrypted" : Boolean,
      "Iops" : Number,
      "Size" : String,
      "SnapshotId" : String,
      "Tags" : [ Resource Tag, ... ],
      "VolumeType : String
   }
}

Properties

AvailabilityZone

The Availability Zone in which to create the new volume.

Required: Yes

Type: String

Update requires: Updates are not supported

Encrypted

Indicates whether the volume is encrypted. Encrypted Amazon EBS volumes can only be attached to instance types that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are automatically encrypted. You cannot create an encrypted volume from an unencrypted snapshot or vice versa. If your AMI uses encrypted volumes, you can only launch the AMI on supported instance types. For more information, see Amazon EBS encryption in the Amazon EC2 User Guide for Linux Instances.

Required: No

Type: Boolean

Update requires: Updates are not supported

Iops

The number of I/O operations per second (IOPS) that the volume supports. This can be any integer value from 1–4000.

Required: Conditional. Required when the volume type is io1; not used with other volume types.

Type: Number

Update requires: Updates are not supported

Size

The size of the volume, in gibibytes (GiBs). This can be any value from 10–1024.

Note

The size of the EBS volume must accommodate the IOPS you need. There is a 10 : 1 ratio between IOPS and Gibibytes (GiB) of storage, so for 100 PIOPS, you need at least 10 GiB storage on the root volume.

Required: Conditional. Required if you are not creating a volume from a snapshot. If you specify Size, do not specify SnapshotId.

Type: String

Update requires: Updates are not supported

SnapshotId

The snapshot from which to create the new volume.

Required: Conditional Required if you are creating a volume from a snapshot. If you do not specify a value for SnapshotId, you must specify a value for Size.

Type: String

Update requires: Updates are not supported

Tags

An arbitrary set of tags (key–value pairs) for this volume.

Required: No

Type: AWS CloudFormation Resource Tags

Update requires: Updates are not supported

VolumeType

The volume type. You can specify standard, io1, or gp2. If you set the type to io1, you must also set the Iops property. For more information about these values and the default value, see CreateVolume in the Amazon EC2 API Reference.

Required: No

Type: String

Update requires: Updates are not supported

Return Values

Ref

When you specify an AWS::EC2::Volume type as an argument to the Ref function, AWS CloudFormation returns the volume's physical ID. For example: vol-5cb85026.

For more information about using the Ref function, see Ref.

Examples

Example Encrypted Amazon EBS volume with DeletionPolicy to make a snapshot on delete

"NewVolume" : {
   "Type" : "AWS::EC2::Volume",
   "Properties" : {
      "Size" : "100",
      "Encrypted" : "true",
      "AvailabilityZone" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] },
      "Tags" : [ {
         "Key" : "MyTag",
         "Value" : "TagValue"
      } ]
   },
   "DeletionPolicy" : "Snapshot"
}
         

Example Amazon EBS volume with 100 provisioned IOPS

"NewVolume" : {
   "Type" : "AWS::EC2::Volume",
   "Properties" : {
     "Size" : "100",
     "VolumeType" : "io1",
     "Iops" : "100",
     "AvailabilityZone" : { "Fn::GetAtt" : [ "EC2Instance", "AvailabilityZone" ] }
   }
}        

See Also