AWS Builder Center

7 AWS Security Mistakes Almost Every Beginner Makes (and How to Fix Each One in 10 Minutes)

Most AWS security incidents don’t involve elite hackers or exotic zero-days. They start with something ordinary: a leaked access key, a wide-open port, an admin account without MFA. AWS gives you strong security tools, but the defaults and the “just make it work” shortcuts we all take can leave gaps. The good news is that fixing the most common ones is quick. Here are seven mistakes to check for in your own account, each with a concrete fix. If you read nothing else, do #1 and #2 today.

1. Using the root user (and skipping MFA)

The root user can do everything in your account, including closing it, and it can’t be restricted by IAM policies. Yet many people sign in with it daily because it’s the account they created first.
Fix it:
  • Turn on MFA for the root user, preferably with a hardware security key or passkey.
  • Create an administrative identity for daily work. For anything beyond a personal sandbox, use IAM Identity Center with short-lived credentials.
  • Remove any root access keys. You almost never need them.
  • Lock the root credentials away and use them only for the few tasks that require root.

2. Long-lived access keys, especially ones committed to Git

Hardcoded access keys in source code are one of the most common ways credentials leak. Bots scan public repositories constantly, and a key pushed to a public repo can be abused within minutes.
Fix it:
  • Don’t use IAM user access keys if you can avoid them. Use IAM Identity Center for people ( aws sso login ) and IAM roles for workloads such as EC2, Lambda, and ECS.
  • For CI/CD, use OIDC federation (for example, GitHub Actions assuming a role) instead of stored secrets.
  • If you must keep keys, rotate them and delete the unused ones. You can audit key age with a credential report:
bash
aws iam generate-credential-report
aws iam get-credential-report --query Content --output text | base64 --decode
  • Add a secret scanner such as  git-secrets  or  gitleaks  as a pre-commit hook.
  • If a key leaks, treat it as compromised. Deactivate it immediately, rotate it, and review CloudTrail for activity you don’t recognize. Deleting the commit is not enough.

3. Giving everything  AdministratorAccess  or  "Resource": "*" 

Attaching a broad policy is the fastest way to make an error message disappear. It also means a single compromised credential can do anything.
Fix it:
  • Start from least privilege: grant only the actions a role needs, on only the resources it needs.
  • Let IAM Access Analyzer help. It can flag external access to your resources and can generate a least-privilege policy from the activity recorded in CloudTrail.
  • Use permission boundaries or Service Control Policies (in AWS Organizations) to cap what even admins in a sandbox account can do.
Here is the difference in practice:
json
// Too broad
{ "Effect": "Allow", "Action": "s3:*", "Resource": "*" }

// Better
{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "arn:aws:s3:::my-app-uploads/*"
}

4. Public S3 buckets

Accidentally exposed S3 buckets have caused many well-known data leaks. New buckets block public access by default today, but older buckets, copied templates, and well-meaning “temporary” changes can still create exposure.
Fix it:
  • Enable S3 Block Public Access at the account level so no bucket can become public by accident:
bash
aws s3control put-public-access-block \
--account-id <YOUR_ACCOUNT_ID> \
--public-access-block-configuration \
BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
  • To serve public website content, put CloudFront in front of a private bucket (using Origin Access Control) rather than making the bucket itself public.
  • Turn on default encryption, and consider versioning for important data.
  • Run IAM Access Analyzer for S3 or review bucket policies for  "Principal": "*" .

5. Security groups open to the whole internet

Opening SSH (22), RDP (3389), or a database port to  0.0.0.0/0  is an invitation. Automated scanners find exposed ports quickly.
Fix it:
  • Find the offenders first:
bash
aws ec2 describe-security-groups \
--filters Name=ip-permission.cidr,Values=0.0.0.0/0 \
--query 'SecurityGroups[*].[GroupId,GroupName]' \
--output table
  • Replace SSH and RDP with AWS Systems Manager Session Manager, which needs no open inbound ports and no bastion host.
  • Put databases in private subnets and allow access only from your application’s security group, not from an IP range.
  • Reserve  0.0.0.0/0  for ports that genuinely serve the public, such as 443 on a load balancer.

6. Flying blind with no logging or threat detection

If something goes wrong and you have no logs, you can’t answer the basic questions: what happened, when, and with which credentials?
Fix it:
  • Create a multi-region CloudTrail trail that delivers to a dedicated S3 bucket, and protect that bucket carefully. New accounts include a limited event history by default, but a trail gives you a durable record.
  • Enable Amazon GuardDuty for managed threat detection. It takes a minute to turn on:
bash
aws guardduty create-detector --enable
  • Turn on AWS Security Hub to see findings and best-practice checks in one place.
  • Send alerts somewhere a human will actually see them, such as email, Slack, or a pager.

7. Secrets in environment variables, code, and config files

Database passwords and API tokens pasted into Lambda environment variables, user data scripts, or  .env  files tend to spread across logs, screenshots, and repos.
Fix it:
  • Store secrets in AWS Secrets Manager (which supports automatic rotation for supported services) or Systems Manager Parameter Store for simpler needs.
  • Grant your function or service a role that can read only the specific secret it needs.
  • Fetch the secret at runtime, and cache it briefly instead of calling the API on every request.
python
import boto3, json

secrets = boto3.client("secretsmanager")

def get_db_credentials():
value = secrets.get_secret_value(SecretId="prod/app/db")
return json.loads(value["SecretString"])

Bonus: Know your side of the line

AWS operates under the shared responsibility model. AWS secures the cloud itself: the data centers, hardware, and core services. You secure what you build in the cloud: identities, data, configurations, and application code. Most of the mistakes above live on your side of that line, which is why they’re so fixable.

Your 30-minute security checklist

  • MFA enabled on root and every human user
  • No root access keys; daily work done through SSO or roles
  • No hardcoded or unused access keys; secret scanning in place
  • Admin-wide policies replaced with scoped ones
  • S3 Block Public Access on at the account level
  • No sensitive ports open to  0.0.0.0/0 
  • CloudTrail and GuardDuty enabled
  • Secrets moved into Secrets Manager or Parameter Store
  • A billing budget alert set, since unexpected charges are often the first sign of compromise

Key takeaways

  • Most breaches trace back to basic misconfigurations, not sophisticated attacks.
  • Prefer short-lived credentials (roles, SSO, OIDC) over long-lived keys.
  • Least privilege takes more effort up front and saves you in the worst moments.
  • Turn on logging and detection before you need them. You can’t investigate what you didn’t record.
  • Security is a habit. Re-run this checklist every few months.
Which of these did you find in your own account? Share it in the comments (without the sensitive details, of course). Chances are another builder is about to make the same mistake.


Tags:  security   iam   aws-best-practices   beginners   cloud-security 



How to give this article more reach on AWS Builder

  • Title: Numbered, outcome-focused titles (“7 mistakes… and how to fix each”) tend to attract clicks, and a beginner-friendly security topic appeals to a broad audience.
  • Tags: Use 3 to 5 relevant, commonly searched tags. I’ve included them above.
  • Add a visual: A simple diagram or a screenshot of your own console or checklist makes the post stand out in feeds.
  • Add your own experience: One or two real stories from your own work, such as a mistake you caught, will make it more authentic and memorable than anything generic.
  • Engage early: Reply to every comment in the first day or two, and ask readers a question at the end (it’s built in above).
  • Share it: Post the link on LinkedIn, X, and relevant communities, and tag the AWS services you covered.
  • Be consistent: A series (for example, “Cloud security basics, part 1”) builds a following better than a single post.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article