You need to process every new file uploaded to an S3 bucket with Python. Design it.
IntermediateScenarioAWS automation with boto3
Answer
Situation read → Event-driven processing; must handle bursts and failures.
What I'd do →
- S3 event notification to SQS (or EventBridge), with a Lambda or container worker consuming from SQS.
- Worker parses the event, URL-decodes the key (
urllib.parse.unquote_plus, keys arrive encoded), processes, and deletes the message only on success. - Configure a dead-letter queue and alarm on its depth.
- Make processing idempotent (S3 can deliver events more than once), keyed on bucket, key and version or ETag.
Why → A queue buffers bursts and gives retries plus a DLQ for free.
Interview tip → The unquote_plus detail catches many people; keys with spaces arrive as +.
More on AWS automation with boto3
You are asked to write a script that stops all dev EC2 instances at 8 PM and starts them at 8 AM. How do you build it?BeginnerA script that lists all S3 objects in a bucket reports 1,000 objects, but the console says there are 48,000. What happened, and how do you fix the script?BeginnerYou need to find and delete EBS snapshots older than 90 days, but some are used by AMIs and backup plans. How do you write it safely?IntermediateYour audit script hits `ThrottlingException` / `RequestLimitExceeded` when scanning large accounts. What do you change?AdvancedYou must audit 40 AWS accounts in an Organization from one script. How do you handle credentials?AdvancedA Lambda written in Python times out at 15 minutes while processing a big S3 prefix. What are your options?Advanced