Study guide
Technical reference and lesson notes
Purpose of This Lesson
Amazon S3 provides several mechanisms for protecting, copying, retaining, and automatically managing objects. Versioning protects against accidental overwrites and deletions, replication creates copies in another bucket, and lifecycle rules transition or expire objects according to age or other conditions.
These features are frequently combined in SAP-C02 scenarios involving resilience, disaster recovery, data retention, and storage-cost optimization.
Key Concepts
S3 Versioning
S3 Versioning allows multiple versions of an object to exist in the same bucket. When an object is uploaded using the same key as an existing object, S3 stores the new content as a new version rather than permanently replacing the previous content.
Versioning helps recover from:
- Accidental overwrites
- Accidental deletions
- Application errors that modify or replace data
- The need to retrieve an earlier version of an object
A versioned bucket maintains a current version and can retain older, noncurrent versions. Version IDs allow applications or administrators to identify and retrieve specific versions.
Deleting an object from a versioned bucket generally adds a delete marker instead of immediately removing the underlying object version. The object can be restored by removing the delete marker or retrieving a prior version. To permanently remove data, a specific version must be deleted.
Versioning is not enabled by default and is configured at the bucket level. Once enabled, it cannot simply be returned to an unversioned state; it can be suspended. Suspending versioning stops the creation of new versions but does not remove versions that already exist.
S3 Replication
S3 replication automatically copies objects from a source bucket to a destination bucket. The destination can be in:
- A different AWS Region: S3 Cross-Region Replication (CRR)
- The same AWS Region: S3 Same-Region Replication (SRR)
S3 Versioning must be enabled on both the source and destination buckets before replication can be configured.
Replication is useful for:
- Regional disaster recovery
- Data residency or compliance requirements
- Creating a separate copy for analytics or processing
- Reducing latency for users in another Region
- Separating production data from backup or test environments
Replication is asynchronous. It should not be treated as a synchronous write acknowledgment or as a replacement for every form of backup. A solution requiring a point-in-time backup strategy may also need S3 Versioning, Object Lock, backup tooling, or another protection mechanism.
Replication rules can be scoped to selected prefixes or object tags. Modern replication configurations can also replicate delete markers and existing objects when explicitly configured or submitted through an appropriate batch operation. Exam questions should distinguish automatic replication of newly eligible objects from a one-time copy of objects that already existed before replication was configured.
S3 Lifecycle Management
S3 Lifecycle rules automate object management based on conditions such as object age, prefix, tags, or object version status. Lifecycle actions fall into two broad categories.
#### Transition actions
A transition action moves an object to a different S3 storage class, usually to reduce cost as access frequency declines. For example, an object might transition from S3 Standard to an infrequent-access or archival storage class after a defined number of days.
Transitions are directional and subject to AWS-supported paths, minimum storage durations, object-size considerations, and other storage-class constraints. A lifecycle rule cannot arbitrarily move an object between every pair of storage classes. For example, a design should not assume that an object in S3 Standard-IA can transition backward to S3 Standard through lifecycle management.
#### Expiration actions
An expiration action causes S3 to remove objects automatically after a defined period. In a versioned bucket, lifecycle rules can be configured separately for:
- Current object versions
- Noncurrent object versions
- Delete markers
This distinction is important. A rule that expires current versions may not remove older versions, which can continue to consume storage. Noncurrent-version expiration should be considered when Versioning is used for long-term protection and cost control.
Lifecycle rules can also abort incomplete multipart uploads, preventing abandoned upload parts from accumulating storage charges.
Exam-Relevant Takeaways
- S3 Versioning preserves multiple object versions and helps recover from accidental overwrites and deletes.
- S3 replication requires Versioning on both the source and destination buckets.
- CRR copies data across AWS Regions; SRR copies data between buckets in the same Region.
- Replication is asynchronous and should not be assumed to provide immediate consistency between buckets.
- Lifecycle transitions move objects between storage classes.
- Lifecycle expiration deletes objects or versions according to a rule.
- Lifecycle transitions are constrained by supported storage-class paths and storage-class minimum-duration requirements.
- In versioned buckets, deleting the visible object can create a delete marker while previous versions remain available.
- Expiring current versions does not necessarily remove noncurrent versions.
- Replication and lifecycle rules should be evaluated together: replicated objects may also be subject to lifecycle policies in the destination bucket.
Architecture Decision Guide
| Requirement | Recommended S3 capability | Important consideration |
|---|---|---|
| Recover from accidental overwrite | Versioning | Older versions consume storage until removed by lifecycle policy or explicit deletion |
| Recover from an accidental delete | Versioning | A delete marker may hide the object while older versions remain available |
| Maintain a copy in another Region | Cross-Region Replication | Requires Versioning on both buckets and operates asynchronously |
| Copy data between buckets in one Region | Same-Region Replication | Useful for isolation, compliance, or separate processing workflows |
| Reduce cost for aging data | Lifecycle transition | Verify supported transitions, minimum durations, and retrieval implications |
| Automatically remove data after retention expires | Lifecycle expiration | In versioned buckets, define behavior for current and noncurrent versions |
| Prevent abandoned multipart uploads from accumulating cost | Lifecycle rule to abort incomplete multipart uploads | Set an appropriate age threshold |
| Protect data against logical deletion or overwrite | Versioning, potentially combined with Object Lock | Versioning alone does not provide immutable retention |
Common Exam Traps
- Enabling Versioning on only the source bucket: Replication requires Versioning on both the source and destination.
- Treating replication as backup: Replication can copy accidental changes or deletions, and it is asynchronous. Use an appropriate retention and recovery design.
- Assuming replication is retroactive: Objects already present may require a separate existing-object replication or batch-copy process.
- Assuming a delete permanently removes a versioned object: A delete marker may be created while prior versions remain retrievable.
- Ignoring noncurrent versions: Lifecycle expiration for current objects does not automatically eliminate every older version.
- Assuming any storage-class transition is valid: Lifecycle transitions follow supported paths and storage-class restrictions.
- Forgetting storage minimum durations: Moving an object too early can lead to minimum-storage-duration charges or undermine the expected savings.
- Confusing CRR and SRR: The deciding factor is whether the destination bucket is in a different Region or the same Region.
- Expecting lifecycle rules to improve availability: Lifecycle management controls storage placement and retention; it does not provide replication or high availability by itself.
Real-World Engineer Notes
- Versioning can significantly increase storage consumption when objects are frequently overwritten. Pair it with noncurrent-version lifecycle expiration where business retention permits.
- Before enabling expiration, confirm legal, regulatory, and business retention requirements. An automated expiration rule can be difficult to reverse.
- Use prefixes and object tags to apply different lifecycle policies to different datasets, such as raw data, processed results, and temporary exports.
- Replication needs an IAM role that permits S3 to read source objects and write the required replicas to the destination bucket. Encryption configuration may require additional permissions and key policies.
- If the destination bucket is encrypted with a customer managed AWS KMS key, validate the KMS key policy and replication permissions in addition to the S3 configuration.
- Monitor replication status and failures rather than assuming that a successful source upload means the replica is already available.
- Test recovery procedures. A design that retains versions is only useful if operators know how to identify and restore the correct version.
- If immutable retention is required, evaluate S3 Object Lock in addition to Versioning. Versioning by itself allows versions to be deleted by an authorized principal.
Quick Reference Summary
- Versioning: Retains multiple versions of objects in one bucket.
- CRR: Replicates objects to a bucket in another AWS Region.
- SRR: Replicates objects to a bucket in the same AWS Region.
- Replication prerequisite: Versioning enabled on both buckets.
- Transition: Moves an object to another storage class.
- Expiration: Deletes an object, version, or delete marker according to lifecycle configuration.
- Key caution: Account for noncurrent versions, asynchronous replication, supported transition paths, and minimum storage durations.
Flashcards
- Question: What problem does S3 Versioning primarily solve?
Answer: It supports recovery from accidental overwrites and deletions by retaining multiple versions of an object.
- Question: Where are multiple versions stored when Versioning is enabled?
Answer: Multiple versions of the same object key are retained in the same S3 bucket.
- Question: What is the difference between CRR and SRR?
Answer: CRR replicates to a bucket in another AWS Region; SRR replicates to a bucket in the same Region.
- Question: What prerequisite is required for S3 replication?
Answer: Versioning must be enabled on both the source and destination buckets.
- Question: Is S3 replication synchronous?
Answer: No. S3 replication is asynchronous.
- Question: What does a lifecycle transition do?
Answer: It moves an object to another S3 storage class.
- Question: What does a lifecycle expiration action do?
Answer: It automatically removes objects, versions, or delete markers according to the rule configuration.
- Question: What happens when an object is deleted from a versioned bucket?
Answer: S3 commonly creates a delete marker, while prior object versions remain available.
- Question: Why must noncurrent versions be included in lifecycle planning?
Answer: They continue consuming storage even after a newer version becomes current or the visible object is deleted.
- Question: Can lifecycle rules transition objects between every S3 storage class?
Answer: No. Supported transition paths and storage-class restrictions apply.
- Question: What is a common use for SRR?
Answer: Creating a same-Region copy for isolation, compliance, or a separate processing workflow.
- Question: Does Versioning alone provide immutable data retention?
Answer: No. Authorized users can still delete versions; immutable retention may require S3 Object Lock.
Practice Questions
Question 1
A company must recover files when an application accidentally overwrites them. The files must remain in the same S3 bucket, and the company does not require a second Region. Which solution should the architect recommend?
A. S3 Same-Region Replication only
B. S3 Versioning
C. An S3 lifecycle expiration rule
D. S3 Transfer Acceleration
Correct answer: B. S3 Versioning
Explanation: Versioning retains previous object versions in the same bucket, allowing recovery from accidental overwrites. Replication creates another copy but is not required for this single-bucket recovery requirement.
Question 2
An organization wants newly uploaded objects copied automatically from a bucket in us-east-1 to a bucket in eu-west-1 for regional disaster recovery. Which configuration is required?
A. Enable Versioning only on the destination bucket and configure SRR
B. Enable Versioning on both buckets and configure CRR
C. Configure a lifecycle transition to S3 Glacier Flexible Retrieval
D. Enable S3 Transfer Acceleration on the source bucket
Correct answer: B. Enable Versioning on both buckets and configure CRR
Explanation: The destination is in a different Region, so CRR is appropriate. S3 replication requires Versioning on both the source and destination buckets.
Question 3
A versioned bucket receives frequent updates to large objects. The business needs the current version for 30 days but only needs noncurrent versions for 90 days. Which design best controls storage cost while retaining the required recovery window?
A. Expire all objects after 30 days without considering versions
B. Transition current versions to S3 Standard-IA after 30 days and retain noncurrent versions forever
C. Configure lifecycle rules separately for current and noncurrent versions
D. Disable Versioning after the first upload
Correct answer: C. Configure lifecycle rules separately for current and noncurrent versions
Explanation: Versioned buckets require separate consideration of current and noncurrent versions. A lifecycle policy can retain noncurrent versions for 90 days and then expire them, while applying an appropriate policy to current versions.
Question 4
A team configures a lifecycle rule to transition objects from S3 Standard-IA back to S3 Standard when they become frequently accessed. The rule does not behave as expected. What is the most likely reason?
A. Lifecycle rules cannot operate on versioned buckets
B. Lifecycle transitions must follow supported storage-class paths
C. S3 Standard-IA cannot store objects larger than 128 KB
D. Replication must be enabled before any transition can occur
Correct answer: B. Lifecycle transitions must follow supported storage-class paths
Explanation: Lifecycle transitions are not arbitrary. The solution must use supported transitions and account for the characteristics and constraints of the selected storage classes.
Question 5
An administrator deletes an object from a versioned S3 bucket and then needs to restore it. What should the administrator investigate first?
A. Whether a delete marker was added and whether a previous version remains
B. Whether S3 Transfer Acceleration is enabled
C. Whether the bucket was moved to S3 Glacier
D. Whether SRR was configured before the deletion
Correct answer: A. Whether a delete marker was added and whether a previous version remains
Explanation: In a versioned bucket, a delete operation can add a delete marker while leaving previous versions intact. Removing the delete marker or retrieving the required prior version can restore access to the object.