AWS Builder Center

AWS S3 Bucket Policies Explained: A Beginner’s Hands-On Guide

Learn how Amazon S3 bucket policies work through a practical beginner-friendly example. This guide explains IAM permissions, bucket policies, ARNs, object access, AccessDenied errors, and how to troubleshoot common S3 permission issues.

AWS S3 Bucket Policies Explained: A Beginner’s Hands-On Guide

Amazon S3 is one of the most widely used AWS services for storing and managing data. However, understanding who can access an S3 bucket and what they can do can be confusing when you are starting with AWS.
In this article, we will understand S3 bucket policies through a practical approach.

What Is an S3 Bucket Policy?

An S3 bucket policy is a resource-based policy that defines who can access a bucket or the objects inside it and what actions they are allowed to perform.
For example, we can create a policy that allows a specific IAM user to download objects from a particular bucket.

IAM Policy vs S3 Bucket Policy

There are two important concepts to understand:
  • IAM policy — attached to an IAM identity such as a user, group, or role.
  • Bucket policy — attached directly to an S3 bucket.
Both can control access to S3 resources.

Understanding the S3 ARN

Suppose our bucket is:
my-production-bucket

The bucket ARN is:
arn:aws:s3:::my-production-bucket

If we want to refer to objects inside the bucket, we use:
arn:aws:s3:::my-production-bucket/*

The  /*  means all objects inside the bucket.
For example:
arn:aws:s3:::my-production-bucket/index.html

refers to one specific object.

Example: Allow Download Access

Suppose we want an IAM user to download objects from our production bucket.
The policy can look like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:user/S3DownloadUser"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-production-bucket/*"
}
]
}

Here:
  •  Effect: Allow  allows the requested action.
  •  Principal  identifies who receives the permission.
  •  Action: s3:GetObject  allows downloading/reading objects.
  •  Resource  specifies which objects the user can access.

Why Do We Use  s3:GetObject ?

S3 permissions are action-specific.
For example:
s3:GetObject

allows an object to be read/downloaded.
But it does not automatically allow:
s3:PutObject

which is used to upload objects.
This is important when following the principle of least privilege.
If a user only needs to download files, we should avoid giving unnecessary upload or delete permissions.

Bucket ARN vs Object ARN

One common beginner mistake is using the wrong ARN.
For bucket-level actions, we may use:
arn:aws:s3:::my-production-bucket

For object-level actions such as  s3:GetObject , we generally specify the objects:
arn:aws:s3:::my-production-bucket/*

Think of it this way:
Bucket
└── Objects
├── file1.txt
├── file2.jpg
└── index.html

The bucket ARN identifies the bucket.
The object ARN identifies objects inside the bucket.

Troubleshooting AccessDenied

One of the most useful practical exercises is intentionally creating an  AccessDenied  error.
For example, if the user has:
s3:GetObject

but attempts to upload a file, AWS can deny the request because:
s3:PutObject

was not granted.
This teaches an important lesson:
AWS permissions are action-specific.
When troubleshooting an S3 permission error, check:
  1. Which IAM identity is making the request?
  1. What action is being performed?
  1. Which resource is being accessed?
  1. Does the IAM policy allow the action?
  1. Does the bucket policy allow or deny it?
  1. Is there an explicit  Deny ?
  1. Are there other controls affecting access?

Principle of Least Privilege

When creating AWS permissions, give users only the permissions they actually need.
For example, if a user only needs to download files:
s3:GetObject

may be sufficient for object access.
Avoid automatically giving broad permissions such as full S3 administration when they are not required.

Conclusion

Understanding S3 permissions becomes much easier when you practice them instead of only reading about them.
Start with a simple task:
Create an IAM user → create an S3 bucket → allow only object downloads → test access → intentionally cause AccessDenied → troubleshoot the permission.
This practical approach helps build a strong foundation for working with AWS IAM and S3 in real-world environments.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article