Amazon S3 and Glacier Storage Interview Questions: CLI, Lifecycle, Replication, Encryption and Recovery Scenarios (50 Questions)
This page has 50 Amazon S3 and S3 Glacier interview questions with full answers, focused on hands-on CLI work and real scenarios. The S3 basics (storage classes, versioning, encryption options, bucket policies) are covered in Sets 1 and 2; here we go into the things you only learn by running S3 at scale.
1. An everyday example: a self-storage warehouse
Why do S3 questions keep going deeper?
Almost every AWS workload uses S3: backups, logs, data lakes, websites and user uploads. Senior interviews move quickly from "what is a storage class?" to "how would you recover a million deleted objects?".
Think of a huge self-storage warehouse. Each locker (object) has a label (key) and lives in a section (bucket). Nearby lockers cost more but open instantly; lockers in the basement (Glacier classes) cost less but need time and a request to bring things up. The warehouse keeps a register of every locker (Inventory) and has staff who can move thousands of lockers at once (Batch Operations).
How to use this page
- Try the read-only commands on a test bucket.
- Restores from archive classes, replication and Batch Operations cost money; use small test data.
- All bucket names and account IDs are examples, such as 111122223333.
2. Fresher level questions
Start here if you are a fresher or have less than two years of experience. Try to answer each question aloud first. Then open it and compare.
Q1. How do you see an object's storage class, encryption and version from the CLI? Fresher
aws s3api head-object --bucket shop-data-111122223333 --key reports/2026-11.csvOutput:
{"ContentLength": 48211, "ETag": "\"9b2cf535f27731c974343645a3985328\"", "StorageClass": "STANDARD_IA", "ServerSideEncryption": "aws:kms", "SSEKMSKeyId": "arn:aws:kms:ap-south-1:111122223333:key/1234abcd-...", "VersionId": "3HL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY"}The object is in Standard-IA, encrypted with a KMS key, and versioned. For Standard objects, StorageClass is not shown at all.
head-object downloads nothing, so it is cheap and fast for checks.
Q2. How do you find how much data is under a prefix? Fresher
aws s3 ls s3://shop-logs-111122223333/alb/2026/11/ --recursive --summarize --human-readable | tail -2Output:
Total Objects: 182340
Total Size: 41.7 GiBThis prefix holds about 182,000 objects and 41.7 GiB.
This lists every object, so it is slow and makes many LIST requests on huge prefixes. For whole buckets or regular reports, use CloudWatch storage metrics, S3 Storage Lens or S3 Inventory instead.
Q3. How do you move one existing object to a different storage class without lifecycle rules? Fresher
Copy it onto itself with a new storage class:
aws s3 cp s3://shop-data-111122223333/archive/2024.zip s3://shop-data-111122223333/archive/2024.zip --storage-class GLACIER_IRS3 rewrites the object in Glacier Instant Retrieval. In a versioned bucket this creates a new version, and the old Standard version stays (and is billed) until a lifecycle rule removes it.
For many objects, use a lifecycle rule or S3 Batch Operations instead of a script.
Q4. When is S3 Glacier Instant Retrieval the right class? Fresher
Use it for data that is rarely read (about once a quarter) but must open in milliseconds when it is needed, for example old medical images, user photos from past years, or news archives.
- Storage is cheaper than Standard-IA.
- Reads cost more per GB than Standard-IA.
- It has a 90-day minimum storage duration.
If the data is read monthly, Standard-IA is usually cheaper overall; if access is unknown, Intelligent-Tiering decides for you.
Q5. How do you restore an object from S3 Glacier Deep Archive with the CLI and know when it is ready? Fresher
aws s3api restore-object --bucket shop-archive-111122223333 --key scans/2019/batch7.tar --restore-request '{"Days":7,"GlacierJobParameters":{"Tier":"Standard"}}'
aws s3api head-object --bucket shop-archive-111122223333 --key scans/2019/batch7.tar --query RestoreOutput:
"ongoing-request=\"true\""Later:
Output:
"ongoing-request=\"false\", expiry-date=\"Fri, 27 Nov 2026 00:00:00 GMT\""The temporary copy is ready and can be downloaded until the expiry date. The object itself stays in Deep Archive. You can get an S3 event notification when the restore completes instead of polling.
Q6. What is S3 Inventory? Fresher
S3 Inventory produces a scheduled (daily or weekly) list of the objects in a bucket or prefix, as CSV, ORC or Parquet files in another bucket.
Each row can include key, size, storage class, version ID, encryption status, replication status, Object Lock settings and more.
Uses: auditing (which objects are not encrypted), cost analysis (how many tiny objects), and as input to S3 Batch Operations. Query it with Athena. It is much cheaper than listing billions of objects yourself.
Q7. What is S3 Batch Operations? Fresher
S3 Batch Operations runs one action on millions or billions of objects as a managed job.
Actions include: copy (for example to change encryption or storage class), replace tags, restore from archive, invoke a Lambda function per object, set Object Lock retention, and replicate existing objects.
Input: an S3 Inventory report, a CSV list, or a generated manifest. You get progress tracking, retries and a completion report showing which objects failed.
Q8. Why would you use additional checksums on S3 uploads? Fresher
Checksums prove that the bytes stored in S3 are exactly the bytes you sent.
aws s3api put-object --bucket shop-data-111122223333 --key exports/orders.parquet --body orders.parquet --checksum-algorithm CRC32COutput:
{"ChecksumCRC32C": "f4nJ0A==", ...}S3 calculated and stored a CRC32C checksum and verified it during upload. You can read it later with head-object --checksum-mode ENABLED and compare it after copies or downloads.
Recent SDKs and CLI versions add CRC checksums automatically by default. Useful for compliance and for large data pipelines.
Q9. What is Requester Pays on an S3 bucket? Fresher
With Requester Pays turned on, the person downloading pays the request and data transfer charges, and the bucket owner pays only for storage.
Requesters must send a header (with the CLI, --request-payer requester), and must be authenticated AWS users; anonymous access does not work.
Use it to share large datasets (genomics, satellite images) with other organisations without paying for their downloads.
Q10. What is S3 Transfer Acceleration? Fresher
Transfer Acceleration sends uploads and downloads through CloudFront edge locations and the AWS network, instead of over the public internet all the way to the bucket's Region.
aws s3 cp big.zip s3://shop-uploads-111122223333/ --endpoint-url https://shop-uploads-111122223333.s3-accelerate.amazonaws.comUseful when users far from the Region upload large files. It costs extra per GB, and AWS only charges for it when it actually makes the transfer faster. Test with the speed comparison tool first.
Q11. Why do browser uploads to S3 need a CORS configuration? Fresher
A web page from https://shop.example.com that uploads directly to a bucket is making a cross-origin request. The browser first asks S3 whether that origin is allowed; without a matching CORS rule, the browser blocks the request even if the presigned URL is valid.
Output:
[{"AllowedOrigins":["https://shop.example.com"],"AllowedMethods":["PUT","POST"],"AllowedHeaders":["*"],"ExposeHeaders":["ETag"],"MaxAgeSeconds":3000}]Only your site may upload from a browser. CORS does not protect data; it only controls what browsers allow. Security still comes from IAM and presigned URLs.
Q12. What does aws s3 sync --delete do, and how do you use it safely? Fresher
sync copies new and changed files; with --delete it also removes files in the destination that do not exist in the source.
Danger: a wrong source path (an empty folder) can delete everything in the destination.
Safe use:
aws s3 sync ./site s3://shop-web-111122223333/ --delete --dryrunOutput:
(dryrun) delete: s3://shop-web-111122223333/old-page.html--dryrun shows what would happen without doing it. Check the list, then run without --dryrun. Keep versioning on for important buckets so mistakes can be undone.
Q13. How do lifecycle rules choose objects: by prefix, tags or size? Fresher
A lifecycle rule filter can use:
- A prefix, such as logs/.
- One or more object tags, such as retention=short.
- Object size limits (ObjectSizeGreaterThan and ObjectSizeLessThan).
- Combinations of these with And.
Example: transition only objects larger than 1 MB under logs/ to Glacier, so tiny files do not create more transition cost than they save. Tags are useful when the same prefix holds data with different retention needs.
Q14. What is the Amazon Glacier vault service, and how is it different from S3 Glacier storage classes? Fresher
- Amazon Glacier (the original service) stores archives in vaults with its own API, archive IDs and inventory jobs. It is older and harder to use, and AWS moved it to maintenance in late 2025 (no new customers; existing customers continue).
- S3 Glacier storage classes (Instant Retrieval, Flexible Retrieval, Deep Archive) are storage classes inside normal S3 buckets, used with the normal S3 API, lifecycle rules and keys.
For any new design, use the S3 Glacier storage classes. Check the current AWS documentation for the vault service's status.
Q15. What is the difference between an S3 legal hold and a retention period? Fresher
Both are Object Lock features that stop an object version from being deleted or overwritten.
- A retention period has an end date (for example 7 years). Governance mode can be bypassed by users with special permission; compliance mode cannot be shortened or removed by anyone, including root.
- A legal hold has no end date. It stays until someone with s3:PutObjectLegalHold removes it. Use it during lawsuits or investigations.
An object version can have both; it is protected while either applies.
Q16. Why does S3 return 403 for a request that should get 404? Fresher
If the caller does not have s3:ListBucket permission on the bucket, S3 returns 403 Access Denied for a missing key instead of 404 Not Found. This stops people without list permission from learning which keys exist.
So a 403 on GetObject can simply mean "this key does not exist, and you are not allowed to know". Check the exact key spelling (case, spaces, URL encoding) before changing policies.
Q17. What does the S3 storage class "INTELLIGENT_TIERING" archive configuration add? Fresher
By default, Intelligent-Tiering moves objects between frequent, infrequent and archive instant access tiers automatically, with millisecond access.
You can also turn on optional Archive Access and Deep Archive Access tiers for a bucket or prefix (after, for example, 90 and 180 days without access). Objects in these optional tiers must be restored before reading, like the Glacier classes.
Turn them on only when the application can handle a restore step; otherwise reads fail with an InvalidObjectState error.
3. Mid level questions
These questions check how you use the service in real projects. Interviewers expect the why, the how and one real example.
Q18. Write the lifecycle rules a versioned log bucket needs so it does not grow forever. Mid level
Output:
{"Rules":[{"ID":"logs","Status":"Enabled","Filter":{"Prefix":"logs/"},
"Transitions":[{"Days":30,"StorageClass":"STANDARD_IA"}],
"Expiration":{"Days":365},
"NoncurrentVersionExpiration":{"NoncurrentDays":30},
"AbortIncompleteMultipartUpload":{"DaysAfterInitiation":7}},
{"ID":"markers","Status":"Enabled","Filter":{},"Expiration":{"ExpiredObjectDeleteMarker":true}}]}current logs move to Standard-IA after 30 days and expire after a year (which adds a delete marker); old versions are removed 30 days after they become noncurrent; abandoned multipart uploads are cleaned; leftover delete markers are removed. Without the noncurrent rule, "expired" data stays and is billed as old versions.
Q19. Why might a lifecycle transition not move small objects, and why is that usually good? Mid level
Since 2024, S3 lifecycle by default does not transition objects smaller than 128 KB to other storage classes, unless you set an object size filter that allows it.
Reason: each transition is a billed request, and archive classes add per-object overhead (Glacier Flexible Retrieval and Deep Archive add extra metadata storage per object). For tiny objects, moving them can cost more than leaving them in Standard.
If you have millions of tiny files to archive, bundle them into larger files (tar or Parquet) first.
Q20. What extra settings do you need to replicate SSE-KMS encrypted objects? Mid level
- In the replication rule, turn on replication of objects encrypted with KMS (SourceSelectionCriteria: SseKmsEncryptedObjects enabled).
- Give the destination KMS key ID (ReplicaKmsKeyID) for the destination Region or account.
- The replication role needs kms:Decrypt on the source key and kms:Encrypt (GenerateDataKey) on the destination key.
- For cross-account, the destination key policy must allow the source account's replication role.
If these are missing, unencrypted or SSE-S3 objects replicate but KMS objects silently stay behind with FAILED replication status.
Q21. What is a Multi-Region Access Point? Mid level
A Multi-Region Access Point gives one global endpoint for buckets in several Regions. Requests are routed over the AWS network to the closest healthy bucket.
- You combine it with replication between the buckets (often two-way) so data exists in each Region.
- Failover controls let you mark Regions active or passive and shift traffic during an incident.
Use it for applications that need low latency worldwide or a quick Regional failover for S3 data without changing bucket names in the app.
Q22. What is S3 Access Grants? Mid level
Access Grants maps identities to S3 locations: "this IAM Identity Center group can read s3://lake/sales/*". Applications ask Access Grants for temporary credentials scoped to exactly that prefix.
Why: bucket policies and IAM policies become huge and hard to manage when thousands of users or groups need different prefixes. Access Grants scales this and works with corporate directory identities, and CloudTrail records which end user accessed the data.
Q23. How do you stop two writers from overwriting the same S3 key? Mid level
Use conditional writes:
aws s3api put-object --bucket shop-data-111122223333 --key locks/job-77.json --body job.json --if-none-match "*"Output:
An error occurred (PreconditionFailed) when calling the PutObject operationThe object already existed, so S3 refused the write. The first writer wins and the second gets 412.
To update only if nobody changed the object since you read it, use --if-match with the ETag you read. This allows simple optimistic locking in S3 without a separate database.
Q24. Is S3 Select still the recommended way to query inside objects? Mid level
No. AWS stopped offering S3 Select to new customers in 2024 (existing customers can keep using it). AWS recommends other tools instead:
- Amazon Athena to run SQL over objects in S3.
- Client-side filtering after a ranged or full GET.
- S3 Tables or a data format such as Parquet, which already lets engines read only the needed columns.
In an interview, mention S3 Select as legacy and explain the alternative.
Q25. What is DSSE-KMS, and who needs it? Mid level
DSSE-KMS is dual-layer server-side encryption: S3 encrypts each object twice, with two separate layers, using KMS keys.
It exists for customers whose rules require multi-layer encryption (some government and defence standards). It costs more than SSE-KMS (extra KMS and S3 charges).
For most workloads, SSE-S3 (the default) or SSE-KMS with a customer managed key is enough.
Q26. How do you copy a whole bucket with millions of objects to another account quickly? Mid level
Options, from small to large:
- aws s3 sync from an EC2 instance in the same Region (tune concurrency), fine for a few million objects.
- S3 Batch Operations copy job with an Inventory manifest: managed, retried and reported, good for hundreds of millions of objects.
- AWS DataSync between the two buckets: managed, verifies data, and can run on a schedule.
- Replication with Batch Replication if the copy must stay in sync afterwards.
Prepare the destination first: bucket policy for the copying role, KMS key permissions, Object Ownership set to bucket owner enforced, and the same storage class or a cheaper one.
Q27. When would you send S3 events to EventBridge instead of using direct S3 event notifications? Mid level
Direct notifications (to SNS, SQS or Lambda) are simple, but each event type and prefix combination can only go to limited destinations and filtering is by prefix and suffix only.
EventBridge (turned on per bucket) gives:
- Many rules and targets for the same event.
- Rich filtering on any field (size, key patterns, requester).
- Archive and replay, and cross-account buses.
Use EventBridge when several teams react to the same bucket or you need advanced filtering; keep direct notifications for one simple consumer.
Q28. What does S3 Storage Class Analysis tell you? Mid level
Storage Class Analysis watches access patterns for a bucket, prefix or tag for at least about 30 days and reports how often objects of each age are read.
It helps you decide when to move data from Standard to Standard-IA in a lifecycle rule (for example, "objects older than 45 days are almost never read").
It does not analyse transitions to Glacier classes or One Zone-IA, and it does not move anything itself. For unknown patterns, Intelligent-Tiering can decide automatically.
Q29. How do you download a large object faster? Mid level
Use byte-range GETs in parallel:
aws s3api get-object --bucket shop-data-111122223333 --key big/model.bin --range bytes=0-104857599 part0You download the first 100 MiB. Several workers can each fetch a different range at the same time and join the parts.
The CLI and SDK transfer managers do this automatically for large files. Using ranges that match the upload part sizes gives the best performance. Ranged GETs are also useful to read just a header from a big file.
Q30. How do you make the AWS CLI upload and download S3 data faster? Mid level
The high-level aws s3 commands use multipart and parallel transfers. You can tune them:
aws configure set default.s3.max_concurrent_requests 32
aws configure set default.s3.multipart_chunksize 64MBup to 32 parallel requests with 64 MB parts. On a large EC2 instance with high network bandwidth, this can speed up big copies a lot.
Other options: the CRT-based transfer client (preferred_transfer_client = crt) on supported versions, running several processes on different prefixes, and copying inside AWS (S3 to S3) instead of downloading and re-uploading.
Q31. Why does a "restore" of an object in Intelligent-Tiering or Glacier Flexible Retrieval cost and take what it does? Mid level
Archive classes keep data on cheap, slow storage. A restore makes a temporary readable copy:
- Glacier Flexible Retrieval: expedited (minutes), standard (hours) or bulk (cheapest, up to about half a day).
- Deep Archive: standard (within about 12 hours) or bulk (within about 48 hours).
You pay per GB retrieved and per request, plus storage of the temporary copy for the days you asked for. Faster tiers cost more. Plan large restores with bulk retrieval and Batch Operations, and check current times and prices in the S3 documentation.
Q32. How do you check whether objects replicated successfully? Mid level
- Per object: head-object shows ReplicationStatus: COMPLETED, PENDING, FAILED (on the source) or REPLICA (on the destination).
- At scale: S3 Inventory includes replication status; query it with Athena for FAILED objects.
- Metrics: turn on replication metrics (or Replication Time Control) to see bytes pending, operations pending, latency and failed operations in CloudWatch.
- Events: s3:Replication:OperationFailedReplication notifications tell you about failures as they happen.
Common causes of failure: KMS permissions, Object Lock or ownership settings at the destination, and objects created before the rule (use Batch Replication).
Q44. Why does copying a 12 GB object with CopyObject fail, and how do you copy it? Mid level
A single CopyObject request can copy objects up to 5 GB. Larger objects must be copied with a multipart upload where each part is copied from the source with UploadPartCopy.
You rarely do this by hand:
aws s3 cp s3://src-bucket-111122223333/video/raw.mp4 s3://dst-bucket-111122223333/video/raw.mp4The high-level aws s3 cp command switches to multipart copy automatically for large objects. Batch Operations copy jobs have their own size limits for single-copy operations, so check the documentation for very large objects.
Q45. A PDF in S3 downloads instead of opening in the browser. Why, and how do you fix it? Mid level
Browsers use the object's Content-Type metadata. If it was uploaded as binary/octet-stream (or Content-Disposition is attachment), the browser downloads it.
aws s3api head-object --bucket shop-web-111122223333 --key docs/guide.pdf --query ContentTypeOutput:
"binary/octet-stream"Fix by copying the object onto itself with new metadata:
aws s3 cp s3://shop-web-111122223333/docs/guide.pdf s3://shop-web-111122223333/docs/guide.pdf --content-type application/pdf --metadata-directive REPLACEThen invalidate the CDN cache if CloudFront serves it. Set content types correctly in the upload pipeline.
Q46. Are deletes replicated by S3 replication? Mid level
- Deleting an object without a version ID adds a delete marker. Delete markers are replicated only if delete marker replication is turned on in the rule (and the rule uses the newer filter-based schema).
- Deleting a specific version (with a version ID) is never replicated. This protects the destination from malicious or accidental permanent deletes in the source.
- Lifecycle expiration delete markers are not replicated.
For backups, many teams keep delete marker replication off, so the copy still has the data even after deletes in the source.
4. Senior level and scenario questions
These questions check design thinking and troubleshooting. Think aloud. Say what you check first, what you change, and how you prevent it next time.
Q33. 1 million objects were deleted by a bad script in a versioned bucket. How do you recover them quickly? Senior
In a versioned bucket, a normal delete only adds a delete marker; the data is still there as a previous version.
- Stop the script and block the role.
- Get the list of affected keys: S3 Inventory with versions (or CloudTrail data events if enabled) filtered by the delete markers created in the incident window.
- Use S3 Batch Operations (with a Lambda function or a manifest of delete-marker version IDs) to delete those delete markers, which makes the previous versions current again.
- Verify counts with a new inventory or by sampling with head-object.
Prevention: least privilege for scripts, MFA delete or Object Lock for critical data, and AWS Backup for S3.
Q34. An application stores billions of tiny objects (2 KB each) and wants to move them to Glacier to save money. What do you advise? Senior
Moving them as they are will probably cost more:
- Each object pays a transition request charge.
- Glacier Flexible Retrieval and Deep Archive add per-object overhead (index and metadata storage), which is large compared with 2 KB.
- Restoring billions of objects later means billions of requests.
Better: compact them into large files (for example daily tar or Parquet files of 100 MB to 1 GB) with a job, keep an index of what is inside, then archive the large files. Or keep them in Intelligent-Tiering, which does not monitor or move objects under 128 KB but has no retrieval fees.
Q35. Design storage for application logs that must be searchable for 30 days, kept cheaply for 1 year, and kept unchangeable for 7 years. Senior
- Logs land in S3 in a dedicated log archive account, partitioned by date; recent logs also go to CloudWatch Logs or OpenSearch for 30-day search.
- Lifecycle: Standard for 30 days, then Standard-IA or Glacier Instant Retrieval until 1 year, then Deep Archive until 7 years, then expire.
- Object Lock in compliance mode with a 7-year default retention on the bucket for the regulated logs.
- SSE-KMS with a key owned by security, and a bucket policy limited to the log writers.
- Athena for occasional queries on older (non-archived) data.
Check with legal which logs truly need 7 years; it is often not all of them.
Q36. Security says every object in a 300 TB bucket must be re-encrypted with a new customer managed KMS key. How do you do it? Senior
- Set the bucket's default encryption to the new key so new objects use it.
- Generate an S3 Inventory (with encryption status) and filter objects not yet using the new key.
- Run an S3 Batch Operations copy job (copy in place) with the new KMS key; enable S3 Bucket Keys to reduce KMS request cost.
- Watch out: archived objects must be restored first; copies create new versions (expire old ones with lifecycle); object metadata and tags must be preserved; KMS request quotas may need an increase.
- Verify with a new inventory, then disable the old key only after everything uses the new one.
Q37. You need S3 data to be available in two Regions with writes in both. How do you design it? Senior
- Two buckets, one per Region, with two-way replication (replication rules in both directions) and replica modification sync turned on so metadata changes also flow both ways.
- A Multi-Region Access Point in front, so applications use one endpoint and AWS routes to the nearest bucket; failover controls can shift traffic.
- Replication Time Control if you need a predictable replication time with metrics.
- Conflict handling: the same key written in both Regions at the same time ends with the latest write winning; design keys so writers rarely collide (for example include a Region or unique ID).
- Test a Regional failover and check replication backlog metrics.
Q38. Account A replicates to a backup bucket in account B. Account B cannot read some replicas. How do you fix it? Senior
Likely causes:
- Ownership: replicas are owned by the source account unless you set owner override in the rule (and the destination bucket policy allows s3:ObjectOwnerOverrideToBucketOwner). With Object Ownership set to bucket owner enforced on the destination, account B owns everything.
- KMS: replicas are encrypted with a key that account B cannot use; replicate with a KMS key owned by account B.
- Bucket policy in B does not allow its own readers, or allows only the replication role.
Fix the rule and key, then re-copy affected objects with Batch Replication. For backups, also consider AWS Backup cross-account copies.
Q39. You must restore 40 TB from Deep Archive for an audit due in 5 days. How do you plan it? Senior
- Get the exact list of objects (S3 Inventory filtered by prefix and storage class) rather than restoring everything.
- Use S3 Batch Operations with the restore action; choose Standard retrieval (within about 12 hours) since Bulk (within about 48 hours) may also fit 5 days and is cheaper; Deep Archive has no Expedited tier.
- Set the restore Days long enough for the audit work.
- Restore throughput can be affected by request rates; start early and monitor the job report.
- Copy restored data to a working bucket if analysts need it longer, then delete that copy afterwards.
- Estimate cost before starting: retrieval per GB, requests, and temporary storage.
Q40. A website lets users upload files to S3. How do you stop malware from spreading through it? Senior
- Upload with presigned URLs into a quarantine prefix or bucket that nothing serves publicly.
- Scan each new object: GuardDuty Malware Protection for S3 can scan new objects and tag the result, or run your own scanner from an event.
- Move clean files to the serving bucket; quarantine or delete infected ones and alert.
- Validate type and size on the server side (do not trust the file extension), and serve downloads with Content-Disposition: attachment for untrusted types.
- Least privilege for the upload role, and logging of who uploaded what.
Q41. An S3 bucket has 3 billion objects and the team wants to delete everything older than 2 years except files tagged legal=keep. How do you do it safely? Senior
- Do not script DeleteObject calls by listing the bucket.
- Lifecycle rule: expire objects older than 730 days. Lifecycle filters cannot say "not tagged", so either tag the objects to delete, or move the legal=keep files to a separate prefix or bucket, or protect them with an Object Lock legal hold, which lifecycle cannot override.
- Test the rule on a copy or small prefix first; deletions by lifecycle are asynchronous and may take days.
- In a versioned bucket, add noncurrent version expiration too, or the data remains as old versions.
- Use Inventory before and after to report what was removed.
Q42. A partner needs to download 5 TB of public research data from your bucket every month, and your transfer bill is high. What are the options? Senior
- Requester Pays: the partner pays requests and transfer (they need AWS accounts).
- Serve through CloudFront with caching, which usually lowers per-GB cost and speeds downloads.
- If the partner uses AWS in the same Region, they can copy directly; transfer within the same Region is much cheaper than internet egress.
- Share via S3 Access Points or cross-account access for their accounts only.
- For truly public datasets, the AWS Open Data Sponsorship Program may cover storage and transfer.
Q43. A data pipeline writes the same daily file twice, and downstream jobs process it twice. How can S3 features help? Senior
- Conditional writes: write the daily file with If-None-Match "*" so a second writer gets 412 instead of overwriting.
- Deterministic keys (date-based names) instead of random names, so a retry targets the same key.
- Downstream jobs keep a processed-files list (for example a DynamoDB table keyed by key and ETag) and skip duplicates.
- S3 event notifications are delivered at least once; consumers must be idempotent anyway.
- Use checksums to confirm a rewritten file has the same content before reprocessing.
Q47. Twenty analytics teams share one data lake bucket with different prefixes. How do you manage access without a giant bucket policy? Senior
Options:
- S3 Access Points: one per team or application, each with its own policy and optional VPC-only network origin; the bucket policy delegates to access points.
- S3 Access Grants: map directory groups to prefixes and hand out scoped temporary credentials.
- AWS Lake Formation: table and column level permissions for data queried through Athena, Glue and Redshift.
Use Lake Formation when people query tables, Access Grants when users and groups access files directly, and access points when applications need their own entry. Keep the bucket policy short: deny insecure transport, require the organisation and delegate.
Q48. After each static site deploy to S3, users briefly see broken pages. Why, and how do you deploy safely? Senior
The upload is not atomic: for a short time, the new index.html can reference new JS and CSS files that are not uploaded yet, or old pages reference files that sync --delete just removed.
Safer pattern:
- Upload hashed asset files (app.3f9c2.js) first; they never overwrite anything.
- Then upload the HTML files that reference them.
- Delete old assets later (or with lifecycle after some days), not during the deploy.
- With CloudFront, set long cache times for hashed assets and short ones for HTML, and invalidate only the HTML paths.
Q49. A regulator asks you to prove a contract PDF stored 6 years ago has not changed. How do you show it with S3? Senior
- The object version is protected by Object Lock in compliance mode, so no one, including root, could change or delete it during retention; show its retention settings with get-object-retention.
- Show the stored checksum (head-object --checksum-mode ENABLED) and compare it with a checksum recorded at signing time in a separate system.
- CloudTrail data events (if enabled) or S3 server access logs show who accessed it.
- Versioning shows there is only one version, or which version is the original.
Together these give a clear chain of evidence. Without Object Lock, you can show integrity but not that nobody could have changed it.
Q50. A team deleted an S3 bucket by mistake. What can be recovered, and how do you prevent it next time? Senior
Once a bucket is deleted (it had to be empty first), its objects and versions are gone; S3 has no recycle bin for buckets. Recovery only comes from copies: replication targets, AWS Backup for S3 recovery points, or other exports.
The bucket name becomes available again after a while, and someone else could create it; check every system that still writes to that name.
Prevention:
- SCPs or permission policies denying s3:DeleteBucket except for a break-glass role.
- Bucket policies that deny deletion.
- Object Lock or AWS Backup (with a locked vault) for critical data.
- Infrastructure as code with deletion protection and review.
5. Frequently asked questions
Which S3 topics do experienced interviews focus on?
Lifecycle on versioned buckets, replication with KMS, large-scale operations (Inventory and Batch Operations), data protection (Object Lock, versioning, backups) and cost traps with small objects.
Is Amazon Glacier the same as the S3 Glacier storage classes?
No. The original Amazon Glacier service with vaults is a separate, older API, and AWS moved it to maintenance (no new customers) in late 2025. New designs use the S3 Glacier storage classes inside normal S3 buckets.
What should I practise?
Inspect objects with head-object, write a lifecycle rule for a versioned bucket, restore an object from an archive class, and generate an Inventory report and query it with Athena.
6. Quick revision
- head-object shows storage class, encryption, version and restore status.
- Lifecycle on versioned buckets needs rules for noncurrent versions, delete markers and incomplete multipart uploads.
- Replicating SSE-KMS objects must be enabled explicitly in the replication rule.
- Inventory plus Batch Operations is the pattern for changing millions of objects.
- Conditional writes (If-None-Match) stop two writers from overwriting the same key.
7. Related chapters
- AWS S3 and Storage Interview Questions and Answers (50 Questions on S3, EFS, FSx and Backup)
- S3 Versioning, Lifecycle Rules and Replication (SRR and CRR) Explained
- AWS CLI S3 Commands: cp, sync and s3api Examples
- 1000 AWS Interview Questions and Answers for Freshers and Experienced (Complete Set)
This page is one part of the complete AWS interview question set. Open the full list here: All 2052 AWS interview questions.