Securing Access to Amazon S3
This lesson explains how the overlapping S3 access mechanisms combine and which ones to switch off, since S3 holds more sensitive data than any other AWS service and misconfigured buckets remain a common cause of data exposure.
Learning outcomes
After completing this lesson, you will be able to:
- Explain how S3 evaluates IAM, bucket, access point and organisation policies.
- Explain how Block Public Access and Object Ownership switch off risky mechanisms.
- Describe how conditions and access points grant access precisely.
- Identify how Access Analyzer, Macie and Security Hub detect exposed buckets.
How S3 decides
An S3 request is evaluated against the caller's IAM policies, the bucket policy, access point policies, any SCPs and RCPs, VPC endpoint policies and, for legacy buckets, ACLs. Within one account, either an IAM policy or the bucket policy may grant access; across accounts, both must. An explicit deny in any of them wins. If the object is encrypted with SSE-KMS, the KMS key policy must also allow the caller to decrypt.
The following diagram checks four kinds of upload against a bucket policy that enforces a team's own KMS key.

How S3 authorises a request
Switching off risky mechanisms
Several S3 settings switch off mechanisms that commonly expose data by mistake. S3 Block Public Access, at account and bucket level, overrides any bucket policy or ACL that would grant public access. Enabling it at account level everywhere, and protecting that setting with an SCP, prevents accidental exposure. Object Ownership set to bucket owner enforced disables ACLs entirely and makes the bucket owner own every object, so access is governed only by policies. It is the default for new buckets and should be used everywhere.
Default encryption encrypts every new object, with SSE-S3 unless configured otherwise; SSE-KMS is used where key control or an audit trail of decryption is needed. Versioning and Object Lock protect important and regulated data against deletion and overwriting. The following table summarises the settings.
| Setting | Effect | Recommendation |
|---|---|---|
| S3 Block Public Access (account and bucket) | Overrides policies and ACLs that would grant public access | Enable at account level everywhere; protect with an SCP |
| Object Ownership: bucket owner enforced | Disables ACLs; the bucket owner owns every object | Default for new buckets; use everywhere |
| Default encryption | Encrypts every new object (SSE-S3 by default) | Use SSE-KMS where key control or audit is needed |
| Versioning and Object Lock | Protect against deletion and overwrite | For important and regulated data |
S3 settings that reduce risk
Granting access precisely
Access to S3 data can be granted precisely by several mechanisms. The following list describes them.
- Bucket policies with conditions:
aws:PrincipalOrgID,aws:SourceVpce,aws:SecureTransport,s3:x-amz-server-side-encryption-aws-kms-key-id. - Access points give each application its own policy and optional VPC restriction.
- Presigned URLs grant temporary access to one object with the signer's permissions; keep expiry short and use roles with narrow permissions to sign.
- S3 Access Grants map directory identities to prefixes for large numbers of users.
- Origin access control lets CloudFront, and only CloudFront, read a private bucket.
Granting S3 access precisely
Detecting exposure
IAM Access Analyzer reports buckets shared outside the zone of trust; Macie policy findings flag public, unencrypted or externally shared buckets; Security Hub controls such as S3.8 check Block Public Access; CloudTrail data events record who read which object.
Detecting S3 exposure
A bucket that accepts only correctly encrypted uploads
A bucket must hold only objects encrypted with the team's own KMS key, so data written with the default SSE-S3 or another key is rejected:
{
"Version": "2012-10-17",
"Statement": [
{ "Sid": "RequireOurKmsKey", "Effect": "Deny", "Principal": "*", "Action": "s3:PutObject",
"Resource": "arn:aws:s3:::acme-finance/*",
"Condition": { "StringNotEqualsIfExists": {
"s3:x-amz-server-side-encryption-aws-kms-key-id":
"arn:aws:kms:eu-west-1:111111111111:key/1234abcd-12ab-34cd-56ef-1234567890ab" } } },
{ "Sid": "RequireKms", "Effect": "Deny", "Principal": "*", "Action": "s3:PutObject",
"Resource": "arn:aws:s3:::acme-finance/*",
"Condition": { "StringNotEqualsIfExists": { "s3:x-amz-server-side-encryption": "aws:kms" } } }
]
}With default bucket encryption set to the same key, clients that send no encryption header still comply (the IfExists operators let them through and S3 applies the default), while clients that request a different key or algorithm are refused. Bucket Keys reduce the number of KMS calls, and therefore cost, for high-volume buckets.
How are ACLs disabled on a bucket?
Show answer
By setting Object Ownership to bucket owner enforced.
Exam Tips
Remember for the exam
- Enable S3 Block Public Access at the account level and protect it with an SCP.
- Disable ACLs with Object Ownership set to bucket owner enforced.
- Cross-account access requires both the caller's IAM policy and the bucket policy, plus the KMS key policy for SSE-KMS objects.
- To require a specific KMS key, deny PutObject unless s3:x-amz-server-side-encryption-aws-kms-key-id matches.
- Presigned URLs carry the signer's permissions; sign with narrowly scoped roles and short expiry.
- To find buckets shared outside the organisation, use IAM Access Analyzer.