AWS Security Best Practices for Protecting Your Cloud Infrastructure: A Practical Layer-by-Layer Guide

AWS security best practices are the controls that protect your identities, data, network and workloads under the shared responsibility model: AWS secures the cloud infrastructure, and you secure what you run on it. In practice that means locking down access, encrypting data, restricting exposure, monitoring continuously and rehearsing recovery.

The stakes keep rising. IBM’s 2026 Cost of a Data Breach report puts the global average breach at a record $4.99 million, up 12%, and found it took an average of 247 days to identify and contain one. This guide walks through the practices layer by layer, with current AWS defaults and services, so you can see what’s already protected for you and what isn’t.

What You’ll Learn Why It Matters What It Helps You Avoid
The shared responsibility model Who secures what in AWS Assuming AWS handles everything
Identity and access Root, IAM Identity Center, roles, least privilege Leaked or over-permissioned credentials
Data and network Encryption, key management, exposure controls Open buckets and unencrypted data
Detection and compliance GuardDuty, Security Hub, Inspector, Config Threats that run for months unseen
Response and support Playbooks, backups, recovery, managed services Improvising during an incident

What does AWS secure, and what is your responsibility?

AWS secures the infrastructure that runs its services: the data centers, hardware, networking and the foundations of each service. You secure what you put on it and how you configure it: identities, data, network settings, operating systems on EC2, and your own application code.

How much falls on you depends on the service. On EC2 you patch the operating system and manage the firewall rules. With a managed service such as RDS or S3, AWS handles more of the machinery, but the configuration is still yours. Here’s a simple test: if you can change a setting in the console, you own it. That’s why so many cloud incidents trace back to a configuration choice such as a public bucket or an exposed key, rather than to a failure inside AWS.

The AWS Security Layer Map

RESPONSE    Playbooks · immutable backups · tested recovery

DETECTION   CloudTrail · GuardDuty · Security Hub · Inspector · Macie

NETWORK     VPC design · security groups · Block Public Access · WAF · Shield

DATA        Encryption · KMS keys · TLS · Secrets Manager

IDENTITY    Root lockdown · IAM Identity Center · roles · least privilege

FOUNDATION  Multiple accounts · AWS Organizations · guardrails · logging on

Read it from the bottom. Each layer assumes the one beneath it holds, which is why identity comes before everything else, and why the rest of this guide follows the same order. A sound set of AWS cloud solutions treats these as one design rather than six separate projects.

How do you lock down identity and access in AWS?

Protect the root user with strong MFA and no access keys, give people access through IAM Identity Center or federation, give workloads IAM roles with temporary credentials, and keep trimming permissions down to what’s actually used. Identity is the layer attackers go after first, so we’d do this one first.

AWS’s own IAM guidance sets out the order of work:

  • Root user: Use it only for the handful of tasks that require it, protect it with MFA, and never create access keys for it. AWS recommends phishing-resistant MFA such as passkeys and security keys wherever possible. In AWS Organizations, you can also manage root access centrally for member accounts instead of leaving root credentials scattered across them.
  • People: Use IAM Identity Center or federation with your identity provider rather than individual IAM users. Users get short-lived sessions, you get one place to remove access, and MFA applies consistently.
  • Workloads: Use IAM roles so applications receive temporary credentials. If a third-party tool genuinely can’t use roles, tightly scope its IAM user, store the key in Secrets Manager and rotate it. Long-term keys in code or config files are the most common way credentials leak.
  • Permissions: Start from AWS managed policies and refine. IAM Access Analyzer can generate a least-privilege policy from a role’s actual access activity, validate your policies, and flag public and cross-account access. Remove users, roles and permissions nobody uses.
  • Guardrails: Service control policies in Organizations set the maximum permissions for entire accounts, so one careless admin can’t switch off logging. Where you can’t enforce MFA at sign-in, the aws:MultiFactorAuthPresent condition key lets a policy deny actions without it.

Credentials matter because of how attackers get in. IBM’s 2024 report found stolen or compromised credentials were the most common initial vector at 16% of breaches, and the slowest to contain at 292 days on average.

Access also needs an owner. When Upasana4u lost access to its suspended email accounts and admin credentials on Google Workspace, we worked with Google’s support team to recover the IDs and re-establish admin control, which preserved 17 years of business continuity. The platform was different, but the lesson carries over to AWS: more than one trusted admin, documented recovery paths and no single point of failure in who can regain control.

How should you encrypt data in AWS and manage keys?

Encrypt data at rest and in transit by default, use AWS KMS customer managed keys where you need control and an audit trail, rotate keys on a schedule, and keep credentials in Secrets Manager. Several of these are already on by default, so the work is mostly verification.

Since January 2023, Amazon S3 applies server-side encryption to all new objects by default, so the question for S3 has shifted from “is it encrypted?” to “who controls the key?” For more sensitive data, AWS KMS offers three layers of choice:

  • AWS managed keys rotate automatically every year, at no cost and with no configuration, but you can’t edit their policies.
  • Customer managed keys give you your own key policy, cross-account access, optional automatic rotation and CloudTrail records of each use. They cost $1 per key per month plus $0.03 per 10,000 requests, so group keys by data classification and blast radius rather than creating one for every resource.
  • Rotation settings for customer managed keys default to 365 days and can be set anywhere from 90 to 2,560 days (about seven years), or triggered on demand.

In transit, enforce TLS with the aws:SecureTransport condition in bucket policies and require HTTPS on load balancers. Put database passwords, API tokens and third-party keys in Secrets Manager, which can rotate them automatically, and keep them out of code, environment files and images.

Encryption protects data from theft. It doesn’t decide what leaves the building through legitimate channels. For that you need classification and data loss prevention. Amazon Macie finds sensitive data in S3 buckets, and on the Microsoft side, our Zoondia Microsoft 365 Business Premium project combined information protection, DLP, Intune controls, MFA and conditional access through a structured pilot. If you’re moving production data into AWS, the pre-migration checks in our AWS database migration guide cover encryption on the target and the access settings that DMS leaves behind.

How do you secure your network and block accidental public exposure?

Keep resources private by default: S3 Block Public Access on, databases and application servers in private subnets, security groups open only where they must be, and WAF and Shield in front of public endpoints. Most exposure comes from one forgotten rule.

Start with S3, because AWS changed the defaults. In April 2023, Amazon began enabling Block Public Access and disabling ACLs on all new buckets, and by April 27 it had rolled out to every Region. Existing buckets were not changed. So a bucket created before spring 2023 may still be sitting on older settings. Turn on Block Public Access at the account level, then audit anything old.

Then the rest of the perimeter:

  • Security groups act as stateful firewalls. Never leave SSH (port 22) or RDP (port 3389) open to 0.0.0.0/0. AWS Systems Manager Session Manager gives you shell access without opening inbound ports.
  • Private subnets for databases and internal services, with outbound access through NAT only where needed.
  • VPC endpoints keep traffic to AWS services on the AWS network. Gateway endpoints for S3 and DynamoDB are free, so security and cost point the same direction here, a theme we explore in our guide to AWS cost optimization and performance.
  • AWS WAF filters web requests with managed rules and rate-based rules. It costs $5 per web ACL per month, $1 per rule per month and $0.60 per million requests.
  • AWS Shield Standard is free and automatic for all customers. Shield Advanced costs $3,000 a month per organization with a one-year commitment, plus data transfer fees. That’s $36,000 a year before usage, so it makes sense when an hour of DDoS downtime costs you more than that justifies, and not before.

Finally, test from outside. A penetration test shows what an attacker sees, which isn’t always what your diagram shows. Our VAPT services assess cloud and on-premise systems for vulnerabilities and recommend remediation.

How do you detect threats with GuardDuty, Security Hub and Inspector?

Turn on CloudTrail in every Region first, then add GuardDuty, Security Hub, Inspector and Macie so logs become findings, and make sure someone is watching them. Speed is the point: IBM found breaches lasting longer than 200 days cost $5.65 million on average, against $4.32 million for those resolved faster.

Attack Path: How One Leaked Key Becomes a Breach

  1. Exposure: A developer commits a long-lived access key to a repository, or leaves it in a config file on a public server. Automated scanners watch for exactly this. Break it with: roles and temporary credentials, secret scanning before commit.
  2. Foothold: The key belongs to an IAM user with broad permissions and no MFA requirement for API calls. Break it with: least privilege, MFA conditions, service control policies.
  3. Reconnaissance: The attacker lists buckets, roles and running instances, and checks which Regions you don’t use. Break it with: Region restrictions through SCPs, CloudTrail in every Region.
  4. Persistence: They create new access keys or a backdoor user, and launch compute for mining in an unused Region. Break it with: GuardDuty findings, budget and anomaly alerts.
  5. Exfiltration: Data leaves through S3 reads or snapshot sharing. Break it with: Macie, Block Public Access, encryption with tight key policies.
  6. Discovery. Someone notices the bill, or a customer complains. By then, weeks may have passed.

Each service covers a different link in that chain:

  • CloudTrail records API activity. Its event history only shows the last 90 days, so create a multi-Region trail that delivers to a protected S3 bucket.
  • Amazon GuardDuty analyzes CloudTrail, VPC flow and DNS logs for threats, with optional protection plans for S3, EKS, runtime monitoring, malware and more. Its Extended Threat Detection, automatically on at no extra cost since December 2024, groups weak signals into critical-severity attack sequence findings. As of December 2025, that includes EC2 and ECS, with findings named AttackSequence:EC2/CompromisedInstanceGroup and AttackSequence:ECS/CompromisedCluster. How much it can see depends on which protection plans you enable, and runtime monitoring deepens EC2 coverage. GuardDuty includes a 30-day free trial.
  • AWS Security Hub became generally available in its newer form in December 2025. It correlates findings from GuardDuty, Inspector, Macie and Security Hub CSPM into near real-time risk analytics. Its Exposure view ranks issues by severity, shows 90-day trends and visualizes potential attack paths. AWS lists near real-time exposure calculation and trends as included at no additional charge.
  • Amazon Inspector scans EC2 instances, container images and Lambda functions for known software vulnerabilities, continuously.
  • Amazon Macie finds sensitive data in S3, which tells you what an attacker would reach for first.

IBM’s 2026 data adds the business case. Organizations using security AI and automation extensively cut breach costs by $1.93 million and shortened the breach lifecycle by 65 days. Findings only help when someone acts on them, which is why many businesses pair the AWS tooling with a 24/7 monitoring team such as our SOC services.

How do you keep configurations compliant as your environment grows?

Use multiple accounts under AWS Organizations, apply guardrails as policy, run AWS Config rules and Security Hub standards against everything, and scan infrastructure code before it deploys. Security that depends on people remembering doesn’t survive growth.

  • Account structure: Separate production, development and logging into different accounts, with Organizations and AWS Control Tower providing a landing zone and baseline controls. A compromised development account then can’t reach production data.
  • Guardrails: Service control policies block risky actions outright, such as disabling CloudTrail or using unapproved Regions.
  • Continuous checks: AWS Config records resource configuration changes and evaluates them against rules. Security Hub runs standards such as the AWS Foundational Security Best Practices and the CIS AWS Foundations Benchmark.
  • Shift left: Scan CloudFormation or Terraform templates for open security groups, unencrypted volumes and public buckets before they ever reach production.
  • Evidence: AWS Artifact gives you AWS’s own audit reports for ISO, SOC and PCI assessments, which covers the “security of the cloud” half of an audit. Your half needs your own evidence.

Treat security changes like any other production change: record a baseline, change one thing, compare, keep or roll back. The same safe change cycle applies, and it prevents a tightening of rules from taking down an application at the busiest hour.

How should you prepare for an incident and recover from one?

Write playbooks, keep backups that attackers can’t delete, and test recovery before you need it. The 247-day average to identify and contain a breach in IBM’s 2026 data shows that detection is only half the job, since a team that has never practiced response loses days on decisions.

A usable playbook answers a few questions in advance. Who declares an incident, and who can isolate a compromised instance, for example by moving it to a quarantine security group? How do you revoke active sessions for a role and rotate exposed keys? Where are forensic snapshots stored, and who may access them? Keep CloudTrail and application logs in a separate account with restricted write access, so an intruder can’t erase their own tracks. Backups need the same thinking. AWS Backup supports cross-account and cross-Region copies, and Backup Vault Lock makes recovery points write-once, so ransomware can’t delete them. Then choose a disaster recovery strategy to match your tolerance for downtime and data loss: backup and restore, pilot light, warm standby or multi-site active-active, ranging from cheapest and slowest to costliest and fastest.

The proof is in recovery time. When a major UAE food and beverage company’s website went down in a sudden power failure, a pre-configured replica in Singapore restored it within minutes. That wasn’t a security incident, but the muscle is the same: a standby ready before anyone needs it, and a procedure that has been rehearsed. Our DRaaS service is built around that principle.

When does it make sense to bring in an AWS partner or managed services?

It makes sense when security work competes with delivery, when nobody watches your environment around the clock, when growth or an audit is coming, or after something has already gone wrong. The test is simple: does a named person own AWS security on Monday morning?

AWS managed services cover the continuous jobs: monitoring, patching, backup checks, security reviews, tuning and incident support. A capable AWS partner brings repeatable method and experience from many environments, and can tell you what to fix first. If you already have a team with the time and ownership, you may need only a periodic review. If you don’t, a partner closes the gap.

Our AWS cloud services team supports clients with migration, security hardening and ongoing operations through AWS-certified professionals, alongside our cybersecurity services. Resilience work is part of that. We built a disaster recovery setup for an airline on AWS across multiple Availability Zones, with backups spanning regions, and our case studies page shows more real projects with their real constraints. Read a few before any sales call, ours or anyone else’s.

30-Minute Quick Wins

  1. (5 min) Confirm the root user has MFA and no access keys.
  2. (5 min) Generate the IAM credential report. Flag users without MFA and access keys older than 90 days.
  3. (3 min) Check that S3 Block Public Access is on at the account level.
  4. (5 min) Confirm a multi-Region CloudTrail trail exists and delivers to a protected bucket.
  5. (4 min) Enable GuardDuty in every region you use, using the 30-day free trial.
  6. (4 min) Turn on IAM Access Analyzer and review any public or cross-account findings.
  7. (4 min) Set a budget alarm so a sudden spike, such as mining in an unused Region, gets noticed in days rather than at month-end.

Thirty minutes won’t make an environment secure, but it removes the most common ways in. Then work down the layer map.

Security is easier with a second pair of eyes. As an AWS cloud partner, Codelattice offers a free consultation to review your AWS security posture and prioritize fixes. We handle migration, onboarding and ongoing support, backed by a lightning-fast SLA and multi-language support. Write to askus@codelattice.com and tell us what you’re running.

Aswathi P K

Written By Aswathi P K

Aswathi P K, a DevOps Engineer at Codelattice, specializes in cloud infrastructure, CI/CD pipeline development, and system reliability. She works extensively with tools such as AWS, Docker, and Jenkins to automate deployments, enhance scalability, and implement industry-standard DevOps practices.