Sub topic 4
Security: protecting data, systems and assets
This chapter covers the Security pillar of the AWS Well-Architected Framework. It assumes you know core AWS services (IAM, S3, VPC, EC2) and have read the chapters on the framework overview and the shared responsibility model. You will learn the pillar's design principles, its best-practice areas, how to apply them to a workload, and how to find security risks in a review.
What the pillar asks of you
The Security pillar is about protecting information, systems and assets while still delivering business value. Security is not a gate at the end of a project. The pillar treats it as a property you build into every layer and keep checking over time.
In the shared responsibility model, AWS secures the cloud itself: facilities, hardware, the hypervisor and the managed service internals. You secure what you put in the cloud: identities, data, network configuration, operating systems on EC2, and application code. The Security pillar questions apply almost entirely to your side of that line. How much falls on your side depends on the service. With EC2 you patch the guest OS. With S3 you do not, but you still own bucket policies, encryption choices and access grants.
Design principles
The framework lists seven design principles.
- Implement a strong identity foundation. Apply least privilege and separation of duties. Centralize identity management and avoid long-term static credentials where temporary ones will work.
- Maintain traceability. Monitor, alert on and audit actions and changes to your environment in real time. Integrate log and metric collection with systems that can act on them.
- Apply security at all layers. Use defense in depth. Protect the edge, the VPC, load balancers, instances, operating systems, applications and code.
- Automate security best practices. Automated, software-based controls scale better and are more consistent than manual ones. Define controls as code and version them.
- Protect data in transit and at rest. Classify data by sensitivity, then apply encryption, tokenization and access control to match.
- Keep people away from data. Reduce or remove direct access to data. Use tools and automation so humans rarely handle sensitive data by hand.
- Prepare for security events. Have an incident management process and run simulations. Use automated tooling to speed up detection, investigation and recovery.
Best-practice areas
The pillar groups its questions into areas. Each area has questions, and each question has best practices you can check your workload against.
| Area | Core question | Typical AWS building blocks |
|---|---|---|
| Security foundations | How do you operate your workload securely? | AWS Organizations, multiple accounts, service control policies |
| Identity and access management | How do you manage identities and permissions? | IAM roles, IAM Identity Center, permission boundaries |
| Detection | How do you detect and investigate security events? | CloudTrail, GuardDuty, Security Hub, CloudWatch |
| Infrastructure protection | How do you protect your network and compute? | VPC, security groups, AWS WAF, Systems Manager |
| Data protection | How do you classify, encrypt and protect data? | KMS, S3 encryption, Secrets Manager, ACM |
| Incident response | How do you anticipate and respond to incidents? | Runbooks, Lambda automation, snapshots, isolated accounts |
| Application security | How do you build and test secure software? | Code review, dependency scanning, CI/CD checks |
The framework added application security as a separate area in recent versions. Earlier material may list only six areas.
How the layers fit together
Defense in depth means an attacker who gets past one control meets another. Detection and response then sit across all layers, because prevention alone will eventually fail.
Identity and access: the usual first findings
Most real review findings start with identity. Typical risks are:
- IAM users with long-lived access keys instead of roles or federated access.
- Policies that use
"Action": "*"or"Resource": "*"for convenience. - No multi-factor authentication on the root user or on privileged users.
- Workloads sharing one account, so a compromise in a test environment can reach production data.
Better practice is to give each workload its own IAM role, grant only the actions it needs, and use separate accounts for separate environments. Use IAM Access Analyzer to find resources shared outside your account and to generate policies from observed activity.
Data protection in practice
Data protection starts with classification. If you do not know which data is sensitive, you cannot decide how to protect it. After that, apply controls in three places: at rest, in transit, and in access paths.
For encryption at rest, use AWS KMS keys. Turn on default encryption for S3, EBS and RDS. For encryption in transit, require TLS everywhere, including internal traffic between tiers when the data warrants it.
The following S3 bucket policy denies any request that does not use TLS. It is a concrete example of protecting data in transit.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyInsecureTransport",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::example-bucket",
"arn:aws:s3:::example-bucket/*"
],
"Condition": {
"Bool": { "aws:SecureTransport": "false" }
}
}
]
}Save the policy as policy.json and apply it with the CLI:
aws s3api put-bucket-policy \
--bucket example-bucket \
--policy file://policy.jsonThe Deny statement works because an explicit deny always overrides any allow. The condition key aws:SecureTransport is false when a request arrives over plain HTTP. It covers both the bucket and its objects through the two resource ARNs.
Detection and incident response
You cannot respond to what you cannot see. At minimum, enable CloudTrail across all accounts and Regions and send the logs to a protected, separate account. Turn on GuardDuty for threat detection, and use Security Hub to collect findings in one place. Keep VPC Flow Logs and load balancer access logs where the data justifies the cost.
Detection is only useful if someone or something acts on it. Pair each alert type with a runbook. For example, an exposed access key should trigger a documented sequence: disable the key, review CloudTrail for its recent activity, rotate affected secrets and record what happened. Where the steps are well understood, automate them with Lambda or Systems Manager Automation. Then rehearse the process with game days, because a plan nobody has tried tends to fail under pressure.
Trade-offs with other pillars
Security choices affect the other pillars, and the review asks you to make those effects explicit.
- Cost. Customer-managed KMS keys, GuardDuty, Security Hub and extensive logging all add charges. Log retention grows with volume.
- Performance. Encryption adds some processing and, with KMS, extra API calls. TLS termination and inspection layers add latency.
- Operations. Tighter permissions mean more access requests and more policy upkeep. Good automation reduces that burden.
- Reliability. A KMS key that is deleted or whose policy locks you out can make data unreadable. Treat key management as a recovery concern too.
The right decision depends on data sensitivity and regulatory needs. A public marketing site and a payment system should not make the same choices. Record the reasoning when you accept a lower level of protection, so a later reviewer knows the risk was chosen on purpose.
Reviewing the Security pillar in the Well-Architected Tool
In the AWS Well-Architected Tool, each security question has a set of best practices. You tick the ones you follow. The tool then rates your answer as no risk, medium risk or high risk. You can list the Security questions and your current answers from the CLI:
aws wellarchitected list-answers \
--workload-id <workload-id> \
--lens-alias wellarchitected \
--pillar-id securityThe output includes each question's identifier, its choices, and a Risk field. Look for answers marked UNANSWERED, HIGH or MEDIUM. Typical high-risk answers include no MFA on privileged accounts, no encryption of sensitive data, or no tested incident response plan. After a remediation sprint, record a milestone so you can show the change in risk counts.
Common mistakes
- Treating a compliance certification of AWS as proof that your workload is secure. The certification covers AWS's side only.
- Relying on security groups alone, with no logging or detection behind them.
- Enabling encryption but leaving key policies so broad that any principal in the account can use the key.
- Storing secrets in code, environment variables or AMIs instead of a service such as Secrets Manager or Parameter Store.
- Writing an incident response plan but never testing it.
Exercise
A review of the "orders-api" workload shows these answers: the root user has no MFA, an S3 bucket holding customer files allows plain HTTP requests, and the team has no written runbook for a leaked access key. Name the best-practice area for each finding, and say which design principle each one breaks.
Show answer
Root user without MFA belongs to identity and access management (or security foundations) and breaks "implement a strong identity foundation". The bucket that allows HTTP belongs to data protection and breaks "protect data in transit and at rest"; a deny policy on aws:SecureTransport being false fixes it. The missing runbook belongs to incident response and breaks "prepare for security events". Each would normally be flagged as medium or high risk and go into the improvement plan.
Exercise
Why does the TLS-only bucket policy use Effect: Deny with a condition instead of an Allow statement that requires HTTPS?
Show answer
An explicit deny overrides every allow, including grants from other policies, roles or ACLs. An allow statement with a condition would only permit HTTPS requests from the listed principals, and other policies could still allow HTTP access. The deny closes the gap for all principals.