S3

Summary: Amazon S3 (Simple Storage Service) is object storage for files of any size, organized into globally-namespaced buckets. It’s the backbone for backups, static hosting, data lakes, and software delivery on AWS, and shows up constantly on the exam for its security model, storage classes, and versioning/replication behavior.

Key Concepts

Use Cases

  • Backup and storage, disaster recovery, archive, hybrid cloud storage
  • Application hosting, static website hosting
  • Data lakes and big data analytics, software delivery

Buckets

  • S3 stores objects (files) in buckets, which act like top-level containers.
  • Buckets are defined at the region level - S3 looks like a global service, but every bucket physically lives in one region.
  • Naming is a shared global namespace: a bucket name must be unique across all AWS accounts and regions, not just your own.

Objects & Keys

An object’s key is its full path within the bucket - there’s no real concept of folders, even though the console UI displays them that way.

s3://my-bucket/my_folder1/another_folder/my_file.txt
              └────────────────── key ──────────────────┘
              └────── prefix ──────┘└── object name ──┘
  • my-bucket - the bucket
  • my_folder1/another_folder/my_file.txt - the key (everything after the bucket name)
  • my_folder1/another_folder/ - the prefix
  • my_file.txt - the object name

Objects also carry:

  • Value - the actual file content (max object size 50 TB; uploads over 5 GB must use multi-part upload)
  • Metadata - system or user-defined key/value text pairs
  • Tags - up to 10 Unicode key/value pairs, useful for security and lifecycle rules
  • Version ID - present if versioning is enabled on the bucket

Security

Access to S3 is controlled two ways:

  • User-based - IAM policies define which API calls a given IAM user can make.
  • Resource-based - Bucket policies (JSON, set from the S3 console, support cross-account access) and Object/Bucket ACLs (finer-grained, less common, can be disabled).

A principal is the identity making the request - an IAM user, role, or AWS account. An IAM principal can access an S3 object if either the principal’s own IAM permissions allow it or the resource policy (bucket policy) allows it - only one path needs to grant access - and there is no explicit Deny anywhere, since an explicit Deny always overrides any Allow.

Objects can also be encrypted using encryption keys - see KMS.

S3 Bucket Policies

JSON-based policies attached to a bucket, made up of:

  • Resources - buckets and objects
  • Effect - Allow/Deny
  • Actions - the set of API calls to allow or deny
  • Principal - the account or user the policy applies to

Common uses: grant public access to a bucket, force objects to be encrypted on upload, or grant cross-account access.

Example bucket policy JSON granting public s3:GetObject access

Access pattern examples:

  • Public access → bucket policy Anonymous website visitor reaching an S3 bucket because the bucket policy allows public access
  • IAM user access → IAM permissions IAM user accessing an S3 bucket, gated by their attached IAM policy
  • EC2 instance access → IAM role attached to the instance EC2 instance accessing an S3 bucket via permissions granted through its attached instance role
  • Cross-account access → bucket policy IAM user from another AWS account accessing an S3 bucket because the bucket policy allows cross-account access

Block Public Access

S3 Block Public Access settings: block via new ACLs, any ACLs, new bucket/access point policies, and any bucket/access point policies

  • Created to prevent accidental data leaks.
  • If a bucket should never be public, leave these settings on.
  • Can also be set at the account level if none of your buckets should ever be public.

Static Website Hosting

  • S3 can serve a bucket’s contents as a static website directly over the internet.
  • URL format depends on region: http://bucket-name.s3-website-aws-region.amazonaws.com
  • A 403 Forbidden error usually means the bucket policy doesn’t allow public reads.

S3 website hosting vs. CloudFront

S3 website endpoints don’t support HTTPS or custom domains with a certificate. Plain S3 hosting is fine for quick, low-traffic, or dev sites, but production sites typically put CloudFront in front of the bucket for HTTPS, a custom domain, edge caching (lower latency globally), DDoS protection, and the ability to keep the bucket itself private. On the exam, “needs HTTPS” on a static site question is a strong signal the answer involves CloudFront.

Versioning

  • Enabled at the bucket level; versions files so the same key gets version 1, 2, 3, etc. on overwrite.
  • Best practice to enable - protects against unintended deletes (can restore a prior version) and enables easy rollback.
  • Files uploaded before versioning was enabled get version null.
  • Suspending versioning does not delete previously stored versions.

Replication (CRR & SRR)

  • Requires versioning enabled on both source and destination buckets.
  • Cross-Region Replication (CRR) - compliance, lower-latency access, replication across accounts.
  • Same-Region Replication (SRR) - log aggregation, live replication between production and test accounts.
  • Source and destination can be in different AWS accounts; copying is asynchronous and requires the right IAM permissions.

Replication gotchas

  • Only new objects replicate after replication is enabled - existing objects need S3 Batch Replication (which also retries failed replications).
  • Delete markers replicate only if that optional setting is on; deletions with a version ID never replicate, to prevent malicious deletes.
  • Replication does not chain - if bucket 1 replicates to bucket 2, and bucket 2 replicates to bucket 3, objects created in bucket 1 do not reach bucket 3.

Lifecycle Rules

Automates moving or removing objects as they age, based on transition and expiration actions. Rules can target a prefix (e.g. s3://mybucket/mp3/*) or object tags (e.g. Department: Finance).

  • Transition actions - move objects to a cheaper class after N days (e.g. Standard → Standard-IA after 60 days, → Glacier after 6 months).
  • Expiration actions - delete objects after N days (e.g. expire access logs after 365 days, delete old versions once versioning is enabled, or clean up incomplete multi-part uploads).

Worked scenarios

  • Thumbnails scenario: source images need instant access for 60 days then can tolerate a 6-hour wait; thumbnails are cheap to recreate and only kept 60 days. → Keep source images on Standard with a lifecycle rule to transition to Glacier after 60 days; put thumbnails on One Zone-IA with a lifecycle rule to expire (delete) them after 60 days.
  • Deleted-object recovery scenario: deleted objects must be recoverable instantly for 30 days, then within 48 hours for up to 365 days. → Enable versioning so deletes become a hidden delete marker (recoverable immediately); transition noncurrent versions to Standard-IA, then to Glacier Deep Archive.

Storage Class Analysis

  • Analyzes access patterns and recommends when to transition objects between Standard and Standard-IA (does not support One Zone-IA or Glacier).
  • Report updates daily; takes 24-48 hours to start producing data.
  • Good first step before writing or tuning lifecycle rules.

S3 Event Notifications

Notifications fire when specified events happen in a bucket (e.g. s3:ObjectCreated, s3:ObjectRemoved), letting other services react without polling.

  • Delivered typically within seconds, occasionally up to a minute or more.
  • Can send to SNS, SQS, or Lambda directly - each requires the destination to grant S3 permission via its own resource policy (SNS/SQS resource policy, Lambda resource policy).
  • All events also flow into Amazon EventBridge, which unlocks advanced JSON filtering (by metadata, object size, name, etc.), multiple destinations (e.g. Step Functions, Kinesis Data Streams/Firehose) across 20+ target services, and EventBridge features like archive, replay, and reliable delivery.

S3 Performance

  • S3 auto-scales to high request rates at ~100-200ms latency.
  • Baseline per prefix in a bucket: 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests/second - no limit on the number of prefixes, so spreading keys across prefixes scales throughput.
  • Multi-part upload - recommended above 100 MB, required above 5 GB; parallelizes the upload to speed up transfers.
  • S3 Transfer Acceleration - routes uploads through the nearest AWS edge location to the target-region bucket for faster transfers; compatible with multi-part upload.
  • S3 Byte-Range Fetches - request a specific byte range of an object to parallelize GETs, improve failure resilience, speed up downloads, or fetch only part of a file (e.g. just the header).

S3 Metadata & Tags

  • User-defined metadata - key-value pairs attached at upload time; keys must be prefixed x-amz-meta- and are stored lowercase; returned when the object is retrieved.
  • Object tags - up to 10 key-value pairs per object, useful for fine-grained permissions (tag-scoped access) and analytics (grouping via Storage Class Analysis).
  • Neither metadata nor tags are searchable within S3 - for search, index them externally (e.g. in DynamoDB).

Storage Classes

ClassNotes
S3 StandardGeneral purpose
S3 Standard-IAInfrequent Access
S3 One Zone-IAInfrequent Access, single AZ
S3 Glacier Instant RetrievalArchive, millisecond access
S3 Glacier Flexible RetrievalArchive, minutes to hours
S3 Glacier Deep ArchiveArchive, cheapest, hours
S3 Intelligent-TieringAutomatic tiering

Objects can move between classes manually or via S3 lifecycle configurations.

  • Durability: 11 9’s (99.999999999%) across multiple AZs - the same for every storage class.
  • Availability: how readily a service responds when needed - this does vary by class.

General Purpose - 99.99% availability, low latency/high throughput, sustains 2 concurrent facility failures. Use cases: big data analytics, mobile/gaming apps, content distribution.

Infrequent Access - cheaper than Standard, for data accessed rarely but needed quickly when it is:

  • Standard-IA - 99.9% availability. Use cases: disaster recovery, backups.
  • One Zone-IA - single AZ (data is lost if that AZ is destroyed), 99.5% availability. Use cases: secondary backup copies of on-prem data, or data you can recreate.

Glacier (low-cost archive/backup; you pay storage + retrieval cost):

  • Instant Retrieval - millisecond retrieval, good for data accessed ~once a quarter. Min storage duration 90 days.
  • Flexible Retrieval - Expedited (1-5 min), Standard (3-5 hrs), Bulk (5-12 hrs, free). Min storage duration 90 days.
  • Deep Archive - long-term storage. Standard (12 hrs), Bulk (48 hrs). Min storage duration 180 days.

Intelligent-Tiering - small monthly monitoring/tiering fee, no retrieval charges, auto-moves objects between tiers based on usage:

  • Frequent Access (default) → Infrequent Access (30 days unused) → Archive Instant Access (90 days unused, automatic)
  • Archive Access (optional, configurable 90-700+ days) and Deep Archive Access (optional, configurable 180-700+ days)

Storage class comparison table: durability, availability, availability SLA, AZ count, minimum storage duration, minimum billable object size, and retrieval fee per class

Standard-IA availability

Standard-IA availability is 99.9%, not 99.99% - easy to misremember since it’s one 9 lower than S3 Standard. One Zone-IA drops further to 99.5%.

Configuration & Limits

  • Max object size: 50 TB. Multi-part upload recommended above 100 MB, required above 5 GB.
  • Up to 10 tags per object.
  • Durability is 11 9’s for every storage class; availability varies (see table above).
  • Glacier minimum storage durations: 90 days (Instant/Flexible Retrieval), 180 days (Deep Archive) - deleting early still incurs the full minimum charge.
  • Baseline request rate: 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests/second per prefix - no limit on the number of prefixes.
  • Storage Class Analysis: 24-48 hours to start producing data; recommends between Standard and Standard-IA only.

Exam Tips & Gotchas

Frequently confused

  • IAM policy vs. bucket policy: IAM policies are attached to a user/role (user-based); bucket policies are attached to the bucket itself (resource-based) and are the only way to grant cross-account access without the other account assuming a role.
  • Access requires (IAM allows or bucket policy allows) and no explicit Deny.
  • Versioning must be enabled on both source and destination buckets before replication works.
  • Replication is one-hop only - it never chains across a third bucket.
  • Storage Class Analysis doesn’t cover One Zone-IA or Glacier - don’t expect its recommendations there.
  • Metadata and tags are never searchable in S3 itself - a “find objects by tag” question implies an external index like DynamoDB.

Integrations

  • CloudFront - adds HTTPS, custom domains, and edge caching in front of an S3 static website or bucket.
  • IAM - user policies and roles (e.g. EC2 instance roles) govern who/what can call S3 APIs.
  • KMS - provides the encryption keys used to encrypt objects at rest.
  • EventBridge - receives every S3 event notification, enabling advanced filtering and fan-out to 20+ target services.
  • SNS / SQS / Lambda - direct targets for S3 event notifications; each requires a resource policy granting S3 permission to invoke it.
  • DynamoDB - common external index for making S3 object metadata/tags searchable.

Review Questions