Skip to main content
Last updated on

Bucket Policy

A Bucket Policy is a JSON-based set of access control rules that defines who can perform what actions on which resources in a bucket. It is a more powerful security mechanism than the simple Private/Public mode.

Access the Bucket Policy

Step 1: Go to Simple Storage → Buckets, then click the name of the bucket you want to configure.

Step 2: Open the Bucket Policy tab in the bucket management section.

Bucket Policy Tab - JSON Editor

Step 3: The page shows a JSON editor for the policy. Click Apply templates to browse available policy templates.

Bucket Policy Templates Dropdown

Policy JSON Structure

An S3-standard Bucket Policy has the following structure:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement identifier (optional)",
"Effect": "Allow | Deny",
"Principal": "*",
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::bucket-name/*"]
}
]
}

Key fields:

FieldDescription
VersionPolicy version — always use "2012-10-17"
StatementArray of policy statements
SidStatement identifier (optional, for easier management)
EffectAllow or Deny
PrincipalTarget subject: "*" = everyone, or specify a user/account
ActionList of S3 actions to allow or deny
ResourceARN of the bucket or object the policy applies to

Common S3 Actions

ActionDescription
s3:GetObjectRead/download an object
s3:PutObjectUpload a new object
s3:DeleteObjectDelete an object
s3:ListBucketList objects in a bucket
s3:GetBucketPolicyRead the bucket's policy
s3:PutBucketPolicyWrite a new policy for the bucket
s3:GetBucketCorsRead the CORS configuration
s3:*All S3 actions

Commonly Used Policy Examples

1. Allow public read (Static Website / CDN)

Allow everyone to read all objects in the bucket:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}

2. Allow read from a specific folder only

Allow public read only for files in the public/ folder:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadPublicFolder",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name/public/*"
}
]
}

3. Deny object deletion (data protection)

Prevent everyone (including the owner) from deleting objects in the bucket:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyDeleteObject",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:DeleteObject",
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}

4. Allow upload from a specific IP address

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUploadFromIP",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::bucket-name/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": "203.0.113.10/32"
}
}
}
]
}

Apply a Policy

Step 1: Paste or edit the JSON policy in the editor.

Step 2: Click Save or Apply to save and apply the policy.

Step 3: The system validates the JSON syntax and applies it immediately.

If the JSON has syntax errors, the portal shows an error message and does not save the policy.

Delete a Policy

To remove the entire policy and return the bucket to its default state, clear all content in the editor and click Save. The bucket then operates with the Access Policy (Private/Public) set at creation time.

A policy with "Effect": "Deny" always takes priority over "Effect": "Allow", even when the bucket is in Public mode. Check carefully before applying a Deny policy to avoid locking yourself out.