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 one or more of the EBS snapshots available to you. Available snapshots include public snapshots available for any AWS account to launch, private snapshots that you own, and private snapshots owned by another AWS account but for which you've been given explicit create volume permissions.

The create volume permissions fall into the following categories:

The list of snapshots returned can be modified by specifying snapshot IDs, snapshot owners, or AWS accounts with create volume permissions. If no options are specified, Amazon EC2 returns all snapshots for which you have create volume permissions.

If you specify one or more snapshot IDs, only snapshots that have the specified IDs are returned. If you specify an invalid snapshot ID, an error is returned. If you specify a snapshot ID for which you do not have access, it is not included in the returned results.

If you specify one or more snapshot owners using the OwnerIds option, only snapshots from the specified owners and for which you have access are returned. The results can include the AWS account IDs of the specified owners, amazon for snapshots owned by Amazon, or self for snapshots that you own.

If you specify a list of restorable users, only snapshots with create snapshot permissions for those users are returned. You can specify AWS account IDs (if you own the snapshots), self for snapshots for which you own or have explicit permissions, or all for public snapshots.

If you are describing a long list of snapshots, you can paginate the output to make the list more manageable. The MaxResults parameter sets the maximum number of results returned in a single page. If the list of results exceeds your MaxResults value, then that number of results is returned along with a NextToken value that can be passed to a subsequent DescribeSnapshots request to retrieve the remaining results.

For more information about EBS snapshots, see Amazon EBS Snapshots in the Amazon Elastic Compute Cloud User Guide.

Note:

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

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

Syntax

C#
public virtual DescribeSnapshotsResponse DescribeSnapshots(
         DescribeSnapshotsRequest request
)
Parameters
request
Type: Amazon.EC2.Model.DescribeSnapshotsRequest

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

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

Examples

This example describes a snapshot with the snapshot ID of ``snap-1234567890abcdef0``.

To describe a snapshot


var response = client.DescribeSnapshots(new DescribeSnapshotsRequest 
{
    SnapshotIds = new List {
        "snap-1234567890abcdef0"
    }
});

string nextToken = response.NextToken;
List snapshots = response.Snapshots;

            

This example describes all snapshots owned by the ID 012345678910 that are in the ``pending`` status.

To describe snapshots using filters


var response = client.DescribeSnapshots(new DescribeSnapshotsRequest 
{
    Filters = new List {
        new Filter {
            Name = "status",
            Values = new List {
                "pending"
            }
        }
    },
    OwnerIds = new List {
        "012345678910"
    }
});

string nextToken = response.NextToken;
List snapshots = response.Snapshots;

            

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