DEV Community

Haripriya Veluchamy
Haripriya Veluchamy

Posted on

πŸš€ Python for DevOps Week 2 & Week 3: Automating Daily Ops & Containerizing with Docker

In my Python-for-DevOps journey, Weeks 2 and 3 were all about turning theory into daily operational tools.
Here’s a recap concepts + projects so you can follow along if you’re learning too. for code checkout this repo https://github.com/Harivelu0/python-for-devops


πŸ›  Week 2: Automating DevOps Tasks with Python

🎯 Goal: Learn to automate daily DevOps operations with Python CLI tools.

πŸ“š Key Concepts Covered

  • Working with APIs β†’ Using requests to interact with REST APIs.
  • Automating SSH Tasks β†’ Using paramiko for remote command execution.
  • Cloud SDKs for Automation β†’

    • boto3 for AWS
    • google-cloud-sdk for GCP
  • Building CLI Tools β†’ Using argparse for structured command-line arguments.


πŸ”¨ Hands-on Projects

  1. AWS EC2 Instance Manager (boto3 + argparse)
  • Start, stop, and terminate EC2 instances via CLI.
  • Learned how to integrate Python with AWS SDK.
  • Added safety confirmation for termination.
  1. Kubernetes Pod Status Checker (kubectl + subprocess)
  • Runs kubectl get pods for a given namespace.
  • Parses and formats pod data for better readability.

πŸ’‘ Takeaway:
By the end of Week 2, I could write Python scripts that directly manage cloud resources and cluster workloads no manual clicking in the AWS Console or running repetitive kubectl commands.


🐳 Week 3: Docker & Python for Containerized Applications

🎯 Goal: Learn to containerize Python applications for portability and automation.

πŸ“š Key Concepts Covered

  • Dockerizing Python Apps β†’ Writing Dockerfile for Python scripts.
  • Running Python in Containers β†’ Understanding how to package and run apps in isolated environments.
  • Docker Compose β†’ Setting up multi-container environments.
  • Python SDK for Docker (docker-py) β†’ Managing containers programmatically.
  • System Metrics in Containers β†’ Using psutil inside containers to expose metrics.

πŸ”¨ Hands-on Projects

  1. Docker Manager CLI (subprocess)
  • Start, stop, restart, or remove containers from Python CLI.
  1. Dockerized Flask Metrics API (psutil)
  • Returns CPU & memory usage in JSON format.
  • Packaged into a Docker image for portability.

πŸ’‘ Takeaway:
Week 3 connected my Python skills to Docker I can now both control Docker from Python and run Python inside Docker. This is a huge step toward production-ready automation tools.


Top comments (1)

Collapse
 
suvrajeet profile image
Suvrajeet Banerjee

Amazing! πŸŽ‰πŸ†πŸ˜ƒ