using-with-s3-actions

Specifying Permissions in a Policy

Amazon S3 defines a set of permissions that you can specify in a policy. These are keywords, each of which maps to specific Amazon S3 operations. For more information, see Actions in the Amazon Simple Storage Service API Reference.

Topics

Permissions for Object Operations

This section provides a list of the permissions for object operations that you can specify in a policy.

Amazon S3 Permissions for Object Operations

PermissionsAmazon S3 Operations
s3:AbortMultipartUploadAbort Multipart Upload
s3:BypassGovernanceRetentionPUT Object Retention, PUT Object , DELETE Object
s3:DeleteObjectDELETE Object
s3:DeleteObjectTaggingDELETE Object tagging
s3:DeleteObjectVersionDELETE Object (a Specific Version of the Object)
s3:DeleteObjectVersionTaggingDELETE Object tagging (for a Specific Version of the Object)
s3:GetObjectGET Object, HEAD Object, SELECT Object Content When you grant this permission on a version-enabled bucket, you always get the latest version data.
s3:GetObjectAclGET Object ACL
s3:GetObjectLegalHoldGET Object Legal Hold, GET Object
s3:GetObjectRetentionGet Object Retention, GET Object
s3:GetObjectTaggingGET Object tagging
s3:GetObjectTorrentGET Object torrent
s3:GetObjectVersionGET Object, HEAD Object To grant permission for version-specific object data, you must grant this permission. That is, when you specify version number when making any of these requests, you need this Amazon S3 permission.
s3:GetObjectVersionAclGET ACL (for a Specific Version of the Object)
s3:GetObjectVersionTaggingGET Object tagging (for a Specific Version of the Object)
s3:GetObjectVersionTorrentGET Object Torrent versioning
s3:ListMultipartUploadPartsList Parts
s3:PutObjectPUT Object, POST Object, Initiate Multipart Upload, Upload Part, Complete Multipart Upload, PUT Object - Copy
s3:PutObjectAclPUT Object ACL
s3:PutObjectLegalHoldPUT Object Legal Hold, PUT Object
s3:PutObjectRetentionPUT Object Retention, PUT Object
s3:PutObjectTaggingPUT Object tagging
s3:PutObjectVersionAclPUT Object ACL (for a Specific Version of the Object)
s3:PutObjectVersionTaggingPUT Object tagging (for a Specific Version of the Object)
s3:RestoreObjectPOST Object restore

The following example bucket policy grants the s3:PutObject and the s3:PutObjectAcl permissions to a user (Dave). If you remove the Principal element, you can attach the policy to a user. These are object operations, and accordingly the relative-id portion of the Resource ARN identifies objects (examplebucket/*). For more information, see Specifying Resources in a Policy.

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::AccountB-ID:user/Dave"
},
"Action": ["s3:PutObject","s3:PutObjectAcl"],
"Resource": "arn:aws:s3:::examplebucket/*"
}
]
}

You can use a wildcard to grant permission for all Amazon S3 actions.

"Action": "*"

Permissions Related to Bucket Operations

This section provides a list of the permissions related to bucket operations that you can specify in a policy.

Amazon S3 Permissions Related to Bucket Operations

Permission KeywordsAmazon S3 Operation(s) Covered
s3:CreateBucketPUT Bucket
s3:DeleteBucketDELETE Bucket
s3:ListBucketGET Bucket (List Objects), HEAD Bucket
s3:ListBucketVersionsGET Bucket Object versions
s3:ListAllMyBucketsGET Service
s3:ListBucketMultipartUploadsList Multipart Uploads

The following example user policy grants the s3:CreateBucket, s3:ListAllMyBuckets, and the s3:GetBucketLocation permissions to a user. Note that for all these permissions, you set the relative-id part of the Resource ARN to "*". For all other bucket actions, you must specify a bucket name. For more information, see Specifying Resources in a Policy.

{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"statement1",
"Effect":"Allow",
"Action":[
"s3:CreateBucket",
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Resource":[
"arn:aws:s3:::*"
]
}
]
}

If your user is going to use the console to view buckets and see the contents of any of these buckets, the user must have the s3:ListAllMyBuckets and s3:GetBucketLocation permissions. For an example, see "Policy for Console Access" at Writing IAM Policies: How to Grant Access to an S3 Bucket.

Permissions Related to Bucket Subresource Operations

This section provides a list of the permissions related to bucket subresource operations that you can specify in a policy.

Amazon S3 Permissions Related to Bucket Subresource Operations

PermissionsAmazon S3 Operation(s) Covered
s3:DeleteBucketPolicyDELETE Bucket policy
s3:DeleteBucketWebsiteDELETE Bucket website
s3:GetAccelerateConfigurationGET Bucket accelerate
s3:GetAnalyticsConfigurationGET Bucket analytics, List Bucket Analytics Configurations
s3:GetBucketAclGET Bucket acl
s3:GetBucketCORSGET Bucket cors
s3:GetBucketLocationGET Bucket location
s3:GetBucketLoggingGET Bucket logging
s3:GetBucketNotificationGET Bucket notification
s3:GetBucketObjectLockConfigurationGET Bucket Object Lock configuration
s3:GetBucketPolicyGET Bucket policy
s3:GetBucketPolicyStatusGET BucketPolicyStatus
s3:GetBucketPublicAccessBlockGET PublicAccessBlock
s3:GetBucketRequestPaymentGET Bucket requestPayment
s3:GetBucketTaggingGET Bucket tagging
s3:GetBucketVersioningGET Bucket versioning
s3:GetBucketWebsiteGET Bucket website
s3:GetEncryptionConfiguration GET Bucket encryption
s3:GetInventoryConfigurationGET Bucket inventory, List Bucket Inventory Configurations
s3:GetLifecycleConfigurationGET Bucket lifecycle
s3:GetMetricsConfigurationGET Bucket metrics, List Bucket Metrics Configurations
s3:GetReplicationConfigurationGET Bucket replication
s3:PutAccelerateConfigurationPUT Bucket accelerate
s3:PutAnalyticsConfigurationPUT Bucket analytics, DELETE Bucket analytics
s3:PutBucketAclPUT Bucket acl
s3:PutBucketCORSPUT Bucket cors, DELETE Bucket cors
s3:PutBucketLoggingPUT Bucket logging
s3:PutBucketNotificationPUT Bucket notification
s3:PutBucketObjectLockConfigurationPUT Bucket Object Lock configuration
s3:PutBucketPolicyPUT Bucket policy
s3:PutBucketPublicAccessBlockPUT PublicAccessBlock, DELETE PublicAccessBlock
s3:PutBucketRequestPaymentPUT Bucket requestPayment
s3:PutBucketTaggingDELETE Bucket tagging, PUT Bucket tagging
s3:PutBucketVersioningPUT Bucket versioning
s3:PutBucketWebsitePUT Bucket website
s3:PutEncryptionConfigurationPUT Bucket encryption, DELETE Bucket encryption
s3:PutInventoryConfigurationPUT Bucket inventory, DELETE Bucket inventory
s3:PutLifecycleConfigurationPUT Bucket lifecycle, DELETE Bucket lifecycle
s3:PutMetricsConfigurationPUT Bucket metrics, DELETE Bucket metrics
s3:PutReplicationConfigurationPUT Bucket replication, DELETE Bucket replication

The following user policy grants the s3:GetBucketAcl permission on the examplebucket bucket to user Dave.

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::Account-ID:user/Dave"
},
"Action": [
"s3:GetObjectVersion",
"s3:GetBucketAcl"
],
"Resource": "arn:aws:s3:::examplebucket"
}
]
}

You can delete objects either by explicitly calling the DELETE Object API or by configuring its lifecycle (see Object Lifecycle Management) so that Amazon S3 can remove the objects when their lifetime expires. To explicitly block users or accounts from deleting objects, you must explicitly deny them s3:DeleteObject, s3:DeleteObjectVersion, and s3:PutLifecycleConfiguration permissions. By default, users have no permissions. But as you create users, add users to groups, and grant them permissions, it is possible for users to get certain permissions that you did not intend to give. That is where you can use explicit deny, which supersedes all other permissions a user might have and denies the user permissions for specific actions.

Permissions Related to Account Operations

This section provides a list of the permissions related to account operations that you can specify in a policy.

Amazon S3 Permissions Related to Account Operations

Permission KeywordsAmazon S3 Operation(s) Covered
s3:CreateJobCreateJob
s3:DescribeJobDescribeJob
s3:GetAccountPublicAccessBlockGET PublicAccessBlock
s3:ListJobsListJobs
s3:PutAccountPublicAccessBlockPUT PublicAccessBlock, DELETE PublicAccessBlock
s3:UpdateJobPriorityUpdateJobPriority
s3:UpdateJobStatusUpdateJobStatus

The following example user policy grants the s3:GetAccountPublicAccessBlock permission to a user. Note that for these permissions, you set the Resource value to "*". For more information, see Specifying Resources in a Policy.

{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"statement1",
"Effect":"Allow",
"Action":[
"s3:GetAccountPublicAccessBlock"
],
"Resource":[
"*"
]
}
]
}