A colleague wants to use `boto3` from inside a Kubernetes pod with access keys mounted as a Secret. What do you suggest?
BeginnerScenarioAWS automation with boto3
Answer
Situation read → Long-lived keys in a cluster are avoidable.
What I'd do →
- On EKS, use EKS Pod Identity or IRSA: bind an IAM role to the pod's service account.
- boto3 picks up the credentials automatically (web identity token or container credentials endpoint); no code change.
- Scope the role to the specific actions and resources.
Why → Short-lived, automatically rotated credentials tied to one workload.
Interview tip → Mention that a recent boto3 version is needed for Pod Identity support; old images fail with NoCredentialsError.
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