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 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 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,
      "Iops" : Number,
      "Size" : String,
      "SnapshotId" : String,
      "Tags" : [ EC2 Tag, ...  ],
      "VolumeType : String
   }
}

Properties

AvailabilityZone

The Availability Zone in which to create the new volume.

Required: Yes

Type: String

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 standard volumes.

Type: Number

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

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

Tags

The tags you want to attach to the volume.

Required: No

Type: List of EC2 Tags

VolumeType

The volume type. This can be either "standard" or "io1". If no value is specified, "standard" will be used.

Required: No

Type: String

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 EBS volume with DeletionPolicy to make a snapshot on delete

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

Example 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