Python Scenarios
Real-world Python scenario-based interview questions covering debugging, performance optimization, API design, asyncio, and production-grade Python patterns.
Scenario Labs
Clean Up Unused AWS Resources — EBS Volumes, EIPs, Old AMIs with Cost Report
Python script to find and delete unattached EBS volumes, unassociated Elastic IPs, and old AMIs, then produce a JSON cost-savings report.
Production-Grade Python Scripts for AWS — Best Practices & Patterns
Code examples covering structured logging, credential management, idempotent operations, environment configuration, Secrets Manager integration, and graceful error handling.
boto3 Retry Decorator with Exponential Backoff for ThrottlingException
Python decorator that adds automatic retry logic with exponential backoff and jitter to any boto3 API call, handling ThrottlingException and transient AWS errors.
Generic boto3 Pagination Utility — Handle All Paginated AWS APIs
Python utility function that handles pagination for any boto3 API call generically, with automatic NextToken handling, filtering support, and a lazy generator interface.
Multi-Account Security Report — Assume Roles Across All Org Accounts
Python script that uses AWS Organizations to list all accounts, assumes a cross-account role in each, audits security controls, and generates a consolidated report.
Trigger CodePipeline & Send Slack Notifications at Each Stage
Python script to start an AWS CodePipeline execution, poll stage progress, and post real-time Slack notifications as each stage succeeds, fails, or progresses.
CloudTrail Root Account Monitor — Alert on Root API Usage via Lambda
Lambda function triggered by EventBridge to detect any AWS root account API activity in CloudTrail and immediately send a critical security alert via SNS.
ECS Rolling Deployment with Automatic Rollback on Health Check Failure
Python script to deploy a new container image to an ECS service with rolling update strategy, monitor health, and automatically roll back if the deployment fails.
Security Group Audit — Find Unrestricted Inbound Rules (0.0.0.0/0)
Python script to audit all VPC Security Groups, identify rules that expose sensitive ports to the internet, and optionally auto-remediate critical findings.
EC2 Cost Analysis & Savings Plan Recommendations with Cost Explorer
Python script to analyse EC2 on-demand spend via AWS Cost Explorer and surface Savings Plan and Reserved Instance purchase recommendations with estimated savings.
RDS Snapshot Before Deployment & Point-in-Time Restore
Python script to create an RDS snapshot before every deployment and restore the database from that snapshot (or to a specific point in time) if a rollback is required.
Create CloudWatch Alarms for All EC2 Instances (CPU, Memory, Disk)
Python script to create CloudWatch alarms for every running EC2 instance covering CPU utilization, status checks, memory usage (via CWAgent), and disk space.
Deploy Lambda Function with Version Publishing & Alias Traffic Shifting
Python script to deploy or update a Lambda function, update environment variables, publish a new version, and create an alias with canary traffic shifting.
Generate Least-Privilege IAM Policy from CloudTrail Logs
Python script that analyses CloudTrail logs for a given IAM role and generates a minimal IAM policy containing only the actions the role actually used.
IAM Access Key Rotation — Auto-Rotate Keys Older than 90 Days
Python script to find all IAM users with access keys older than 90 days, create new keys, deactivate old ones, and notify users via AWS SES.
S3 Bucket Security Audit — Public Access, Versioning & Encryption
Python script to audit all S3 buckets for public access exposure, disabled versioning, missing encryption, and access logging gaps — with a compliance report.
Sync Local Directory to S3 with KMS Encryption & Manifest
Python script to sync a local directory to S3, encrypt every file with a KMS key, skip unchanged files via MD5 check, and produce a JSON upload manifest.
Find Untagged Long-Running EC2 Instances & Alert via SES
Python script to find EC2 instances running for more than 7 days without a Project tag and send a compliance alert email using AWS SES.
EBS Snapshot Manager — Auto Backup & Retention Cleanup
Write a Python boto3 script to snapshot all EBS volumes attached to running EC2 instances and automatically delete snapshots older than 30 days.
Python Scenario-Based Interview Questions
Real-world Python scenario questions covering debugging, performance, API design, asyncio concurrency, memory optimization, and production-grade patterns.
Auto Stop/Start EC2 Instances Using Schedule Tags with Python
Write a Python boto3 script that reads the AutoStop=true tag on EC2 instances and automatically stops them at 8 PM and starts them at 8 AM — with detailed explanation of every command.