Cloud & Infrastructure
18 practices · AWS Well-Architected Security Pillar + general infra hardening
Account-level controls for the cloud estate — identity, network boundaries, encryption, logging and recovery. For a fast pass over a single AWS account, use the AWS Quick Checklist instead.
Ticking these off for a specific project? The Project Security Checklist tracks all nine categories in one place. For why these patterns keep recurring, see Security Best Practices.
1. Enforce MFA Everywhere, Retire Root Use
DescriptionEvery human identity that can reach the cloud console — especially the root/organization account — should require multi-factor authentication. Lock the root account away (hardware MFA in a vault) and never use it day to day; create an admin IAM role instead.
Exampleaws iam enable-mfa-device --user-name alice ...
// Org-level guardrail (SCP):
"Condition": { "BoolIfExists":
{ "aws:MultiFactorAuthPresent": "false" } } → Deny *
2. Least-Privilege IAM & Short-Lived Credentials
DescriptionGrant only the specific actions and resources a role needs — never Action:"*" — and issue temporary, auto-expiring credentials via STS/SSO instead of long-lived access keys that can leak.
Example{
"Effect": "Allow",
"Action": ["s3:GetObject"],
"Resource": "arn:aws:s3:::app-uploads/*"
}
// scoped to one bucket, one action — not AdministratorAccess
3. Secrets Manager With Automatic Rotation
DescriptionDatabase passwords, API keys, and service credentials live in a secrets manager (AWS Secrets Manager, Vault) with rotation scheduled automatically — not in .env files, Dockerfiles, or CI variables that outlive the person who set them.
Exampleaws secretsmanager rotate-secret \
--secret-id prod/db/password \
--rotation-lambda-arn arn:...:rotateFn \
--rotation-rules AutomaticallyAfterDays=30
4. Encrypt Data at Rest by Default
DescriptionTurn on KMS-backed encryption for every S3 bucket, EBS volume, and RDS instance by default — via account-level policy, not a per-resource checkbox someone might forget.
ExampleS3 → Default encryption: SSE-KMS
EBS → "Always encrypt new volumes" account setting: ON
RDS → StorageEncrypted: true
5. TLS Everywhere, No Exceptions
DescriptionEvery connection — client-to-server, service-to-service, and service-to-database — runs over TLS 1.2+. Certificate validation is never disabled, even temporarily, even in a script that "just needs to run once."
Example// Node/Postgres — never do this:
{ ssl: { rejectUnauthorized: false } }
// Instead: mount the CA bundle and validate it properly
6. Network Segmentation
DescriptionPut anything that isn't meant to be public in a private subnet, and use security groups as a default-deny allowlist between tiers — the database should only ever hear from the application layer, never the internet.
ExampleDB security group inbound:
only from app-tier SG, port 5432
No 0.0.0.0/0 rules on anything but the public ALB
7. WAF & DDoS Protection at the Edge
DescriptionPut a Web Application Firewall (AWS WAF, Cloudflare) in front of public endpoints to block common attack patterns before they reach application code, and enable managed DDoS protection for anything public-facing and important.
ExampleAWS WAF managed rule groups:
AWSManagedRulesCommonRuleSet
AWSManagedRulesSQLiRuleSet
attached to CloudFront / ALB
8. Session Manager Instead of Open SSH
DescriptionAccess EC2 instances through AWS Systems Manager Session Manager (or a bastion behind SSO+MFA) instead of exposing port 22 to the internet — every session is logged and requires no long-lived SSH key.
Exampleaws ssm start-session --target i-0123456789abcdef0
# security group: no inbound 22 from 0.0.0.0/0
9. Centralized Logging & Real-Time Alerting
DescriptionEvery account feeds CloudTrail, VPC Flow Logs, and application logs into a central SIEM, with GuardDuty/Security Hub findings routed to an on-call channel — logs nobody looks at are not a control.
ExampleGuardDuty finding → EventBridge rule → SNS → PagerDuty
(not just "visible in a dashboard someone might check")
10. Data Classification & Handling Policy
DescriptionNot all data needs the same protection — tag and classify data (public/internal/confidential/restricted) so encryption, retention, and access requirements scale with sensitivity instead of being applied uniformly or not at all.
ExampleS3 bucket tag: DataClassification=Restricted
→ triggers stricter bucket policy + access logging
11. Centralize Identity With SSO
DescriptionFederate every account through a single identity provider (Okta, Azure AD, AWS IAM Identity Center) instead of creating individual IAM users per account. Offboarding becomes one action instead of a checklist across a dozen systems.
ExampleIAM Identity Center → permission sets mapped to
AD/Okta groups
(no per-account IAM users for humans)
12. Automated Patch Management
DescriptionOS and dependency patching runs on a schedule via Systems Manager Patch Manager (or equivalent), not as a manual quarterly task someone remembers eventually — critical patches roll out in days, not months.
ExampleSSM Patch Manager:
patch baseline auto-approves
Critical/Security patches after 2 days
13. Infrastructure as Code + Security Scanning
DescriptionInfrastructure is defined in Terraform/CloudFormation, version-controlled, and scanned by a policy tool (tfsec, Checkov) in CI before it's ever applied — catching a public bucket or open security group before it exists.
Examplecheckov -d ./infra --check CKV_AWS_18,CKV_AWS_20
# fails the PR on a public bucket or missing encryption
14. Container & Image Security
DescriptionBase container images come from a trusted, minimal source (distroless/alpine), are scanned for known CVEs before deploy, and run as a non-root user with a read-only filesystem where possible.
ExampleFROM gcr.io/distroless/nodejs20
USER 1000
# + trivy image scan in CI, fail on HIGH/CRITICAL
15. Tested Backups & Disaster Recovery
DescriptionAutomated backups exist for every stateful service, and — critically — someone has actually restored from one recently. An untested backup is a hope, not a plan.
ExampleQuarterly game-day:
restore prod DB snapshot to a scratch VPC,
verify row counts + app boot, time the whole thing
16. Multi-Account Strategy With Guardrails
DescriptionSeparate prod, staging, and dev into different AWS accounts under an Organization, with Service Control Policies enforcing account-wide guardrails that even an admin in that account can't override.
ExampleSCP: Deny cloudtrail:StopLogging, cloudtrail:DeleteTrail
attached at the Organizational Unit level
17. Configuration Drift Detection & CSPM Scanning
DescriptionContinuously evaluate live infrastructure against your intended policy and known-bad patterns — public buckets, open security groups, disabled logging — using AWS Config/OPA for drift and a cloud security posture management (CSPM) tool for broader benchmark checks, so a manual console change gets flagged and reverted before an attacker finds it first.
ExampleAWS Config rule: s3-bucket-public-read-prohibited
→ auto-remediation Lambda re-blocks public access
Prowler / Security Hub (CSPM), scheduled daily scan
vs. CIS AWS Foundations Benchmark → Slack alert
18. Incident Response Plan & Game Days
DescriptionHave a written runbook for "what do we do when X happens" (leaked key, ransomware, data exposure) before it happens, and rehearse it at least annually — the first incident is a bad time to design the process.
ExampleTabletop: "Our Stripe key just appeared in a public repo."
Walk the runbook: rotate → audit usage → notify → postmortem
Last updated: September 2026 · Source: Offspring — Security Best Practices.pptx (Part 4) + Security Best Practices Checklist.xlsx