Amazon S3 is one of the most widely used AWS services, and also one of the easiest to misconfigure. Teams often start with default settings, then discover months later that they are paying to keep rarely accessed data in a frequently accessed storage class, or that a bucket is more exposed than intended.
This post covers how S3 works, how to choose the right storage class, how to secure your data, and how to manage object retention and cost through versioning and lifecycle policies. It follows a WHAT, WHERE, WHY, WHEN, HOW structure, so you can jump straight to the section you need.
WHAT
Amazon S3 (Simple Storage Service) is an object storage service that allows you to store data as objects inside buckets and retrieve it through APIs.
- Bucket: A container for objects. General purpose bucket names are globally unique within an AWS partition, and each bucket is created in one AWS Region.
- Object: The data itself (a file, image, log, backup) along with its associated metadata. A single object can be up to 5 TB.
-
Key: The unique identifier of an object within a bucket, such as
invoices/2026/11/invoice-1042.pdf. S3 uses a flat object structure. The slashes in keys only create the appearance of folders.
Key properties:
- Scale: Virtually unlimited storage, with no storage capacity to provision in advance.
- Durability: S3 is designed for 99.999999999% (11 nines) object durability. Standard Regional storage classes redundantly store data across multiple Availability Zones.
- Consistency: Strong read-after-write consistency for object PUT, GET, LIST, and DELETE operations.
- Access: HTTP-based APIs, SDKs, the AWS CLI, and the AWS Management Console.
S3 is not a traditional file system or block device. You cannot mount it like a disk for a database. If an application requires block storage or a shared file system, consider Amazon EBS or Amazon EFS.
WHERE
S3 fits workloads where data is stored and retrieved as objects:
- User uploads, images, and videos.
- Static website assets, often delivered through Amazon CloudFront.
- Application and access logs.
- Backups and disaster recovery copies.
- Data lakes and analytics datasets using services such as Amazon Athena, AWS Glue, and Amazon EMR.
- Long-term compliance and archival records.
S3 storage classes at a glance
Different workloads have different access patterns. S3 storage classes help match storage costs and retrieval requirements to how data is actually used.
| Storage class | Best for | Retrieval | Minimum storage duration | Resilience |
|---|---|---|---|---|
| S3 Standard | Frequently accessed data | Milliseconds | None | Multi-AZ |
| S3 Intelligent-Tiering | Unknown or changing access patterns | Milliseconds in Frequent, Infrequent, and Archive Instant Access tiers; hours in optional archive tiers | None | Multi-AZ |
| S3 Standard-IA | Infrequent access requiring immediate retrieval | Milliseconds | 30 days | Multi-AZ |
| S3 One Zone-IA | Infrequent access to re-creatable data | Milliseconds | 30 days | Single AZ |
| S3 Glacier Instant Retrieval | Rarely accessed archive data requiring immediate retrieval | Milliseconds | 90 days | Multi-AZ |
| S3 Glacier Flexible Retrieval | Archive data where retrieval delays are acceptable | Minutes to hours | 90 days | Multi-AZ |
| S3 Glacier Deep Archive | Long-term retention and rarely accessed data | Hours | 180 days | Multi-AZ |
There is also S3 Express One Zone, a high-performance storage class designed for latency-sensitive workloads. It stores data in a single Availability Zone and is suited to workloads that need very fast data access.
Glacier retrieval options
The three Glacier storage classes serve different retrieval requirements.
S3 Glacier Instant Retrieval
- Designed for archive data accessed rarely but requiring immediate retrieval.
- Provides millisecond access without an object restoration operation.
- Suitable for medical images, archived media, and records that occasionally need immediate access.
S3 Glacier Flexible Retrieval
- Designed for backup and archive data that does not require immediate access.
- Provides three retrieval options:
- Expedited: Typically 1–5 minutes.
- Standard: Typically 3–5 hours.
- Bulk: Typically 5–12 hours.
- Suitable for disaster recovery backups and historical datasets.
S3 Glacier Deep Archive
- Designed for long-term data retention.
- Standard retrieval typically takes up to 12 hours.
- Bulk retrieval typically takes up to 48 hours.
- Suitable for compliance records, financial archives, and long-term digital preservation.
Glacier Flexible Retrieval and Deep Archive require an object restore operation before the archived data can be accessed normally.
WHY
Choosing the wrong storage class, or leaving default configurations untouched, can increase costs and introduce unnecessary operational complexity.
Cost is more than gigabytes
S3 pricing has several dimensions:
- Storage: Charged per GB per month, depending on the selected storage class.
- Requests: PUT, GET, LIST, and other API requests can incur charges.
- Retrieval: Infrequent-access and archive classes can charge for retrieving data.
- Minimum storage duration: Deleting or transitioning an object before its minimum storage duration can result in additional charges.
- Data transfer: Data transferred out to the internet or between AWS Regions can incur costs.
- Lifecycle transitions: Requests to transition objects between storage classes can also incur charges.
- Monitoring and automation: S3 Intelligent-Tiering charges a small per-object monitoring and automation fee.
Security
S3 security should be designed before applications start storing sensitive data.
- Block Public Access: Keep it enabled unless public access is explicitly required. It is enabled by default for new buckets, but verify the configuration on existing buckets.
- Least privilege: Use IAM policies and bucket policies to grant only the permissions required by each application or user.
- Encryption at rest: New S3 objects are encrypted by default using SSE-S3. Use SSE-KMS when you need AWS KMS key management, permissions, and audit capabilities.
-
Encryption in transit: Enforce HTTPS through a bucket policy condition using
aws:SecureTransport. - Versioning: Retains previous object versions, helping recover data after accidental overwrites or deletions.
- Disable ACLs: Use Bucket owner enforced Object Ownership so access can be managed through policies instead of object ACLs.
Data protection: how S3 Versioning works
Imagine an application stores an important customer document in an S3 bucket. A user uploads the correct document, but another user accidentally uploads an incorrect file using the same object name.
Without versioning, the new upload replaces the previous object.
With S3 Versioning enabled, S3 retains the previous version and assigns a unique version ID to each new version of the object.
For example:
- A customer uploads
report.pdf. S3 stores it as the first version. - The customer uploads an updated
report.pdf. S3 creates another version. - The earlier version remains available.
- If the latest version is incorrect, an authorized user can retrieve the previous version.
Versioning also helps protect against accidental deletion.
When a user deletes an object in a versioning-enabled bucket, S3 generally creates a delete marker instead of permanently removing the previous object versions. The object appears deleted during normal access, but previous versions can still be recovered by removing the delete marker or accessing a specific version.
There are three important considerations:
- Versioning is not fully reversible: Once enabled, versioning can only be suspended, not turned off, and existing versions are retained.
- Storage costs: Every retained version consumes storage. Frequently updated files can generate many versions and increase the monthly bill.
- Version cleanup: Configure lifecycle policies to manage older, noncurrent versions so unnecessary historical data does not accumulate.
Versioning is particularly useful for documents, application data, and other objects that need protection against accidental changes or deletion. However, it is not a complete backup strategy by itself.
Data protection: Replication and Object Lock
- Replication: Same-Region Replication (SRR) and Cross-Region Replication (CRR) copy objects to another bucket for use cases such as compliance, data locality, and disaster recovery.
- S3 Object Lock: Provides WORM (Write Once, Read Many) protection to prevent objects from being deleted or overwritten during a defined retention period or under a legal hold.
Replication requires versioning to be enabled on both the source and destination buckets, along with the appropriate IAM permissions and replication rules. Delete marker replication is configurable, and permanent version deletions are not replicated by default. Object Lock also depends on versioning, so enabling it on a bucket enables versioning as well.
Recovery design should consider accidental deletion, malicious activity, retention requirements, and recovery objectives.
Automating with S3 Lifecycle Policies
S3 Lifecycle policies help automate the management of objects throughout their storage lifetime.
Instead of manually moving old objects between storage classes or deleting expired files, lifecycle rules allow AWS to perform these actions based on defined conditions.
Day 0 Day 30 Day 90 Retention ends
Standard --> Standard-IA --> Glacier Flexible --> Expire (delete marker)
|
Noncurrent versions removed after N days
A lifecycle policy can perform two main types of actions:
1. Transition actions
Transition actions move objects from one storage class to another based on their age.
For example, consider an application that stores customer documents:
- Day 0: Newly uploaded documents are stored in S3 Standard because they are frequently accessed.
- After 30 days: Older documents move to S3 Standard-IA because access becomes less frequent.
- After 90 days: Documents move to S3 Glacier Flexible Retrieval for long-term archival.
This reduces the need to keep every object in a frequently accessed storage class.
Objects must typically be stored for at least 30 days before a lifecycle rule can transition them to Standard-IA or One Zone-IA.
2. Expiration actions
Expiration actions automatically remove objects when they reach a defined retention period.
For example, an application may retain temporary processing files for 90 days and then allow S3 to expire them automatically.
This helps prevent unnecessary storage accumulation.
How lifecycle policies work with versioning
Lifecycle management becomes especially important when bucket versioning is enabled.
A versioned bucket can contain:
- Current versions: The latest version of an object.
- Noncurrent versions: Older versions retained after a new version is uploaded.
- Delete markers: Markers created when an object is deleted without specifying a particular version.
Lifecycle policies and versioning solve different problems. Versioning preserves object history, while lifecycle policies manage how long objects and their versions remain stored and which storage classes they use.
WHEN
Use S3 Standard when:
- Data is accessed frequently, such as active uploads, website assets, and frequently used application files.
- Applications require immediate access to stored objects.
Use S3 Intelligent-Tiering when:
- Access patterns are unpredictable or change over time.
- You want AWS to automatically move eligible objects between access tiers.
- The workload benefits from automated tiering and the monitoring fee is justified.
Use S3 Standard-IA or One Zone-IA when:
- Data is accessed occasionally but must still be retrieved immediately.
- Standard-IA is appropriate when multi-AZ resilience is required.
- One Zone-IA is appropriate only when data can be recreated or another copy exists, because it stores data in a single Availability Zone.
Use S3 Glacier Instant Retrieval when:
- Data is rarely accessed but must be retrieved in milliseconds.
- Examples include archived medical images and media records that occasionally need immediate access.
Use S3 Glacier Flexible Retrieval when:
- Data is retained for backup or archival purposes.
- Retrieval can take minutes to hours.
- Recovery requirements can accommodate the selected retrieval tier.
Use S3 Glacier Deep Archive when:
- Data must be retained for several years and is rarely accessed.
- Examples include compliance records, financial archives, and long-term backups.
- Retrieval delays of several hours are acceptable.
Use S3 Lifecycle Policies when:
- Objects become less frequently accessed as they age.
- Data must move automatically between storage classes.
- Temporary files or expired data need automated cleanup.
- Previous object versions must be retained for a defined period and then removed.
Enable S3 Versioning when:
- Important objects are frequently updated.
- Accidental overwrites or deletions must be recoverable.
- Applications need to maintain historical object versions.
HOW
Consider an application with three types of data:
- Customer uploads: Read frequently during the first month.
- Monthly reports: Rarely accessed after 30 days.
- Compliance records: Must be retained for seven years and almost never read.
A suitable S3 design can combine storage classes, lifecycle policies, and versioning.
1. Customer uploads
New uploads are stored in S3 Standard because they are frequently accessed. Versioning can be enabled to protect against accidental overwrites and deletions.
2. Monthly reports
After the initial active period, lifecycle policies can transition reports to Standard-IA or another suitable storage class based on access requirements. If reports are no longer needed after a defined retention period, an expiration rule can manage their removal.
3. Compliance records
Records that must be retained for several years can be transitioned to Glacier Flexible Retrieval or Deep Archive, depending on retrieval requirements. S3 Object Lock can also be considered when records must be protected against deletion or modification for a specified compliance period.
4. Historical versions
Lifecycle rules can manage noncurrent versions separately from current objects. For example, previous versions can be retained for 90 days after becoming noncurrent and then permanently deleted, provided this aligns with the organization's recovery and retention requirements. Incomplete multipart uploads can also be cleaned up automatically.
TAKEAWAY
S3 rewards deliberate design. Match each object's storage class to how often it is accessed, secure buckets by default, use versioning to protect object history, and let lifecycle policies manage transitions and cleanup automatically.




Top comments (0)