D1 · Secure architectures

S3 security

is the most widely used storage service on AWS and one of the most targeted when misconfigured. The SAA-C03 exam tests your ability to protect data in S3 with the correct mechanism for each scenario.

Icon-Architecture/48/Arch_Amazon-Simple-Storage-Service_48

Access control in S3

S3 has multiple access control layers that work together. Block Public Access is the first line of defense — enabled by default on all new accounts.

MechanismApplies toRecommended use
Block Public AccessAccount or bucketAlways ON in production. Prevents accidental public access.
Bucket Policy (resource-based)Bucket and objectsCross-account access, CloudFront OAC, policies conditioned on IP/VPC.
Identity PolicyIAM user/roleAccess for identities within the same AWS account.
S3 ACLsIndividual bucket or objectLegacy — only use if you need per-object permissions. AWS recommends disabling them.
VPC Endpoint PolicyAccess from a VPCRestriction: only certain buckets are accessible from a specific VPC.
Icon-Architecture/48/Arch_Amazon-Simple-Storage-Service_48

Bucket policies and ACLs

Common bucket policy scenarios

Cross-account access

Account B accesses a bucket in Account A. Resource policy in Account A + IAM policy in Account B.

"Principal": {"AWS": "arn:aws:iam::ACCOUNT-B:root"}

IP-based restriction

Only allow access from corporate IP ranges.

"Condition": {"IpAddress": {"aws:SourceIp": "203.0.113.0/24"}}

Deny HTTP (HTTPS only)

Force encryption in transit by denying non-secure requests.

"Condition": {"Bool": {"aws:SecureTransport": "false"}} → Deny

VPC-based restriction

Only allow access from a specific VPC (via VPC Endpoint).

"Condition": {"StringEquals": {"aws:sourceVpc": "vpc-xxxxx"}}

ACLs — when (not) to use them

AWS recommends disabling ACLs

ACLs are S3's legacy access mechanism. The recommended new configuration is Bucket Owner Enforced (disables ACLs). Every newly created bucket should rely only on bucket policies.

Make an object public

✅ Bucket policy or CloudFront

❌ Object ACL public-read

Cross-account access

✅ Cross-account bucket policy

❌ Bucket ACL grantee

Icon-Architecture/48/Arch_Amazon-Simple-Storage-Service_48

Encryption in S3

SSE-S3 (Server-Side Encryption with S3-managed keys)

AWS manages keys automatically. AES-256. No extra cost. No per-access key traceability.

EXAM: Default since 2023 on all new buckets. Less control, simpler.

SSE-KMS (Server-Side Encryption with KMS keys)

manages the keys. Every access to an object generates an API call to KMS — traceable in CloudTrail.

EXAM: When the requirement says "audit who accessed which data" — SSE-KMS is the answer.

SSE-C (Server-Side Encryption with customer-provided keys)

The client provides the key on each request. AWS uses it to encrypt/decrypt and discards it. You keep the key.

EXAM: Rare on the exam. Mainly for compliance where the company does NOT want AWS to hold any key.

Client-Side Encryption

The client encrypts before uploading to S3. S3 stores already-encrypted data. AWS never sees the plaintext.

EXAM: Maximum security. Useful when you don't trust AWS with any part of encryption.

Encryption in transit

S3 supports HTTPS (TLS) to encrypt data in transit. To enforce it, use a bucket policy withaws:SecureTransport: false → Deny. This denies any unencrypted HTTP request to the bucket.

Icon-Architecture/48/Arch_Amazon-Simple-Storage-Service_48

Presigned URLs and temporary access

A Presigned URL is a URL that includes temporary signed credentials. It lets any user (without an AWS account) access a private S3 object for a limited time.

How it works

1

Your application generates a Presigned URL with the AWS SDK

2

The URL includes: bucket, object, action, expiration and cryptographic signature

3

The user accesses the object in S3 directly using that URL

4

S3 verifies the signature and the expiration time

5

Once expired → access is automatically denied

Exam use cases

  • →Sharing a private video with a client for 24 hours
  • →Letting a user upload a file directly to S3 without going through your backend
  • →Downloading a dynamically generated report without making it public

Exam trap

The Presigned URL inherits the permissions of the user/role that generated it. If the role no longer has access to the object when the URL is used, access is denied.

Icon-Architecture/48/Arch_Amazon-Simple-Storage-Service_48

Object Lock and Versioning

S3 Versioning

Keeps multiple versions of an object. Enable it before Object Lock. A "deleted" object actually receives a Delete Marker — previous versions still exist.

  • •MFA Delete: requires an MFA code to permanently delete versions
  • •Data recovery: restore a previous version in seconds
  • •Ransomware protection: encrypted versions coexist with clean versions

S3 Object Lock (WORM)

Write Once Read Many — nobody can modify or delete objects during the retention period. For regulatory compliance (HIPAA, SEC, FINRA).

Governance Mode

Admins with special permissions can override the retention. For internal use.

Compliance Mode

NOBODY can delete the object during retention, not even the account root. For strict regulations.

Icon-Architecture/48/Arch_Amazon-Simple-Storage-Service_48

+ OAC for private S3

The most secure pattern for serving content from S3 is keeping the bucket fully private and using CloudFront as the only access point with Origin Access Control (OAC).

Request flow

User→CloudFront Edge→OAC (signs the request)→S3 Bucket (private)→Object returned

Bucket policy configuration

Only CloudFront (service principal) can do GetObject:

"Principal": {
  "Service": "cloudfront.amazonaws.com"
},
"Condition": {
  "StringEquals": {
    "AWS:SourceArn": "arn:aws:cloudfront::ACCOUNT:distribution/ID"
  }
}

OAC vs OAI (legacy)

OAC (recommended)

Supports SSE-KMS, additional HTTP methods, all regions

OAI (legacy)

Only SSE-S3, GET/HEAD. Migrate to OAC.

Did you get this topic?

Test what you just learned

A company stores financial records in S3 that must be retained for exactly 7 years with no possibility of deletion by anyone, not even the account administrator. Which S3 configuration meets this requirement?

Ready to test "Security in S3"?

Put what you learned to the test with original SAA-C03 exam questions.

Start SAA-C03 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.