Replicating Objects and Caches with Amazon S3 and Amazon ElastiCache
Object data and caches have their own resilience mechanisms. Amazon S3 stores objects redundantly within a Region and replicates them between buckets in the same or different Regions; Amazon ElastiCache replicates in-memory data across nodes, Availability Zones and Regions. This lesson explains S3 versioning and replication options, Multi-Region Access Points and ElastiCache replication, failover and global datastores.
Learning outcomes
After completing this lesson, you will be able to:
- Explain S3 durability, versioning and the protections against deletion.
- Describe S3 Cross-Region and Same-Region Replication, Replication Time Control and Batch Replication.
- Explain S3 Multi-Region Access Points and their failover controls.
- Describe ElastiCache Multi-AZ, automatic failover, cluster mode and Global Datastore.
S3 Durability and Versioning
S3 Standard and most other storage classes store objects across at least three AZs and are designed for 99.999999999% (eleven nines) durability, so infrastructure failures in a Region do not lose data. The S3 One Zone classes store data in a single AZ and are not resilient to AZ loss. The remaining risks are deletion, overwriting and Regional unavailability.
Versioning keeps every version of an object: an overwrite creates a new version, and a delete adds a delete marker while keeping earlier versions, so any version can be restored. Lifecycle rules expire noncurrent versions after a period to control cost. MFA delete requires multi-factor authentication to permanently delete versions or change versioning, and S3 Object Lock prevents versions from being deleted or overwritten for a retention period, in governance mode (bypassable with a special permission) or compliance mode (no one, including the root user, can delete them). Versioning is required for replication and Object Lock.
S3 Replication
S3 Replication copies new objects asynchronously from a source bucket to one or more destination buckets according to replication rules. Cross-Region Replication (CRR) copies to another Region, for disaster recovery, compliance with geographic separation and lower-latency access; Same-Region Replication (SRR) copies within a Region, for example to aggregate logs or to keep a copy in another account. Both buckets need versioning, and S3 uses an IAM role to read and write. Rules can filter by prefix or tag, replicate to another account and change ownership of replicas to the destination account, change the storage class of replicas and replicate objects encrypted with KMS when the keys are specified.
Several behaviours are frequently tested. Replication applies only to objects created after the rule exists; existing objects and objects that previously failed are copied with S3 Batch Replication. Delete markers are replicated only if delete marker replication is enabled, and deletions of specific versions are never replicated, which protects the replica from malicious deletes. Replication is not chained: objects replicated into a bucket are not replicated onward by that bucket's rules unless they are configured for it. Replica modification sync replicates metadata changes made on replicas back, for two-way replication. S3 Replication Time Control (RTC) replicates 99.99% of new objects within 15 minutes, backed by an SLA, and provides replication metrics and events for objects that miss the threshold.
| Feature | Purpose |
|---|---|
| CRR | Copy to another Region for DR, compliance and latency |
| SRR | Copy within a Region, such as to another account or for log aggregation |
| Replication Time Control | 15-minute replication SLA with metrics, for predictable RPO |
| Batch Replication | Replicate existing objects and retry failed replications |
| Delete marker replication | Optionally replicate delete markers |
| Replica modification sync | Two-way metadata synchronisation |
S3 replication rules
Multi-Region Access Points
An S3 Multi-Region Access Point provides a single global endpoint backed by buckets in several Regions. Requests are routed over the AWS network to the closest available bucket, and with replication between the buckets, applications read and write through one name in an active/active configuration. Failover controls let operators set each Region's bucket to active or passive, so that traffic can be shifted away from a Region within minutes in an active/passive design. This gives S3 workloads a managed multi-Region entry point without application changes during failover.
Amazon ElastiCache Resilience
Amazon ElastiCache provides managed Valkey, Redis OSS and Memcached caches. Memcached nodes are independent and have no replication, so losing a node loses its share of the cache; it suits simple, disposable caches. Valkey and Redis OSS support replication and high availability, explained below.
- Replication groups: a primary node with up to five read replicas per shard, with asynchronous replication. Replicas serve reads through a reader endpoint.
- Multi-AZ with automatic failover: replicas are placed in other AZs, and if the primary fails, ElastiCache promotes a replica and updates the primary endpoint, typically within seconds to a minute. A small amount of recent data may be lost.
- Cluster mode enabled: data is partitioned across up to 500 shards, each with its own primary and replicas, for capacity beyond one node and higher write throughput; shards can be added online.
- Global Datastore: cross-Region replication from a primary cluster to secondary clusters in other Regions with typically sub-second lag, and promotion of a secondary during a Regional event.
- Backups: snapshots, automatic or manual, which can be exported to S3 and used to seed new clusters.
- ElastiCache Serverless: a serverless option that replicates data across AZs and scales automatically without managing nodes.
Because a cache can usually be rebuilt from the database, the main resilience goal is to avoid a sudden load surge on the database when the cache fails; Multi-AZ with automatic failover keeps a warm copy available, and Test Failover can be run on a node group to verify behaviour.
Regional Protection for Documents
A legal firm stores contract documents in S3. Regulators require a copy at least 500 km away, documents must be immutable for seven years, and the recovery Region must have documents no more than 15 minutes behind.
-
Immutability
Enable versioning and Object Lock in compliance mode with a seven-year default retention on both buckets.
-
Replication
Configure CRR to a bucket in a distant Region with Replication Time Control, and replicate Object Lock retention settings.
-
Existing data
Run S3 Batch Replication for objects created before the rule.
-
Monitoring
Alarm on the replication metrics for operations missing the 15-minute threshold.
After enabling CRR on a bucket that already holds 10 million objects, the destination bucket contains only new uploads. Why, and how are the existing objects copied?
Show answer
Replication rules apply only to objects written after the rule is created. S3 Batch Replication copies the existing objects.
Exam Tips
Remember for the exam
- S3 replication (CRR or SRR) needs versioning on both buckets and applies only to new objects; use Batch Replication for existing objects.
- Replication Time Control gives a 15-minute SLA for 99.99% of objects; delete markers replicate only when enabled, and version deletions never replicate.
- Object Lock compliance mode prevents deletion by anyone, including root; MFA delete protects versioned objects.
- Multi-Region Access Points provide one global endpoint with failover controls.
- ElastiCache Valkey/Redis OSS: Multi-AZ automatic failover, cluster mode sharding and Global Datastore; Memcached has no replication.