Foundations: Linux, scripting, Git & networking
Python & Bash automation
Most Senior DevOps interviews in Bangalore include a scripting round: "parse this log and find the top 10 IPs", "write a script that cleans up unused EBS volumes", "call an API with retries", or a live Bash/Python exercise. The Linux topic covers shell fundamentals; this topic goes further into production-grade Bash, Python for automation (boto3, the Kubernetes client, HTTP APIs), packaging and testing your tools, and worked solutions to the classic coding-round problems.
After this topic you can
- Write safe Bash scripts with error handling
- Automate AWS and API tasks in Python
- Turn repetitive manual work into reusable tools
Lessons
-
1Production-grade Bash
- A robust script skeleton
- Idioms worth knowing
- jq for JSON (AWS CLI, kubectl, APIs)
- When to switch from Bash to Python
-
2Python for automation
- A well-structured CLI tool
- boto3 essentials
- Kubernetes automation with Python
- HTTP APIs with retries
- Concurrency
- Packaging, dependencies and quality
-
3Classic coding-round problems with solutions
- 1. Top 10 client IPs from an access log
- 2. Count HTTP status codes and the 5xx ratio per minute
- 3. Disk usage alert across hosts
- 4. Find the largest files and directories
- 5. Validate that all Kubernetes Deployments have resource limits
- 6. Rotate/expire: delete S3 objects older than N days under a prefix (prefer lifecycle rules!)
- 7. Health-check a list of URLs concurrently and exit non-zero on failure
- 8. Parse YAML and diff two environment configs
- Approach in a live coding round
-
4Interview questions and model answers
- "What does set -euo pipefail do and what are its pitfalls?"
- "How do you handle pagination and throttling in boto3?"
- "When would you choose Python over Bash?"
- "How do you make an automation script safe to run in production?"
- "Threads or asyncio or processes in Python?"
- "Write a one-liner to find the top 5 URLs returning 500."