Skip to content

Full DevOps with Python

Linux to Kubernetes, automated with Python.

Go from shell basics to shipping a Python service through Docker, GitHub Actions, Terraform and Kubernetes on AWS, with monitoring. Python is the glue: you write the automation yourself instead of copying commands.

01Linux & networking foundations

The operating system and network every DevOps tool sits on.

  1. Filesystem, users & permissionsEvery file in Linux has an owner, a group and three sets of permission bits. Most 'permission denied' errors come from the wrong owner or a missing bit, so reading ls -l output fixes them fast.12 min
  2. Processes, services & systemdA process is a running program with a PID, an owner and resources. systemd starts services at boot, restarts them when they crash and collects their logs, which journalctl lets you read.10 min
  3. Bash scripting essentialsBash scripts glue Linux commands together into repeatable tasks. Quoting variables, checking exit codes and using strict mode make scripts fail loudly instead of silently doing damage.10 min
  4. Networking: TCP/IP, DNS, HTTP, SSHA web request travels through DNS to find an IP, TCP to open a connection, TLS to encrypt it and HTTP to ask for data. Knowing each layer tells you which tool to use when something breaks.10 min

02Python for automation

Enough Python to replace fragile shell scripts with tested tools.

  1. Python core: types, control flow, data structuresPython's built-in types and data structures cover most automation work. Knowing when to use a list, dict or set, and writing small functions, turns long shell scripts into readable tools.12 min
  2. Modules, packages, venv & pipModules and packages organise Python code into importable files and folders. A virtual environment gives each project its own Python packages, so projects never fight over versions.11 min
  3. Files, JSON, YAML & CLIs with argparseMost automation tools read a config file, accept command-line flags and write results. Python's json, PyYAML and argparse cover all three with very little code.11 min
  4. subprocess, pathlib & OS automationpathlib handles file paths cleanly and subprocess runs system commands from Python. Passing arguments as a list and checking return codes keeps automation safe and predictable.11 min
  5. Calling HTTP APIs with requestsThe requests library makes calling REST APIs simple. Real automation also needs timeouts, auth headers, status checks, retries with backoff and pagination.11 min
  6. Logging, error handling & pytestLogging shows what your automation did, specific exceptions explain what went wrong, and pytest proves it works before it touches real servers. Mocks let you test code that calls commands or APIs.12 min
  7. A small web service with FastAPIFastAPI builds web APIs from plain Python functions with type hints. Pydantic models validate requests automatically, and this small service is what you will containerise and deploy later.12 min

03Git for DevOps

Version control for code and infrastructure.

  1. Commits, branches, merges & pull requestsGit records snapshots of your code as commits. Branches let you work without breaking main, and pull requests let teammates review changes before they merge.13 min

04Containers with Docker

Package the app once, run it anywhere.

  1. Images, containers, volumes & networksAn image is a read-only template built from layers; a container is a running instance with its own writable layer. Volumes keep data after containers are removed, and user networks let containers find each other by name.13 min
  2. Dockerfiles & multi-stage builds for PythonA Dockerfile is the recipe for your image. Ordering layers for caching, using a slim base, a multi-stage build and a non-root user gives a small, fast and safer image.13 min
  3. Docker Compose for local stacksDocker Compose describes a multi-container app in one YAML file. One command starts the API, database and cache together, wired up with networking, volumes and health checks.11 min
  4. Registries & image taggingA registry stores and serves images so servers and clusters can pull them. Clear tags such as a version and the git SHA tell you exactly which code is running.11 min

05CI/CD pipelines

Every push is tested, built and shippable.

  1. CI/CD concepts & branching strategiesCI merges and tests every change automatically; CD keeps the result ready to release or ships it straight to production. A good pipeline fails fast on cheap checks and promotes one build through each environment.12 min
  2. GitHub Actions pipeline for the Python serviceA GitHub Actions workflow is a YAML file that runs jobs on GitHub's machines when events happen. For the Python service it lints and tests every push and PR, then builds and pushes the image only on main.11 min
  3. Jenkins pipelines (for interviews and legacy shops)Jenkins is a self-hosted automation server still common in older and enterprise setups. A declarative Jenkinsfile in the repo defines stages, agents, credentials and post-build actions.11 min

06Cloud with AWS

The core services most teams actually use.

  1. IAM, accounts & least privilegeIAM decides who can do what in an AWS account. Everything is denied by default, and policies grant only the actions and resources a person or service needs.13 min
  2. VPC, EC2, security groups & load balancersA VPC is your private network in AWS. Public subnets face the internet through a load balancer, while servers sit in private subnets reachable only through tightly scoped security groups.13 min
  3. S3, RDS & LambdaS3 stores files, RDS runs a managed relational database and Lambda runs code on demand. Together they cover storage, data and event-driven tasks without managing servers.14 min
  4. Automating AWS with boto3boto3 is the AWS SDK for Python. It lets you script audits and clean-ups, such as finding untagged instances, with real error handling and a dry-run mode before anything is deleted.12 min

07Infrastructure as Code

Servers and networks described in files you can review.

  1. Terraform basics: providers, resources, plan/applyTerraform describes infrastructure in HCL files and makes the real cloud match them. You always preview changes with plan before apply changes anything.12 min
  2. Terraform modules, variables & remote stateTerraform modules package infrastructure you can reuse, and variables make them configurable per environment. Remote state in S3 with locking lets a team share one source of truth without overwriting each other.12 min
  3. Ansible playbooks & rolesAnsible configures servers over SSH using YAML playbooks, with no agent to install. Tasks are idempotent, so running a playbook twice changes nothing the second time.11 min

08Kubernetes

Run containers at scale with self-healing and rollouts.

  1. Architecture, kubectl & a local clusterA Kubernetes cluster has a control plane that decides what should run and worker nodes that run it. You describe desired state with kubectl, and controllers keep reality matching it.13 min
  2. Deployments, Services, Ingress, ConfigMaps & SecretsA Deployment keeps a set number of identical Pods running and rolls out new versions. A Service gives them a stable address, an Ingress routes outside traffic in, and ConfigMaps and Secrets supply settings.13 min
  3. Helm chartsHelm packages Kubernetes manifests into a chart with templates and values. One chart installs the same app into dev and prod with different settings, and every upgrade can be rolled back.13 min
  4. Kubernetes Python clientThe official Kubernetes Python client talks to the same API as kubectl. It lets you script checks and clean-ups, like removing failed Pods, with real logic and a dry-run mode.11 min

09Monitoring & observability

Know when it breaks before users do.

  1. Prometheus & custom Python metricsPrometheus pulls numeric metrics from your services on a schedule and stores them as time series. You query them with PromQL and define alert rules that fire when something goes wrong.12 min
  2. Grafana dashboardsGrafana turns Prometheus queries into dashboards. A good service dashboard answers four questions at a glance: how much traffic, how many errors, how slow, and how full.10 min
  3. Centralised loggingCentralised logging collects logs from every container into one searchable place. Structured JSON logs with request IDs let you filter by service, level or a single user request.12 min

10Capstone project

One repo that shows everything end to end.

  1. FastAPI → Docker → Actions → Terraform → Kubernetes → GrafanaThe capstone ties every module into one repo: a tested FastAPI service, built into an image by GitHub Actions, deployed with Helm to Kubernetes on Terraform-built AWS infrastructure, and watched with Grafana.14 min