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.

Adds or removes permission settings for the specified snapshot. You may add or remove specified AWS account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single API call. If you need to both add and remove account IDs for a snapshot, you must use multiple API calls.

Encrypted snapshots and snapshots with AWS Marketplace product codes cannot be made public. Snapshots encrypted with your default CMK cannot be shared with other accounts.

For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide.

Note:

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

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

Syntax

C#
public virtual ModifySnapshotAttributeResponse ModifySnapshotAttribute(
         ModifySnapshotAttributeRequest request
)
Parameters
request
Type: Amazon.EC2.Model.ModifySnapshotAttributeRequest

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

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

Examples

This example modifies snapshot ``snap-1234567890abcdef0`` to remove the create volume permission for a user with the account ID ``123456789012``. If the command succeeds, no output is returned.

To modify a snapshot attribute


var response = client.ModifySnapshotAttribute(new ModifySnapshotAttributeRequest 
{
    Attribute = "createVolumePermission",
    OperationType = "remove",
    SnapshotId = "snap-1234567890abcdef0",
    UserIds = new List {
        "123456789012"
    }
});


            

This example makes the snapshot ``snap-1234567890abcdef0`` public.

To make a snapshot public


var response = client.ModifySnapshotAttribute(new ModifySnapshotAttributeRequest 
{
    Attribute = "createVolumePermission",
    GroupNames = new List {
        "all"
    },
    OperationType = "add",
    SnapshotId = "snap-1234567890abcdef0"
});


            

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