AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.
Creates an EBS volume that can be attached to an instance in the same Availability Zone.
You can create a new empty volume or restore a volume from an EBS snapshot. Any Amazon Web Services Marketplace product codes from the snapshot are propagated to the volume.
You can create encrypted volumes. Encrypted volumes must 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 EBS User Guide .
You can tag your volumes during creation. For more information, see Tag your Amazon EC2 resources in the Amazon EC2 User Guide .
For more information, see Create an Amazon EBS volume in the Amazon EBS User Guide .
See also: AWS API Documentation
create-volume
--availability-zone <value>
[--encrypted | --no-encrypted]
[--iops <value>]
[--kms-key-id <value>]
[--outpost-arn <value>]
[--size <value>]
[--snapshot-id <value>]
[--volume-type <value>]
[--tag-specifications <value>]
[--multi-attach-enabled | --no-multi-attach-enabled]
[--throughput <value>]
[--client-token <value>]
[--operator <value>]
[--dry-run | --no-dry-run]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
--availability-zone
(string)
The ID of the Availability Zone in which to create the volume. For example,us-east-1a
.
--encrypted
| --no-encrypted
(boolean)
Indicates whether the volume should be encrypted. The effect of setting the encryption state to
true
depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon EBS User Guide .Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types .
--iops
(integer)
The number of I/O operations per second (IOPS). For
gp3
,io1
, andio2
volumes, this represents the number of IOPS that are provisioned for the volume. Forgp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.The following are the supported values for each volume type:
gp3
: 3,000 - 16,000 IOPSio1
: 100 - 64,000 IOPSio2
: 100 - 256,000 IOPSFor
io2
volumes, you can achieve up to 256,000 IOPS on instances built on the Nitro System . On other instances, you can achieve performance up to 32,000 IOPS.This parameter is required for
io1
andio2
volumes. The default forgp3
volumes is 3,000 IOPS. This parameter is not supported forgp2
,st1
,sc1
, orstandard
volumes.
--kms-key-id
(string)
The identifier of the KMS key to use for Amazon EBS encryption. If this parameter is not specified, your KMS key for Amazon EBS is used. If
KmsKeyId
is specified, the encrypted state must betrue
.You can specify the KMS key using any of the following:
- Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.
- Key alias. For example, alias/ExampleAlias.
- Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/1234abcd-12ab-34cd-56ef-1234567890ab.
- Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.
Amazon Web Services authenticates the KMS key asynchronously. Therefore, if you specify an ID, alias, or ARN that is not valid, the action can appear to complete, but eventually fails.
--outpost-arn
(string)
The Amazon Resource Name (ARN) of the Outpost on which to create the volume.
If you intend to use a volume with an instance running on an outpost, then you must create the volume on the same outpost as the instance. You can't use a volume created in an Amazon Web Services Region with an instance on an Amazon Web Services outpost, or the other way around.
--size
(integer)
The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.
The following are the supported volumes sizes for each volume type:
gp2
andgp3
: 1 - 16,384 GiBio1
: 4 - 16,384 GiBio2
: 4 - 65,536 GiBst1
andsc1
: 125 - 16,384 GiBstandard
: 1 - 1024 GiB
--snapshot-id
(string)
The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size.
--volume-type
(string)
The volume type. This parameter can be one of the following values:
- General Purpose SSD:
gp2
|gp3
- Provisioned IOPS SSD:
io1
|io2
- Throughput Optimized HDD:
st1
- Cold HDD:
sc1
- Magnetic:
standard
Warning
Throughput Optimized HDD (st1
) and Cold HDD (sc1
) volumes can't be used as boot volumes.For more information, see Amazon EBS volume types in the Amazon EBS User Guide .
Default:
gp2
Possible values:
standard
io1
io2
gp2
sc1
st1
gp3
--tag-specifications
(list)
The tags to apply to the volume during creation.
(structure)
The tags to apply to a resource when the resource is being created. When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.
Note
TheValid Values
lists all the resource types that can be tagged. However, the action you're using might not support tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you're using, you'll get an error.ResourceType -> (string)
The type of resource to tag on creation.Tags -> (list)
The tags to apply to the resource.
(structure)
Describes a tag.
Key -> (string)
The key of the tag.
Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with
aws:
.Value -> (string)
The value of the tag.
Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.
Shorthand Syntax:
ResourceType=string,Tags=[{Key=string,Value=string},{Key=string,Value=string}] ...
JSON Syntax:
[
{
"ResourceType": "capacity-reservation"|"client-vpn-endpoint"|"customer-gateway"|"carrier-gateway"|"coip-pool"|"declarative-policies-report"|"dedicated-host"|"dhcp-options"|"egress-only-internet-gateway"|"elastic-ip"|"elastic-gpu"|"export-image-task"|"export-instance-task"|"fleet"|"fpga-image"|"host-reservation"|"image"|"import-image-task"|"import-snapshot-task"|"instance"|"instance-event-window"|"internet-gateway"|"ipam"|"ipam-pool"|"ipam-scope"|"ipv4pool-ec2"|"ipv6pool-ec2"|"key-pair"|"launch-template"|"local-gateway"|"local-gateway-route-table"|"local-gateway-virtual-interface"|"local-gateway-virtual-interface-group"|"local-gateway-route-table-vpc-association"|"local-gateway-route-table-virtual-interface-group-association"|"natgateway"|"network-acl"|"network-interface"|"network-insights-analysis"|"network-insights-path"|"network-insights-access-scope"|"network-insights-access-scope-analysis"|"placement-group"|"prefix-list"|"replace-root-volume-task"|"reserved-instances"|"route-table"|"security-group"|"security-group-rule"|"snapshot"|"spot-fleet-request"|"spot-instances-request"|"subnet"|"subnet-cidr-reservation"|"traffic-mirror-filter"|"traffic-mirror-session"|"traffic-mirror-target"|"transit-gateway"|"transit-gateway-attachment"|"transit-gateway-connect-peer"|"transit-gateway-multicast-domain"|"transit-gateway-policy-table"|"transit-gateway-route-table"|"transit-gateway-route-table-announcement"|"volume"|"vpc"|"vpc-endpoint"|"vpc-endpoint-connection"|"vpc-endpoint-service"|"vpc-endpoint-service-permission"|"vpc-peering-connection"|"vpn-connection"|"vpn-gateway"|"vpc-flow-log"|"capacity-reservation-fleet"|"traffic-mirror-filter-rule"|"vpc-endpoint-connection-device-type"|"verified-access-instance"|"verified-access-group"|"verified-access-endpoint"|"verified-access-policy"|"verified-access-trust-provider"|"vpn-connection-device-type"|"vpc-block-public-access-exclusion"|"ipam-resource-discovery"|"ipam-resource-discovery-association"|"instance-connect-endpoint"|"verified-access-endpoint-target"|"ipam-external-resource-verification-token",
"Tags": [
{
"Key": "string",
"Value": "string"
}
...
]
}
...
]
--multi-attach-enabled
| --no-multi-attach-enabled
(boolean)
Indicates whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 Instances built on the Nitro System in the same Availability Zone. This parameter is supported withio1
andio2
volumes only. For more information, see Amazon EBS Multi-Attach in the Amazon EBS User Guide .
--throughput
(integer)
The throughput to provision for a volume, with a maximum of 1,000 MiB/s.
This parameter is valid only for
gp3
volumes.Valid Range: Minimum value of 125. Maximum value of 1000.
--client-token
(string)
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency .
--operator
(structure)
Reserved for internal use.
Principal -> (string)
The service provider that manages the resource.
Shorthand Syntax:
Principal=string
JSON Syntax:
{
"Principal": "string"
}
--dry-run
| --no-dry-run
(boolean)
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 isDryRunOperation
. Otherwise, it isUnauthorizedOperation
.
--cli-input-json
(string)
Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
--debug
(boolean)
Turn on debug logging.
--endpoint-url
(string)
Override command's default URL with the given URL.
--no-verify-ssl
(boolean)
By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.
--no-paginate
(boolean)
Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.
--output
(string)
The formatting style for command output.
--query
(string)
A JMESPath query to use in filtering the response data.
--profile
(string)
Use a specific profile from your credential file.
--region
(string)
The region to use. Overrides config/env settings.
--version
(string)
Display the version of this tool.
--color
(string)
Turn on/off color output.
--no-sign-request
(boolean)
Do not sign requests. Credentials will not be loaded if this argument is provided.
--ca-bundle
(string)
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.
--cli-read-timeout
(int)
The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.
--cli-connect-timeout
(int)
The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.
To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.
Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal's quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .
To create an empty General Purpose SSD (gp2) volume
The following create-volume
example creates an 80 GiB General Purpose SSD (gp2) volume in the specified Availability Zone. Note that the current Region must be us-east-1
, or you can add the --region
parameter to specify the Region for the command.
aws ec2 create-volume \
--volume-type gp2 \
--size 80 \
--availability-zone us-east-1a
Output:
{
"AvailabilityZone": "us-east-1a",
"Tags": [],
"Encrypted": false,
"VolumeType": "gp2",
"VolumeId": "vol-1234567890abcdef0",
"State": "creating",
"Iops": 240,
"SnapshotId": "",
"CreateTime": "YYYY-MM-DDTHH:MM:SS.000Z",
"Size": 80
}
If you do not specify a volume type, the default volume type is gp2
.
aws ec2 create-volume \
--size 80 \
--availability-zone us-east-1a
Example 2: To create a Provisioned IOPS SSD (io1) volume from a snapshot
The following create-volume
example creates a Provisioned IOPS SSD (io1) volume with 1000 provisioned IOPS in the specified Availability Zone using the specified snapshot.
aws ec2 create-volume \
--volume-type io1 \
--iops 1000 \
--snapshot-id snap-066877671789bd71b \
--availability-zone us-east-1a
Output:
{
"AvailabilityZone": "us-east-1a",
"Tags": [],
"Encrypted": false,
"VolumeType": "io1",
"VolumeId": "vol-1234567890abcdef0",
"State": "creating",
"Iops": 1000,
"SnapshotId": "snap-066877671789bd71b",
"CreateTime": "YYYY-MM-DDTHH:MM:SS.000Z",
"Size": 500
}
Example 3: To create an encrypted volume
The following create-volume
example creates an encrypted volume using the default CMK for EBS encryption. If encryption by default is disabled, you must specify the --encrypted
parameter as follows.
aws ec2 create-volume \
--size 80 \
--encrypted \
--availability-zone us-east-1a
Output:
{
"AvailabilityZone": "us-east-1a",
"Tags": [],
"Encrypted": true,
"VolumeType": "gp2",
"VolumeId": "vol-1234567890abcdef0",
"State": "creating",
"Iops": 240,
"SnapshotId": "",
"CreateTime": "YYYY-MM-DDTHH:MM:SS.000Z",
"Size": 80
}
If encryption by default is enabled, the following example command creates an encrypted volume, even without the --encrypted
parameter.
aws ec2 create-volume \
--size 80 \
--availability-zone us-east-1a
If you use the --kms-key-id
parameter to specify a customer managed CMK, you must specify the --encrypted
parameter even if encryption by default is enabled.
aws ec2 create-volume \
--volume-type gp2 \
--size 80 \
--encrypted \
--kms-key-id 0ea3fef3-80a7-4778-9d8c-1c0c6EXAMPLE \
--availability-zone us-east-1a
Example 4: To create a volume with tags
The following create-volume
example creates a volume and adds two tags.
aws ec2 create-volume \
--availability-zone us-east-1a \
--volume-type gp2 \
--size 80 \
--tag-specifications 'ResourceType=volume,Tags=[{Key=purpose,Value=production},{Key=cost-center,Value=cc123}]'
OutpostArn -> (string)
The Amazon Resource Name (ARN) of the Outpost.
Iops -> (integer)
The number of I/O operations per second (IOPS). Forgp3
,io1
, andio2
volumes, this represents the number of IOPS that are provisioned for the volume. Forgp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
Tags -> (list)
Any tags assigned to the volume.
(structure)
Describes a tag.
Key -> (string)
The key of the tag.
Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with
aws:
.Value -> (string)
The value of the tag.
Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.
VolumeType -> (string)
The volume type.
FastRestored -> (boolean)
Note
This parameter is not returned by CreateVolume.Indicates whether the volume was created using fast snapshot restore.
MultiAttachEnabled -> (boolean)
Indicates whether Amazon EBS Multi-Attach is enabled.
Throughput -> (integer)
The throughput that the volume supports, in MiB/s.
SseType -> (string)
Note
This parameter is not returned by CreateVolume.Reserved for future use.
Operator -> (structure)
The service provider that manages the volume.
Managed -> (boolean)
Iftrue
, the resource is managed by an service provider.Principal -> (string)
Ifmanaged
istrue
, then the principal is returned. The principal is the service provider that manages the resource.
VolumeId -> (string)
The ID of the volume.
Size -> (integer)
The size of the volume, in GiBs.
SnapshotId -> (string)
The snapshot from which the volume was created, if applicable.
AvailabilityZone -> (string)
The Availability Zone for the volume.
State -> (string)
The volume state.
CreateTime -> (timestamp)
The time stamp when volume creation was initiated.
Attachments -> (list)
Note
This parameter is not returned by CreateVolume.Information about the volume attachments.
(structure)
Describes volume attachment details.
DeleteOnTermination -> (boolean)
Indicates whether the EBS volume is deleted on instance termination.AssociatedResource -> (string)
The ARN of the Amazon ECS or Fargate task to which the volume is attached.InstanceOwningService -> (string)
The service principal of Amazon Web Services service that owns the underlying instance to which the volume is attached.
This parameter is returned only for volumes that are attached to Fargate tasks.
VolumeId -> (string)
The ID of the volume.InstanceId -> (string)
The ID of the instance.
If the volume is attached to a Fargate task, this parameter returns
null
.Device -> (string)
The device name.
If the volume is attached to a Fargate task, this parameter returns
null
.State -> (string)
The attachment state of the volume.AttachTime -> (timestamp)
The time stamp when the attachment initiated.
Encrypted -> (boolean)
Indicates whether the volume is encrypted.
KmsKeyId -> (string)
The Amazon Resource Name (ARN) of the KMS key that was used to protect the volume encryption key for the volume.