AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
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.
For .NET Core this operation is only available in asynchronous form. Please refer to CreateVolumeAsync.
Namespace: Amazon.EC2
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z
public virtual CreateVolumeResponse CreateVolume( CreateVolumeRequest request )
Container for the necessary parameters to execute the CreateVolume service method.
This example creates an 80 GiB General Purpose (SSD) volume in the Availability Zone ``us-east-1a``.
var client = new AmazonEC2Client(); var response = client.CreateVolume(new CreateVolumeRequest { AvailabilityZone = "us-east-1a", Size = 80, VolumeType = "gp2" }); string availabilityZone = response.AvailabilityZone; DateTime createTime = response.CreateTime; bool encrypted = response.Encrypted; int iops = response.Iops; int size = response.Size; string snapshotId = response.SnapshotId; string state = response.State; string volumeId = response.VolumeId; string volumeType = response.VolumeType;
This example creates a new Provisioned IOPS (SSD) volume with 1000 provisioned IOPS from a snapshot in the Availability Zone ``us-east-1a``.
var client = new AmazonEC2Client(); var response = client.CreateVolume(new CreateVolumeRequest { AvailabilityZone = "us-east-1a", Iops = 1000, SnapshotId = "snap-066877671789bd71b", VolumeType = "io1" }); List<VolumeAttachment> attachments = response.Attachments; string availabilityZone = response.AvailabilityZone; DateTime createTime = response.CreateTime; int iops = response.Iops; int size = response.Size; string snapshotId = response.SnapshotId; string state = response.State; List<Tag> tags = response.Tags; string volumeId = response.VolumeId; string volumeType = response.VolumeType;
.NET Framework:
Supported in: 4.5 and newer, 3.5