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.

Describes the specified EBS volumes or all of your EBS volumes.

If you are describing a long list of volumes, we recommend that you paginate the output to make the list more manageable. For more information, see Pagination.

For more information about EBS volumes, see Amazon EBS volumes in the Amazon EBS User Guide.

We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts.

The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to DescribeVolumesAsync.

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

Syntax

C#
public virtual DescribeVolumesResponse DescribeVolumes(
         DescribeVolumesRequest request
)

Parameters

request
Type: Amazon.EC2.Model.DescribeVolumesRequest

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

Return Value


The response from the DescribeVolumes service method, as returned by EC2.

Examples

This example describes all of your volumes in the default region.

To describe all volumes


var client = new AmazonEC2Client();
var response = client.DescribeVolumes(new DescribeVolumesRequest 
{
});

string nextToken = response.NextToken;
List<Volume> volumes = response.Volumes;

            

This example describes all volumes that are both attached to the instance with the ID i-1234567890abcdef0 and set to delete when the instance terminates.

To describe volumes that are attached to a specific instance


var client = new AmazonEC2Client();
var response = client.DescribeVolumes(new DescribeVolumesRequest 
{
    Filters = new List<Filter> {
        new Filter {
            Name = "attachment.instance-id",
            Values = new List<string> {
                "i-1234567890abcdef0"
            }
        },
        new Filter {
            Name = "attachment.delete-on-termination",
            Values = new List<string> {
                "true"
            }
        }
    }
});

List<Volume> volumes = response.Volumes;

            

Version Information

.NET Framework:
Supported in: 4.5 and newer, 3.5

See Also