AWS SDK Version 3 for .NET
API Reference

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

You can tag your volumes during creation. For more information, see Tagging Your Amazon EC2 Resources.

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

Note:

For PCL this operation is only available in asynchronous form. Please refer to CreateVolumeAsync.

Namespace: Amazon.EC2
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public virtual CreateVolumeResponse CreateVolume(
         CreateVolumeRequest request
)
Parameters
request
Type: Amazon.EC2.Model.CreateVolumeRequest

Container for the necessary parameters to execute the CreateVolume service method.

Return Value
The response from the CreateVolume service method, as returned by EC2.

Examples

This example creates an 80 GiB General Purpose (SSD) volume in the Availability Zone ``us-east-1a``.

To create a new volume


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;
integer iops = response.Iops;
integer 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``.

To create a new Provisioned IOPS (SSD) volume from a snapshot


var response = client.CreateVolume(new CreateVolumeRequest 
{
    AvailabilityZone = "us-east-1a",
    Iops = 1000,
    SnapshotId = "snap-066877671789bd71b",
    VolumeType = "io1"
});

List attachments = response.Attachments;
string availabilityZone = response.AvailabilityZone;
DateTime createTime = response.CreateTime;
integer iops = response.Iops;
integer size = response.Size;
string snapshotId = response.SnapshotId;
string state = response.State;
List tags = response.Tags;
string volumeId = response.VolumeId;
string volumeType = response.VolumeType;

            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also