Cloud Security Basics
Moving to the cloud (AWS, Azure, Google Cloud and others) changes who secures what, and it changes which mistakes are most common. Cloud providers are very good at securing their data centres; most cloud breaches come from customers' misconfigurations and stolen credentials.
The shared responsibility model
The provider secures the cloud itself; you secure what you put in it. Where the line falls depends on the service type:
| Layer | On-premises | IaaS (VMs) | PaaS (managed DB, app hosting) | SaaS (email, CRM) |
|---|---|---|---|---|
| Physical data centre, hardware | You | Provider | Provider | Provider |
| Virtualisation, network fabric | You | Provider | Provider | Provider |
| Operating system, patching | You | You | Provider | Provider |
| Runtime, middleware | You | You | Provider | Provider |
| Application code | You | You | You | Provider |
| Configuration, identities, access | You | You | You | You |
| Your data | You | You | You | You |
Whatever the model, identity, configuration and data always remain your responsibility.
LAYERS = ["facility", "hardware", "hypervisor", "os", "runtime", "application", "identity", "data"]
PROVIDER_UP_TO = {"on-prem": -1, "iaas": 2, "paas": 4, "saas": 5} # index of last provider layer
def responsibilities(model):
cut = PROVIDER_UP_TO[model]
return [layer for i, layer in enumerate(LAYERS) if i > cut]
for model in PROVIDER_UP_TO:
print(f"{model:<8} you secure: {', '.join(responsibilities(model))}")on-prem you secure: facility, hardware, hypervisor, os, runtime, application, identity, data
iaas you secure: os, runtime, application, identity, data
paas you secure: application, identity, data
saas you secure: identity, data
Identity is the new perimeter
In the cloud, anyone with valid credentials can reach the management API from anywhere on the internet. Identity and Access Management (IAM) is therefore the most important control:
- No long-lived access keys for people; use single sign-on with MFA. For workloads, use roles with short-lived credentials.
- Lock away the root / global admin account: MFA (preferably a hardware key), no daily use, alerts on any login.
- Least privilege policies: grant specific actions on specific resources, not
*on*. - Separate accounts/projects for production, development and security tooling, to limit the blast radius.
Cloud IAM policies are documents evaluated per request. AWS, for example, uses deny by default, then explicit deny overrides any allow. A simplified evaluator:
from fnmatch import fnmatch
POLICY = [
{"effect": "Allow", "action": "s3:GetObject", "resource": "arn:aws:s3:::reports/*"},
{"effect": "Allow", "action": "s3:PutObject", "resource": "arn:aws:s3:::uploads/*"},
{"effect": "Deny", "action": "s3:*", "resource": "arn:aws:s3:::reports/confidential/*"},
]
def evaluate(action, resource):
matching = [s for s in POLICY if fnmatch(action, s["action"]) and fnmatch(resource, s["resource"])]
if any(s["effect"] == "Deny" for s in matching):
return "DENY (explicit)"
if any(s["effect"] == "Allow" for s in matching):
return "ALLOW"
return "DENY (implicit)"
requests = [
("s3:GetObject", "arn:aws:s3:::reports/2026/q1.pdf"),
("s3:GetObject", "arn:aws:s3:::reports/confidential/salaries.xlsx"),
("s3:DeleteObject", "arn:aws:s3:::reports/2026/q1.pdf"),
("s3:PutObject", "arn:aws:s3:::uploads/photo.png"),
]
for action, resource in requests:
print(f"{action:<16} {resource.split(':::')[1]:<36} {evaluate(action, resource)}")s3:GetObject reports/2026/q1.pdf ALLOW
s3:GetObject reports/confidential/salaries.xlsx DENY (explicit)
s3:DeleteObject reports/2026/q1.pdf DENY (implicit)
s3:PutObject uploads/photo.png ALLOW
The most common misconfigurations
| Misconfiguration | Risk | Fix |
|---|---|---|
| Public storage bucket | Data leak | Block public access at account level; share via signed URLs |
Security group open to 0.0.0.0/0 on SSH/RDP/DB ports |
Brute force, exploitation | Allow only specific sources, use a bastion or session manager |
| Access keys in code or CI logs | Account takeover | Secret scanning, short-lived credentials |
| Logging (CloudTrail, Activity Log) disabled | Attacks invisible | Enable organisation-wide, store in a separate account |
| Unencrypted volumes and snapshots | Exposure if copied | Default encryption with KMS keys |
| Instance metadata reachable via SSRF | Credential theft | Require IMDSv2 (token-based), validate outbound URLs |
Cloud Security Posture Management (CSPM) tools continuously scan for such issues. The idea in miniature:
resources = [
{"id": "bucket/customer-exports", "type": "bucket", "public": True, "encrypted": True},
{"id": "bucket/static-site", "type": "bucket", "public": True, "encrypted": True, "website": True},
{"id": "sg/db", "type": "security_group", "ingress": [("0.0.0.0/0", 5432)]},
{"id": "sg/web", "type": "security_group", "ingress": [("0.0.0.0/0", 443)]},
{"id": "vol/backup-1", "type": "volume", "encrypted": False},
]
RISKY_PORTS = {22, 3389, 3306, 5432, 6379}
for r in resources:
issues = []
if r["type"] == "bucket" and r["public"] and not r.get("website"):
issues.append("public bucket")
if r["type"] == "security_group":
issues += [f"port {port} open to the internet" for src, port in r["ingress"]
if src == "0.0.0.0/0" and port in RISKY_PORTS]
if r["type"] in ("bucket", "volume") and not r.get("encrypted", False):
issues.append("not encrypted")
print(f"{r['id']:<24} {'; '.join(issues) if issues else 'ok'}")bucket/customer-exports public bucket
bucket/static-site ok
sg/db port 5432 open to the internet
sg/web ok
vol/backup-1 not encrypted
The static website bucket is meant to be public, so it's marked as an exception: good tools let you record intentional exceptions with a reason instead of ignoring the alert forever.
Infrastructure as code
Defining infrastructure in code (Terraform, CloudFormation, Bicep, Pulumi) makes security reviewable: changes go through pull requests, scanners such as Checkov or tfsec check them before deployment, and drift from the approved state can be detected. The same file that creates a bucket can enforce encryption and block public access:
resource "aws_s3_bucket_public_access_block" "exports" {
bucket = aws_s3_bucket.exports.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}Containers and serverless
Containers and functions shift more responsibility to the provider but add their own concerns: scan images for vulnerable packages, run containers as non-root with read-only file systems, keep secrets in the platform's secret store rather than in images or environment files committed to git, and give each function its own narrowly scoped role.
Go further: Shared Responsibility in IaaS, PaaS, SaaS and Containers opens Cloud & Container Security, which covers IAM, storage exposure, metadata and Kubernetes.
Test yourself
In the shared responsibility model, which is ALWAYS the customer's responsibility?
- Physical security of the data centre
- Hypervisor patching
- Identity/access configuration and their data
- Network hardware
In AWS-style IAM evaluation, a request matches both an Allow and an explicit Deny statement. What is the result?
- Allow
- Deny
- The first statement wins
- An error
What is the most common cause of cloud data breaches?
- Providers' hardware failures
- Customer misconfiguration and stolen credentials
- Quantum computers
- Hypervisor exploits