How to share one folder in an S3 bucket (not the whole bucket)
By Aleem Rehmtulla, May Inc.
TL;DR
An S3 folder is a key prefix ending in a slash, and neither the AWS S3 console nor the Cloudflare R2 dashboard can share one with a person: AWS can only restrict an IAM identity to a prefix, and R2 tokens stop at the bucket. To give a colleague or client one folder without creating IAM users, connect the bucket to S3 Viewer once, invite them by email, and on the Access step switch the bucket from Whole bucket to Specific folders and add the folder, such as landing/. They see only that folder, nothing else in the bucket is listed or openable, and you change or remove the access later under Settings, Members without rotating any keys.
Steps
Step-by-step.
- 01
Connect the bucket's server once
Click Add server in the sidebar and paste one least-privilege credential for the S3 or R2 endpoint, typically withs3:ListBucket,s3:GetObject,s3:PutObjectands3:DeleteObjecton the buckets you want to expose. This is the only key anyone creates; the people you invite sign in to S3 Viewer, not to AWS or Cloudflare. - 02
Open Settings, Members and add the people
Click Invite people, type up to five email addresses, and tick the server (or servers) they should see. One send can cover several people and several servers; each person gets one email, and the invite is valid for seven days. - 03
On the Access step, switch the bucket to Specific folders
Pick a role, Viewer (browse and download) or Editor (also upload, rename and delete). Then, next to the bucket, change Whole bucket to Specific folders and add the prefixes they should reach, such aslanding/orreports/2026/. A folder is a key prefix ending in/. It does not have to exist yet, a parent folder covers everything under it, and you can list up to 20 folders per bucket. Only Viewers and Editors can be limited this way; an Admin always gets the whole bucket.landing/ reports/2026/ - 04
Review and send
The last step shows each person, each server, the role and the folders before anything is sent. If you are an Admin rather than the Owner, you can only share folders you can open yourself. The recipient accepts the invite, signs in, and the bucket appears in their sidebar showing only the folders that lead to what they were given. - 05
Change or remove the access later
Under Settings, Members you can add or drop folders, widen the limit back to the whole bucket, change the role, or remove the person. The change applies on their next request. No key is rotated, because they never held one. - 06
If you must do it in AWS instead
Use this when the limit has to hold for a program, a service, or anyone who will use their own access keys. Create an IAM user or role for them and attach a policy with two statements: object actions on the prefix wildcard, ands3:ListBucketon the bucket itself with aConditionons3:prefix. The listing condition is the part most first attempts miss. You then hand over access keys, and off-boarding means deleting the user and rotating anything they touched. On Cloudflare R2, a standard API token can be scoped to a bucket but not to a folder; prefix limits exist only on temporary credentials minted through the API.{ "Version": "2012-10-17", "Statement": [ { "Sid": "ObjectsInsideFolder", "Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject"], "Resource": "arn:aws:s3:::my-bucket/reports/*" }, { "Sid": "ListOnlyThatFolder", "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::my-bucket", "Condition": { "StringLike": { "s3:prefix": ["reports/*"] } } } ] }
Under the hood
What's actually happening.
S3 stores a flat list of keys. What looks like a folder is every key that starts with the same prefix, and a listing with Delimiter=/ collapses those shared prefixes into folder rows. Because there is no directory object, there is nothing to attach a share to. AWS answers this with IAM: a policy can allow s3:GetObject on bucket/reports/* and s3:ListBucket with an s3:prefix condition, but only for an IAM user, role or federated identity, so every person needs an identity, a key and an off-boarding step. Presigned URLs share one object for a limited time, not a folder. Cloudflare R2 scopes standard tokens to buckets, and its prefix-restricted temporary credentials are minted through the API for programs rather than handed out from the dashboard. Both are the right tools for services. The gap is a colleague, a client or a contractor who needs one folder and a browser.
S3 Viewer fills that gap in front of the bucket. The bucket is connected once with a server-level credential, and each invited person has a role plus, for Viewers and Editors, an optional list of up to 20 folders per bucket. Every request is checked on S3 Viewer's server before it is signed: a listing is only run under an allowed prefix, the parent folders that lead there are shown so the person can navigate, and an object outside the allowed folders cannot be read, written, listed, copied or moved, on either end of a copy. A folder is recorded as a prefix, so it does not need to exist first, and a parent covers every child under it.
The limit lives in S3 Viewer, not in your provider. The stored credential still reaches the whole bucket, and members never see it, which is why changing or removing someone under Settings, Members takes effect on their next request with no key rotation. It also means the limit covers the browser, not programs with their own keys; when it has to hold there too, pair it with the IAM policy above. The same model works for Cloudflare R2 and any other S3-compatible provider.
FAQ
Common questions.
Can I share just one folder of an S3 bucket?
Does S3 have real folders?
Can I give someone access to a folder without an IAM user?
Can Cloudflare R2 tokens be limited to a folder?
What happens if the folder does not exist yet?
Can an Admin be limited to a folder?
Does the person see the rest of the bucket?
How do I remove their access later?
Use S3 Viewer for this
Skip the CLI. Try it in the browser.
S3 Viewer turns the steps above into a single click. Open source, self-hostable, free.
Use case
Why teams pick this
Related guides
More how-tos
Invite a teammate
Skip per-person IAM users for human collaboration. Email invite, per-bucket role, optional folder limit, one-click revoke.
Granular permissions
The IAM s3:prefix Condition that everyone misses, plus folder-limited roles for when IAM is more than you need.
Share an S3 file
Copy link for a 15-minute presigned URL, or an email invite for ongoing access — when each is the right call.