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 Amazon Web Services account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single operation. If you need to both add and remove account IDs for a snapshot, you must use multiple operations. You can make up to 500 modifications to a snapshot in a single operation.

Encrypted snapshots and snapshots with Amazon Web Services Marketplace product codes cannot be made public. Snapshots encrypted with your default KMS key cannot be shared with other accounts.

For more information about modifying snapshot permissions, see Share a snapshot in the Amazon EBS User Guide.

Note:

For .NET Core 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 client = new AmazonEC2Client();
var response = client.ModifySnapshotAttribute(new ModifySnapshotAttributeRequest 
{
    Attribute = "createVolumePermission",
    OperationType = "remove",
    SnapshotId = "snap-1234567890abcdef0",
    UserIds = new List<string> {
        "123456789012"
    }
});


            

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

To make a snapshot public


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


            

Version Information

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

See Also