Short answer: Lock down the root user, put production in its own account under AWS Organizations, sign people in through IAM Identity Center with MFA, use OIDC for pipelines, turn on an organisation-wide CloudTrail, GuardDuty, AWS Config and Security Hub CSPM, and protect data with S3 Block Public Access, default EBS encryption and private subnets.
1. Lock down the root user
Every AWS account has a root user that can do anything. Give it MFA (a hardware key where you can), delete any root access keys, and stop using it for day-to-day work. AWS’s own security standard checks for exactly these.
Check where you stand: RootMFA should be 1 and RootAccessKeys 0.
aws iam get-account-summary \
--query 'SummaryMap.{RootMFA:AccountMFAEnabled,RootAccessKeys:AccountAccessKeysPresent}'2. Separate accounts, with guardrails
Put production in its own account, inside AWS Organizations, and use service control policies for the rules no one should be able to break, such as switching off logging. See an AWS account structure for a growing company.
3. People sign in through IAM Identity Center
Connect IAM Identity Center to your identity provider and require MFA. People get temporary credentials for the account and role they need. Then remove IAM users and their long-lived access keys, which are a common cause of breaches.
The credential report lists every IAM user, whether they have MFA, and when each access key was last used:
aws iam generate-credential-report aws iam get-credential-report --query Content --output text | base64 --decode > credential-report.csv
4. Pipelines use OIDC, not keys
CI/CD pipelines should assume a role with short-lived credentials instead of storing access keys. See deploying to AWS from GitHub Actions without access keys.
5. Log everything, somewhere safe
Create an organisation-wide CloudTrail trail covering all regions, with log file validation on, delivered to a separate log archive account that workload accounts can’t change.
aws cloudtrail describe-trails \
--query 'trailList[].{Name:Name,AllRegions:IsMultiRegionTrail,Organisation:IsOrganizationTrail,Validation:LogFileValidationEnabled}'Then stop anyone switching it off. A service control policy like this denies the changes to everyone except a named security role:
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "ProtectSecurityServices",
"Effect": "Deny",
"Action": [
"cloudtrail:StopLogging", "cloudtrail:DeleteTrail", "cloudtrail:UpdateTrail", "cloudtrail:PutEventSelectors",
"guardduty:DeleteDetector", "guardduty:DisassociateFromAdministratorAccount",
"config:StopConfigurationRecorder", "config:DeleteConfigurationRecorder"
],
"Resource": "*",
"Condition": {
"ArnNotLike": { "aws:PrincipalARN": "arn:aws:iam::*:role/SecurityAdmin" }
}
}]
}6. Turn on detection
- Amazon GuardDuty watches for suspicious activity, such as credentials used from unusual places or instances talking to known bad hosts.
- AWS Config records how resources are configured, and how that changes over time.
- AWS Security Hub CSPM, with the AWS Foundational Security Best Practices standard, checks your accounts against a few hundred specific controls and shows what fails.
Manage all three from one delegated administrator account in the security part of your organisation, so new accounts are covered automatically. GuardDuty and Security Hub CSPM each offer a 30-day free trial, which shows what they would cost for your accounts before you commit.
aws guardduty list-detectors --region ap-southeast-2 aws securityhub get-enabled-standards --region ap-southeast-2
7. Protect data and the network
- Turn on S3 Block Public Access and EBS encryption by default.
- Keep databases and workloads in private subnets, and use security groups that allow only what is needed.
- Put AWS WAF in front of public applications and APIs.
- Keep secrets in AWS Secrets Manager or Parameter Store, never in code or environment files.
aws s3control get-public-access-block --account-id 123456789012 aws ec2 get-ebs-encryption-by-default --region ap-southeast-2
Common mistakes
- Detection in one region only. GuardDuty, Security Hub CSPM and Config are regional. An attacker with stolen keys can start instances in a region you never look at. Turn them on everywhere, or block unused regions with a service control policy.
- Root MFA on one person’s phone. If they leave or lose it, recovery is slow. Use hardware keys, and register more than one.
- Findings nobody reads. Route high-severity findings to the channel your team watches, and agree who responds.
- Guardrails applied straight to production. Test service control policies on non-production accounts first; a deny is hard to debug when it blocks a release.
- No way back in. Keep a documented, monitored break-glass path for when single sign-on is down.
Then what
Fix the failing Security Hub CSPM controls in order of severity, and review access regularly. Build all of this as code, so a new account gets the same baseline automatically. See AWS security and DevSecOps.
Sources
Keep reading
Related articles
Next step
How does your AWS setup measure up?
On a 30-minute call we’ll go through this list against your accounts.