An application uploads a new object to S3 with PutObject, and its next line of code immediately issues a GetObject request for that same key. Which statement correctly describes what Amazon S3 guarantees here?
- The GetObject request returns the newly written data, because S3 provides strong read-after-write consistency for PUT and DELETE requests in all Regions
- The GetObject request may return stale or no data for up to several seconds, because S3 is only eventually consistent
- The GetObject request will fail until the object is replicated to at least two Availability Zones
- The GetObject request only returns the new data if S3 Versioning is enabled on the bucket
Why A? And why not the others?
Correct answer: A. The GetObject request returns the newly written data, because S3 provides strong read-after-write consistency for PUT and DELETE requests in all Regions
Amazon S3 provides strong read-after-write consistency for PUT and DELETE requests on objects, in every AWS Region, for both new object writes and overwrites of existing objects, meaning any read that starts after a successful write response is guaranteed to return the new data, never stale or partial data. This replaced the older eventual-consistency behaviour S3 once had for overwrite PUTs in certain cases, so a candidate should not assume a delay is still needed today. Expecting the read to possibly return nothing or stale data for a period describes the older eventual-consistency model, which no longer applies to object reads. There is no requirement to wait for replication to multiple Availability Zones before a read succeeds, since S3 replicates synchronously as part of a successful write. Consistency here does not depend on whether S3 Versioning is turned on; that setting affects whether multiple versions are retained, not whether a read reflects the latest write.
Source: AWS S3 docs: Amazon S3 data consistency model