← All insightsIntegration

How to use Python for DevOps with Amazon Web Services

Nir Geier, CodeWizard · 22 April 2025 · 3 min read · Intermediate

Python for DevOps and Amazon Web Services are a common pairing in a modern DevOps stack. Here is how they fit together and a practical way to wire them up.

Where Python for DevOps fits

Python is the default scripting language for DevOps automation: readable, batteries-included, and backed by SDKs for every cloud and tool, so you can replace brittle Bash with maintainable scripts.

python
import requests
from requests.adapters import HTTPAdapter, Retry

s = requests.Session()
s.mount('https://', HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5,
         status_forcelist=[502, 503, 504])))
r = s.get('https://api.example.com/health', timeout=5)
r.raise_for_status()
print(r.json())

Where Amazon Web Services fits

AWS is a broad public cloud spanning compute (EC2, ECS, EKS, Lambda), storage (S3, EBS), networking (VPC) and hundreds of managed services - best operated declaratively with IaC and least-privilege IAM.

hcl
data "aws_iam_policy_document" "read_assets" {
  statement {
    actions   = ["s3:GetObject"]
    resources = ["arn:aws:s3:::acme-assets/*"]
  }
}
resource "aws_iam_policy" "read_assets" {
  name   = "read-assets"
  policy = data.aws_iam_policy_document.read_assets.json
}

Making them work together

  • Use virtualenvs and pin dependencies (requirements.txt / pip-tools)
  • Add type hints and run mypy + ruff in CI
  • Use SSO for humans and OIDC roles for CI - no static keys
  • Write least-privilege IAM and manage everything via IaC

Want this pairing set up properly, with docs and handover? That is exactly the kind of work CodeWizard's embedded senior engineers do - and both Python for DevOps and Amazon Web Services have active community groups you can join for free.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult