modifySnapshotAttribute

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.

Samples

import aws.sdk.kotlin.services.ec2.model.OperationType
import aws.sdk.kotlin.services.ec2.model.SnapshotAttributeName
fun main() { 
   //sampleStart 
   // This example makes the snapshot snap 1234567890abcdef0 public.
val resp = ec2Client.modifySnapshotAttribute {
    snapshotId = "snap-1234567890abcdef0"
    attribute = SnapshotAttributeName.fromValue("createVolumePermission")
    operationType = OperationType.fromValue("add")
    groupNames = listOf<String>(
        "all"
    )
} 
   //sampleEnd
}
import aws.sdk.kotlin.services.ec2.model.OperationType
import aws.sdk.kotlin.services.ec2.model.SnapshotAttributeName
fun main() { 
   //sampleStart 
   // 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.
val resp = ec2Client.modifySnapshotAttribute {
    snapshotId = "snap-1234567890abcdef0"
    attribute = SnapshotAttributeName.fromValue("createVolumePermission")
    operationType = OperationType.fromValue("remove")
    userIds = listOf<String>(
        "123456789012"
    )
} 
   //sampleEnd
}