Cloud & Container Security: Introduction
Most cloud breaches don't start with a clever exploit. They start with an access key pasted into a public repository, a storage bucket readable by anyone, a web application that can be tricked into fetching the instance's own credentials, or a role that was given * "just for now". Containers add their own version of the same story: a pod running privileged with the Docker socket mounted is one bad dependency away from owning the node. The attacker's path through a cloud account is mostly a path through configuration, and so is the defender's: the same JSON policies, security groups, audit events and manifests are where an attack is possible, where it shows up and where it is fixed.
This course looks at that configuration from two sides. The attacker's view asks what a leaked key, a vulnerable pod or a misconfigured bucket would let someone do next. The auditor's view asks how you would find that weakness before anyone else, how you would see it being used, and what change removes it. The DevOps courses taught you to build cloud and container infrastructure; here you review and attack-proof it.
The lab account
Every example uses the same fictional AWS-style organisation. It exists only as JSON, YAML and Terraform in the lessons; no example talks to a real cloud.
| Thing | Name in the lessons |
|---|---|
| Accounts | 123456789012 (production), 210987654321 (development), 999988887777 (an outside vendor) |
| Region and network | eu-west-1, VPC 10.10.0.0/24 split into public .0/26, app .64/26, data .128/26 |
| People and machines | users alice (developer), bob (operations), CI role ci-deploy, instance role app-role |
| Data | buckets lab-public-site, lab-app-uploads, lab-trail-123456789012; KMS key alias/lab-data |
| Names and outside addresses | *.lab.test; 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 (RFC 5737) |
Account IDs, ARNs, key IDs and "secrets" in this course are invented. Where an example needs something that looks like an access key, it is a made-up string in the right format, never a real one.
What you will be able to do
| Section | Questions it answers | What you run |
|---|---|---|
| Identity and access | How does AWS decide allow or deny? Which policies are over-broad, which let a user make themselves admin? Who can assume which role? | a policy evaluator in Python, grown lesson by lesson, an escalation finder, a trust-policy checker |
| Cloud networking | What is actually reachable from the Internet? Where can data leave? | a reachability model over routes, security groups and NACLs |
| Data and secrets | Which buckets are public? How does KMS envelope encryption work? What do you do when a key leaks? | a bucket-exposure evaluator, AES-GCM envelope encryption, Trivy's secret scanner |
| Logging and detection | What does a CloudTrail, Activity Log or Audit Log event contain? How do you detect root use, MFA removal, new keys, policy changes? | detection rules over synthetic events |
| Instance metadata | Why is IMDSv1 dangerous with SSRF, and how do IMDSv2 and the hop limit fix it? | an IMDS model, a credential-misuse detection |
| Containers | What really isolates a container? Which settings break that isolation? How does runtime detection see an escape attempt? | capability decoding, Trivy on Dockerfiles, a Falco-style rule engine |
| Kubernetes | Who can do what in the cluster? Are pods hardened, traffic restricted, admissions checked? | an RBAC and NetworkPolicy evaluator, Trivy on manifests, audit-log detections |
| IaC and posture | Which misconfigurations can be caught before deployment, and which only in the running account? | Trivy on Terraform and CloudFormation, a custom Rego check, a posture checker |
How the examples run
```python runexamples run in your browser (Pyodide) on data written into the example: policies, events, inventories, manifests. Change them and run them again; most lessons invite you to.```bash runblocks are recorded sandbox sessions of Trivy 0.76.1 (misconfiguration and secret scanning, with its checks built in) in a container with no network at all: it scans files the session writes, nothing else.- Cloud consoles and CLIs,
kubectlagainst a cluster, Falco and the providers' detection services can't run there; they appear as plain```consoletranscripts labelled lab session, on the lab account.
Here is the first review of the course: a two-resource Terraform file, the kind a developer writes in ten minutes, checked before it is deployed.
cat > main.tf <<'TF'
resource "aws_security_group" "bastion" {
name = "bastion"
description = "bastion host"
ingress {
description = "ssh"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_instance" "app" {
ami = "ami-0123456789abcdef0"
instance_type = "t3.micro"
root_block_device { encrypted = true }
}
TF
trivy config -q -f json . | jq -r '.Results[].Misconfigurations[]? | "\(.Severity) \(.ID) \(.Title)"'HIGH AWS-0028 aws_instance should activate session tokens for Instance Metadata Service.
HIGH AWS-0107 Security groups should not allow unrestricted ingress to SSH or RDP from any IP address.
Two findings that recur through the whole course: an instance whose metadata service still accepts requests without a session token (IMDS) and SSH open to the whole Internet (network exposure). Neither is a bug in AWS; both are configuration, and both cost one line to fix.
The rules this course keeps
- Authorization first. Testing a cloud account, a cluster or a container platform you don't own, or without written permission, can be a crime, and cloud providers have their own policies for what customers may test even in their own accounts. Read Authorization, Scope and Rules of Engagement and the law lessons of Security Foundations before practising anything here on real infrastructure.
- Mechanism → detection → fix. Every attack (metadata credential theft, over-broad IAM, container escape classes, exposed buckets, leaked keys) is explained as a mechanism, then how it appears in logs and scanners, then the change that prevents it. No lesson stops at the attack, and none contains a working exploit.
- Only synthetic targets. Python models, configuration files written in the lesson and Trivy scans of those files. No real accounts, no real credentials, no scanning of cloud address ranges.
Before you start
You should be comfortable with the material of AWS Cloud (IAM, VPC, S3, CloudTrail), Docker and Kubernetes, and with the vocabulary of Security Foundations. Azure & Google Cloud helps for the cross-cloud comparisons, and Secrets & Policy as Code and Software Supply Chain Security cover Vault, OPA, signing and image scanning, which this course links to rather than repeats. The one-page overview Cloud Security Basics in the survey course is a good warm-up.
Test yourself
Where do most cloud attack paths in this course run?
- Through zero-day bugs in the hypervisor
- Through configuration: policies, network rules, bucket settings, manifests and leaked credentials
- Through physical access to data centres
- Through the cloud provider's billing system
What did the first Trivy scan find in the Terraform file?
- Nothing
- An unencrypted disk only
- SSH open to 0.0.0.0/0 and IMDS without required session tokens
- A leaked access key
What do the sandbox sessions of this course scan?
- The lab account in AWS
- Public cloud address ranges
- Only files the session itself writes, with no network
- The learner's own cloud account