Welcome! This 14-day guide will help you learn Python for DevOps. You'll go from writing simple scripts to automating cloud tasks.
Goal: By the end, you will be able to use Python to automate tasks, build pipelines, and manage cloud resources.
- Easy to Learn: Python is readable and great for beginners.
- Powerful: It connects easily with tools like AWS, Jenkins, and GitHub.
- Popular: Most DevOps tools support Python.
- Start at Day 1: Go to the
Day-01/folder and follow theREADME.mdinstructions to set up your computer. - One Day at a Time: Work through one folder each day.
- Practice: Type out the code examples yourself.
- Ask Questions: If you get stuck, search online or ask a community.
- Computer: Mac, Windows, or Linux.
- Internet: To download tools and read documentation.
- Time: About 1 hour per day.
| Day | Theme | Repo Guide | Outcomes |
|---|---|---|---|
| 1 | Environment bootstrap | Day-01/ |
Install Python, configure editor, run first script, document goals. |
| 2 | Data types & strings | Day-02/ |
Work with core types, string formatting, regex for log parsing. |
| 3 | Variables & configuration | Day-03/ |
Manage scope, constants, and configuration patterns. |
| 4 | Functions & modularity | Day-04/ |
Build reusable helpers, packages, and testable modules. |
| 5 | Command-line interfaces | Day-05/ |
Handle env vars, CLI arguments, and .env secrets. |
| 6 | Files, logging, and operators | Day-06/ |
Read/write configs, log events, apply Python operators. |
| 7 | Conditional logic | Day-07/ |
Build guard clauses, deployment gates, and decision trees. |
| Day | Theme | Repo Guide | Outcomes |
|---|---|---|---|
| 8 | Collections & data structures | Day-08/ |
Model inventories with lists, tuples, dictionaries, and sets. |
| 9 | Loops & iteration patterns | Day-09/ |
Master for/while loops, loop controls, and pagination patterns. |
| 10 | HTTP, REST, and auth basics | Day-10/ |
Explore requests, API tokens, pagination, JSON parsing. |
| 11 | Automate GitHub repository creation | Day-11/ |
Use GitHub REST API to create repos, manage descriptions, and initialize files. |
| 12 | Manage Jenkins jobs via API | Day-12/ |
Authenticate with Jenkins, create/update jobs from Python, trigger builds. |
| 13 | Provision SonarQube projects | Day-13/ |
Call SonarQube APIs to create projects, generate tokens, configure quality profiles. |
| 14 | AWS inventory & tag auditing | Day-14/ |
Use boto3 to inventory resources and enforce tagging standards. |
🎯 Capstone idea (optional): Stitch together the GitHub, Jenkins, SonarQube, and AWS scripts into a single onboarding pipeline once you finish Day 14.
Day-11/examples/create_github_repo.py— Create and configure a GitHub repository via REST API.Day-12/examples/jenkins_job_provisioner.py— Define or update Jenkins jobs with XML payloads using Python.Day-13/examples/sonarqube_project_setup.py— Register SonarQube projects and provision tokens for CI.Day-14/examples/aws_tag_audit.py— Enumerate AWS resources filtered by tag key/value pairs.simple-python-app/app.py— Lightweight Flask app for CI/CD experiments.
- Tinker daily. Adjust arguments, change payloads, and observe API responses to deepen understanding.
- Secure secrets. Use
.envfiles or secret managers; never commit tokens. Later days include helpers for this. - Automate validation. Pair scripts with smoke tests—e.g., call the GitHub API to verify repo creation succeeded.
- Reflect often. Set a daily 5-minute retrospective to note what clicked and what needs review.
- Extend the AWS scripts to remediate resources missing required tags.
- Add Slack or Teams notifications around Jenkins job creation.
- Containerize the tooling and wire it into a self-service developer portal.
- Share progress on LinkedIn or internal wikis to gather feedback and stay accountable.
Happy automating! 🚀