Your script uses `boto3.resource("ec2")` and a new team member asks whether to keep using resources. What do you advise?
BeginnerScenarioAWS automation with boto3
Answer
Situation read → AWS has feature-frozen the resource interface.
What I'd do →
- Keep existing working code, but write new code with clients.
- Clients cover every API and new features; resources will not get new services or operations.
- Clients return plain dicts, which are easy to test with moto or Stubber and to type with boto3-stubs.
Why → Long-term maintainability and full API coverage.
Interview tip → Know that the resource interface is frozen; it often comes up.
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