Required permissions for Amazon EBS snapshot lock - Amazon EBS
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Required permissions for Amazon EBS snapshot lock

By default, users don't have permission to work with snapshot locks. To allow users to use snapshot locks, you must create IAM policies that grant permission to use specific resources and API actions. For more information, see Creating IAM policies in the IAM User Guide.

Required permissions

To work with snapshot locks, users need the following permissions.

  • ec2:LockSnapshot — To lock snapshots.

  • ec2:UnlockSnapshot — To unlock snapshots.

  • ec2:DescribeLockedSnapshots — To view snapshot lock settings.

The following is an example IAM policy that gives users permission to lock and unlock snapshots, and to view snapshot lock settings. It includes the ec2:DescribeSnapshots permission for console users. If some permissions are not needed, you can remove them from the policy.

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "ec2:LockSnapshot", "ec2:UnlockSnapshot", "ec2:DescribeLockedSnapshots", "ec2:DescribeSnapshots" ] }] }

To provide access, add permissions to your users, groups, or roles:

Restrict access with condition keys

You can use condition keys to restrict how users are allowed to lock snapshots.

ec2:SnapshotLockDuration

You can use the ec2:SnapshotLockDuration condition key to restrict users to specific lock durations when locking snapshots.

The following example policy restricts users to specifying a lock duration between 10 and 50 days.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ec2:LockSnapshot", "Resource": "arn:aws:ec2:region::snapshot/*" "Condition": { "NumericGreaterThan" : { "ebs:SnapshotLockDuration" : 10 } "NumericLessThan":{ "ebs:SnapshotLockDuration": 50 } } } ] }

ec2:CoolOffPeriod

You can use the ec2:CoolOffPeriod condition key to prevent users from locking snapshots in compliance mode without a cooling-off period.

The following example policy restricts users to specifying a cooling-off period greater than 48 hours when locking snapshots in compliance mode.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ec2:LockSnapshot", "Resource": "arn:aws:ec2:region::snapshot/*" "Condition": { "NumericGreaterThan": { "ec2:CoolOffPeriod": 48 } } } ] }