Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

CreateVolume

Creates an EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the regional endpoint that you send the HTTP request to. For more information see Regions and Endpoints.

You can create a new empty volume or restore a volume from an EBS snapshot. Any AWS Marketplace product codes from the snapshot are propagated to the volume.

You can create encrypted volumes with the Encrypted parameter. Encrypted volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

For more information, see Creating or Restoring an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

AvailabilityZone

The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.

Type: String

Required: Yes

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.

Type: Boolean

Required: No

Encrypted

Specifies whether the volume should be encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are automatically encrypted. There is no way to create an encrypted volume from an unencrypted snapshot or vice versa. If your AMI uses encrypted volumes, you can only launch it on supported instance types. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

Type: Boolean

Required: No

Iops

Only valid for Provisioned IOPS SSD volumes. The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB.

Constraint: Range is 100 to 20000 for Provisioned IOPS SSD volumes

Type: Integer

Required: No

KmsKeyId

The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use when creating the encrypted volume. This parameter is only required if you want to use a non-default CMK; if this parameter is not specified, the default CMK for EBS is used. The ARN contains the arn:aws:kms namespace, followed by the region of the CMK, the AWS account ID of the CMK owner, the key namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. If a KmsKeyId is specified, the Encrypted flag must also be set.

Type: String

Required: No

Size

The size of the volume, in GiBs.

Constraints: 1-16384 for gp2, 4-16384 for io1, 500-16384 for st1, 500-16384 for sc1, and 1-1024 for standard. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

Type: Integer

Required: No

SnapshotId

The snapshot from which to create the volume.

Type: String

Required: No

VolumeType

The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.

Default: standard

Type: String

Valid Values: standard | io1 | gp2 | sc1 | st1

Required: No

Response Elements

The following elements are returned by the service.

attachmentSet

Information about the volume attachments.

Type: array of VolumeAttachment objects

availabilityZone

The Availability Zone for the volume.

Type: String

createTime

The time stamp when volume creation was initiated.

Type: Timestamp

encrypted

Indicates whether the volume will be encrypted.

Type: Boolean

iops

The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS SSD volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose SSD volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information on General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide.

Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.

Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2, st1, sc1, or standard volumes.

Type: Integer

kmsKeyId

The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the volume.

Type: String

requestId

The ID of the request.

Type: String

size

The size of the volume, in GiBs.

Type: Integer

snapshotId

The snapshot from which the volume was created, if applicable.

Type: String

status

The volume state.

Type: String

Valid Values: creating | available | in-use | deleting | deleted | error

tagSet

Any tags assigned to the volume.

Type: array of Tag objects

volumeId

The ID of the volume.

Type: String

volumeType

The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.

Type: String

Valid Values: standard | io1 | gp2 | sc1 | st1

Errors

For information about the errors that are common to all actions, see Common Errors.

Example

Example

This example request creates an 80 GiB encrypted volume in the Availability Zone us-east-1a.

Sample Request

Copy to clipboard
https://ec2.amazonaws.com/?Action=CreateVolume &Size=80 &AvailabilityZone=us-east-1a &Encrypted=1 &AUTHPARAMS

Sample Response

Copy to clipboard
<CreateVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <volumeId>vol-1234567890abcdef0</volumeId> <size>80</size> <snapshotId/> <availabilityZone>us-east-1a</availabilityZone> <status>creating</status> <createTime>YYYY-MM-DDTHH:MM:SS.000Z</createTime> <volumeType>standard</volumeType> <encrypted>true</encrypted> </CreateVolumeResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: