Access control
How IAM policies, bucket policies and Block public access decide who may read and write a bucket, and where to see who can.
Every request, through the console, the API or an S3 client, acts as an IAM user or service account and is checked against that account's IAM policies. The bucket policy and Block public access can widen or narrow it. A temporary key, and a legacy limited key, can only narrow it.
IAM policies
Grant actions on bucket and object resources. Object storage is regionless, so the region segment is empty:
| Resource | Covers |
|---|---|
rn:ews::<org>:s3:bucket/<name> |
the bucket itself |
rn:ews::<org>:s3:bucket/<name>/object/* |
every object in the bucket |
rn:ews::<org>:s3:bucket/<name>/object/public/* |
objects whose key starts with public/ |
Read-only access to one prefix:
{
"Version": "2024-01-01",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject"],
"Resource": "rn:ews::org-EXAMPLE1234:s3:bucket/example-uploads/object/public/*"
}
]
}The actions are listed in Security.
Access keys and temporary keys
An access key carries no permissions of its own: it can do what its account's policies allow. To give a script one bucket, give it a service account whose policy allows that bucket; the bucket's Create access key does this in one step. A temporary key for a bucket acts as you, narrowed to that bucket by a session policy, and expires on its own. See Give access to one bucket.
Keys made before keys stopped carrying a limit keep it: a legacy limited key does only what both
its account's policies and its limit allow, a bucket policy does not widen it, and a Deny in it
always wins.
See who can reach a bucket
The bucket's Access tab lists the users, service accounts and roles whose policies, or the
bucket policy, let them list, read or write the bucket, with the policy that allows it, how the
policy reaches them (directly, through a group or through a role), and whether it allows every
bucket or this one. It also lists the bucket's legacy limited keys and whether each works, and one
line each for temporary credentials alive now, public access, the website and the bucket policy.
dcloud s3 buckets access <bucket> and GET /s3/api/buckets/{name}/access answer the same. Public
access and the bucket policy are set on the Public access tab.
Bucket policies
A bucket policy is a resource policy in AWS's grammar. It can make objects public (see Make objects public) or share them with another organization or user (see Share a bucket with another organization).
| Field | Accepted |
|---|---|
Principal |
"*" or {"AWS": "*"}: anyone, with or without a key; or {"EWS": [...]} naming organizations and users (up to 100). * and names do not mix |
Effect |
Allow, Deny. A Deny applies to everyone its Principal covers, your own keys included |
Action |
S3 action names: s3:GetObject, s3:PutObject, s3:DeleteObject, s3:*, …; s3:ListBucket is read as s3:ListObjects |
Resource |
arn:aws:s3:::<bucket> or arn:aws:s3:::<bucket>/<key pattern>, or the rn:ews: form; only the policy's own bucket |
Condition |
IpAddress / NotIpAddress on aws:SourceIp; the Date… operators on aws:CurrentTime; Bool, StringEquals, StringNotEquals, StringLike, StringNotLike |
A named principal is an organization id (or arn:aws:iam::<org id>:root) or an IAM user
(rn:ews::<org>:iam:user/<id>); {"AWS": [...]} is accepted for the same list. A name that does
not exist is refused with Invalid principal in policy: ….
NotPrincipal, NotAction and NotResource are refused. A policy is at most 20 KB.
How it combines with IAM:
- Users of your own organization are allowed when either their IAM policies or the bucket policy
allows. A
Denyin either always wins. - A request from another organization is allowed only when both your bucket policy and the caller's own IAM policies allow it.
- Only your organization can change a bucket's configuration (policy, Block public access,
website, CORS, replication, encryption, versioning, lifecycle); a bucket policy never grants
that, even with
s3:*: such a request answersAccessDenied.
Block public access
| Flag | API field | Effect |
|---|---|---|
BlockPublicPolicy |
blockPublicPolicy |
A policy that would make the bucket public is refused |
RestrictPublicBuckets |
restrictPublicBuckets |
The public statements of the policy are ignored for anyone outside your organization |
BlockPublicAcls |
blockPublicAcls |
Stored for S3 tools. There are no ACLs; a public ACL on an upload is refused anyway |
IgnorePublicAcls |
ignorePublicAcls |
Stored for S3 tools |
All four are on for every new bucket. The bucket is public when its policy grants the public and Block public access does not stop it.
Buckets the platform writes
A database's backup bucket (rds-<database id>) and a Kafka cluster's tiered-storage bucket can
be read and downloaded by your organization; writes are refused with AccessDenied "This bucket is managed by the platform and is read-only",
and its access settings cannot be changed.