Skip to main content

Security best practices

A control catalogue for AWS workloads, organised by security domain. Each entry states what the control is, why it matters, and the AWS service that implements it.

01 — Security governance​

Role-based access control​

Permissions are defined by job function, not by person. In IAM this means policies per role, attached to groups, granted at the least privilege necessary.

The limitation of pure RBAC is that policies must be updated when new resources appear. Attribute-based conditions — tagging, aws:PrincipalTag, resource tags — reduce that maintenance and are preferred where the pattern is stable.

Permission sets as code​

Permission sets, groups and assignments are deployed as Terraform from a reviewed repository:

  1. Define groups, policies and group-to-policy links in var-* files.
  2. Apply to a single account or across the organisation.
  3. Link permission sets to the accounts and groups that need them.
  4. Verify by signing in as a test user in each role.
  5. Change by pull request — only the changed policy is reapplied.

This makes access review a diff, not an audit.

02 — Security assurance​

AWS Audit Manager​

Audit Manager continuously collects evidence against a framework — CIS, PCI DSS, SOC 2, GDPR, HIPAA, ISO 27001 — and produces audit-ready reports. Use it where the customer has a recurring audit obligation and the manual evidence pack is costing more than the service.

The framework is selected once; controls are mapped; evidence collection is automatic; stakeholder review happens in the tool rather than in email.

03 — Identity and access management​

Access key rotation​

Where long-lived keys cannot be eliminated:

DayAction
0Key created
90New key generated, stored in Secrets Manager, owner notified
100Old key deactivated
110Old key deleted

Automated with EventBridge and Lambda. Manual rotation processes decay; this one does not depend on anyone remembering.

IAM user creation notification​

A CloudWatch Events rule on CreateUser triggers a Lambda that notifies the security channel and records the event in Security Hub. In an organisation where users should be created only through federation, any CreateUser is an anomaly worth knowing about immediately.

Compromised credentials​

GuardDuty finding (credential misuse)
→ EventBridge rule
→ SNS notification to security on-call
→ Lambda: deactivate the access key / attach deny policy to the role
→ Incident opened

The automated step is containment, not resolution. A human investigates.

Role credential exfiltration​

An instance compromise followed by metadata-service credential theft is detected by GuardDuty. The response attaches a policy that revokes all active sessions for the role, within minutes, then notifies.

Prevention complements detection: IMDSv2 required by SCP, and instance roles scoped so that a stolen credential is worth less.

04 — Threat detection​

Security operations​

SignalSourceResponse
Unusual API activityGuardDutyInvestigate principal and source
Malicious IP communicationGuardDuty with threat intelIsolate the instance
Crypto-miningGuardDutyTerminate, investigate entry point
Unauthorised API callsCloudTrail metric filterAssess identity and intent
Root loginCloudTrail alarmIncident — root should not be used
Config driftConfigRevert, investigate access
Posture findingSecurity HubTriage against severity and exposure

Guardrails​

Control Tower preventive and detective controls, described in Control Tower.

Security Hub​

Aggregates findings from GuardDuty, Inspector, Config, IAM Access Analyzer, Firewall Manager, Macie and third-party tools into one view, scored against enabled standards.

05 — Vulnerability management​

Amazon Inspector​

Continuous scanning of EC2 instances, container images in ECR, and Lambda functions. Findings are prioritised by exploitability and network reachability, which is more useful than raw CVE count.

AssetScan trigger
EC2On launch and continuously
ECR imageOn push and continuously
LambdaOn deploy and continuously

Findings route to the owning team and into the deployment readiness checklist.

06 — Infrastructure protection​

ControlServicePurpose
DDoS protectionAWS Shield Standard / AdvancedAbsorb volumetric attacks
Web application firewallAWS WAFBlock injection, bot and abuse patterns
Network firewallAWS Network FirewallEgress filtering and domain allow-lists
Central policyAWS Firewall ManagerApply WAF and Shield policy across accounts
Host-level rulesSecurity groups and NACLsSegmentation
Patch stateSystems ManagerInventory and patch compliance

See Infrastructure protection.

07 — Data protection​

KMS​

  • Separate keys per data classification and per service boundary.
  • Key policy restricts administration and use separately.
  • Automatic rotation enabled where the service supports it.
  • Grants for cross-account access, not broad key policies.
  • Deletion requires a waiting period and an alarm.

Secrets Manager​

  • Secrets never in code, environment files or images.
  • Automatic rotation for database credentials where supported.
  • Resource policy restricts retrieval to specific roles.
  • Access logged in CloudTrail.
  • Parameter Store for non-secret configuration.

08 — Application security​

WAF automations​

Managed rule groups for common threats, plus custom rules for the application's own abuse patterns:

  • IP reputation and anonymous proxy lists.
  • SQL injection and cross-site scripting rules.
  • Rate limiting per IP and per session.
  • Bot control on endpoints that should not be automated.
  • Geo restrictions where the customer's user base justifies them.

09 — Incident response​

Security Hub automation​

Findings above a severity threshold create a ticket and notify the on-call channel automatically. Below the threshold, they aggregate into a daily digest.

GuardDuty finding response​

Finding → EventBridge → Lambda
├── tag the resource for investigation
├── isolate the instance (replace security group)
├── snapshot volumes for forensics
└── notify security on-call

AWS Detective​

Used after a finding to build the behaviour graph: which principals, which resources, which IPs, over what time. Detective answers "what else did this identity touch?" — the question that determines incident scope.

Appendix — RBAC model​

CategoryServiceDescriptionRoles
PlatformIAM, Organizations, Control TowerIdentity and account governancePlatform admin, Security auditor
NetworkVPC, Route 53, CloudFront, WAFConnectivity and edgeNetwork admin
ComputeEC2, ECS, EKS, LambdaWorkload runtimeDeveloper, Platform operator
DataRDS, DynamoDB, S3, ElastiCachePersistenceDBA, Data engineer
SecurityGuardDuty, Security Hub, Config, InspectorDetection and complianceSecurity analyst
ObservabilityCloudWatch, X-Ray, QuickSightMonitoringSRE, Developer
FinanceBudgets, Cost Explorer, CURCostFinOps analyst