| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
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.
{
"Type":"AWS::EC2::Volume",
"Properties" : {
"AvailabilityZone" : String,
"Iops" : Number,
"Size" : String,
"SnapshotId" : String,
"Tags" : [ EC2 Tag, ... ],
"VolumeType : String
}
}The Availability Zone in which to create the new volume.
Required: Yes.
Type: String.
The number of I/O operations per second (IOPS) that the volume supports. This can be any integer value from 1–1000.
Required: Conditional. Required when the volume type is "io1"; not used with standard volumes.
Type: Number.
The size of the volume, in gibibytes (GiBs). This can be any value from 10–1024.
Note
The size of the EBS volume must accomodate 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.
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.
The tags you want to attach to the volume.
Required: No.
Type: List of EC2 Tags
The volume type. This can be either "standard" or "io1". If no value is specified, "standard" will be used.
Required: No.
Type: String.
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.
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" ] }
}
} CreateVolume in the Amazon Elastic Compute Cloud API Reference