AWS Builder Center
Day 2: AWS Security, IAM and Shared Responsibility

Day 2: AWS Security, IAM and Shared Responsibility

Exam domain covered today: Domain 2, Security and Compliance (30%, the highest-weighted domain). Master this day.

What you will learn today

  • The AWS Shared Responsibility Model
  • IAM: users, groups, roles, and policies
  • Root user, least privilege, and MFA
  • AWS Organizations and governance
  • Encryption, AWS KMS, and Secrets Manager
  • GuardDuty, Inspector, WAF, and Shield (and other security services)
  • CloudTrail, Config, and Artifact
  • Compliance and governance

1. The Shared Responsibility Model

1
2
3
4
5
6
7
8
9
10
+--------------------------------------------------------------+
| CUSTOMER = Security **IN** the cloud |
| Your data, identities (IAM), apps, OS patches (EC2), |
| firewall rules (security groups), encryption choices |
+--------------------------------------------------------------+
| AWS = Security **OF** the cloud |
| Hardware, global infrastructure (Regions, AZs, edge), |
| physical data centers, virtualization, managed service |
| software |
+--------------------------------------------------------------+
WhoResponsible forExamples
AWS (security of the cloud)Physical security, hardware, networking, virtualization layer, global infrastructure, software of managed servicesData center guards, disk disposal, hypervisor, Region and AZ operations
Customer (security in the cloud)Customer data, IAM, OS and application patching you manage, network and firewall configuration, encryption choicesWho can read your S3 bucket, patching EC2 guest OS

Responsibility shifts by service type

ServiceAWS handlesYou handle
Amazon EC2 (IaaS)Hardware, hypervisor, facilitiesGuest OS patches, apps, security groups, data, IAM
Amazon RDS (managed)OS patching, database software patching, hardware, backups infrastructureData, who can access, security groups, encryption settings
Amazon S3 (managed)Infrastructure and durabilityBucket policies, public access, encryption config, data
AWS Lambda (serverless)Servers, OS, runtime, scalingFunction code, IAM permissions, data
Amazon DynamoDBInfrastructure and service softwareData, IAM, encryption choices
1
2
The more managed the service ==> the less you manage ==> the less you are responsible for
EC2 (most customer work) > RDS > Lambda / DynamoDB / S3 (least)

Three types of controls

TypeMeaningExample
Inherited controlsControls you inherit fully from AWSPhysical and environmental security
Shared controlsApply to both AWS and the customer, in different contextsPatch management, configuration management, awareness and training
Customer-specific controlsDepend on what you deployService and communications protection based on your workloads
Analogy: The landlord (AWS) secures the building: walls, roof, main gate, CCTV. You (the customer) lock your apartment door and decide who gets a key. If you leave your door open, that is not the landlord's fault.
Exam trap: "Who patches the guest OS on an EC2 instance?" The customer. "Who patches the OS under RDS?" AWS.

2. AWS Identity and Access Management (IAM)

IAM controls who (authentication) can do what (authorization) on which AWS resources. It is free and global (not tied to one Region).
1
2
3
4
5
6
7
8
9
10
11
+------------------------ AWS Account ------------------------+
| Root user (all powers - lock it away) |
| |
| IAM Group "Developers" IAM Group "Admins" |
| |- User Asha |- User Ravi |
| |- User Kiran |
| |
| IAM Role "EC2-S3-Reader" <-- assumed by an EC2 instance |
| |
| Policies (JSON) attached to users, groups, or roles |
+--------------------------------------------------------------+

IAM building blocks

ComponentWhat it isKey facts
Root userIdentity created with the account (email and password)Full, unrestricted access. Enable MFA, do not create access keys, do not use for daily work
IAM userA person or application with long-term credentialsPassword for console, access keys for CLI and SDK
IAM groupA collection of usersAttach a policy to the group; users inherit it. Groups cannot contain other groups
IAM roleAn identity with temporary credentials that can be assumedUsed by AWS services (EC2, Lambda), cross-account access, federated users
IAM policyJSON document that allows or denies actionsAttached to users, groups, or roles
Permission boundaryMaximum permissions an identity can haveAdvanced guardrail
AWS STSSecurity Token Service issues temporary credentialsBehind roles

Policy types

TypeDescription
AWS managed policyCreated and maintained by AWS (for example AdministratorAccess, ReadOnlyAccess)
Customer managed policyCreated by you, reusable
Inline policyEmbedded directly in a single user, group, or role
Identity-based policyAttached to an IAM identity
Resource-based policyAttached to a resource, such as an S3 bucket policy
Service control policy (SCP)Organization-level permission guardrail (see Organizations)
Policy evaluation: everything is denied by default. An explicit Allow is needed. An explicit Deny always wins.
1
2
3
4
5
6
7
Request --> Explicit Deny? --yes--> DENIED
| no
v
Explicit Allow? --yes--> ALLOWED
| no
v
Default: DENIED

Example policy (read-only to one bucket)

1
2
3
4
5
6
7
8
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:ListBucket"],
"Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"]
}]
}
ElementMeaning
EffectAllow or Deny
ActionWhat can be done
ResourceOn which resource (ARN)
Condition (optional)When the rule applies (for example source IP or MFA present)

IAM best practices (frequently tested)

Best practiceWhy
Protect the root user with MFA and use it only for tasks that require itRoot has unlimited power
Apply least privilegeGive only the permissions needed, nothing more
Use groups to assign permissionsEasier to manage
Use roles for applications and services (for example EC2 reading S3)No long-term keys in code
Never hard-code or share access keysLeaked keys are a top risk
Enable MFA for all usersSecond factor beyond password
Create a strong password policyLength, complexity, rotation
Rotate credentials regularlyLimit exposure
Use IAM Identity Center for workforce accessSingle sign-on across accounts
Monitor with CloudTrail, review with the credential report and Access AnalyzerVisibility

Tasks that require the root user (know a few)

Task
Close the AWS account
Change account settings such as account name, email, or root password
Restore IAM user permissions when the only admin locked themselves out
Change or cancel an AWS Support plan (historically a root-only task)
Register as a seller in the Reserved Instance Marketplace
Enable MFA delete on S3 buckets (root only)

MFA options

MFA device typeExample
Virtual MFA appGoogle Authenticator, Authy
FIDO2 security key (hardware)YubiKey
Hardware TOTP tokenGemalto token

Other identity services

ServicePurposeExam hook
IAM Identity Center (successor to AWS SSO)Central single sign-on to multiple AWS accounts and apps"Workforce SSO across accounts"
Amazon CognitoSign-up, sign-in, and access control for your app's customers"Mobile or web app users"
AWS Directory ServiceManaged Microsoft Active Directory in AWS"Active Directory"
IAM Access AnalyzerFinds resources shared outside your account"External access findings"
IAM credential reportCSV of all users and credential status"Audit passwords, keys, MFA"
IAM Access Advisor (last accessed)Shows services a user actually used"Remove unused permissions"
AWS Resource Access Manager (RAM)Share resources (subnets, etc.) across accounts"Share resources securely"
Exam trap: IAM Identity Center is for your workforce; Cognito is for your application's customers.

3. AWS Organizations and governance

FeatureDescription
AWS OrganizationsCentrally manage many AWS accounts in a hierarchy of Organizational Units (OUs)
Consolidated billingOne bill for all accounts, combined volume discounts, shared Reserved Instance and Savings Plan benefits
Service Control Policies (SCPs)Set the maximum permissions for accounts or OUs; they do not grant permissions by themselves
AWS Control TowerAutomated landing zone with guardrails for a secure multi-account setup
AWS Service CatalogCatalog of approved products users can launch
AWS ConfigTrack configuration changes and rule compliance
Tag policiesEnforce consistent tagging
1
2
3
4
5
6
7
8
Management account (root of organization)
|
+--------------------+--------------------+
| |
OU: Production OU: Development
| | | |
Acct: App Acct: DB Acct: Dev1 Acct: Sandbox
SCP: "Deny leaving approved Regions" applies down the tree
Analogy: Organizations is a company head office. SCPs are company-wide rules ("no one may open an account outside India"), regardless of what each department wants.

4. Encryption and secrets

1
2
3
Encryption AT REST Encryption IN TRANSIT
(data stored on disk/S3/DB) (data moving over network)
Use KMS keys Use TLS/HTTPS
ConceptMeaningAWS examples
Encryption at restProtect stored dataS3 SSE, EBS encryption, RDS encryption, DynamoDB encryption
Encryption in transitProtect data as it movesHTTPS/TLS, VPN, ACM certificates
Client-side encryptionYou encrypt before uploadCustomer-managed process
Server-side encryption (SSE)AWS encrypts after receivingSSE-S3, SSE-KMS, SSE-C
ServicePurposeKey points
AWS KMS (Key Management Service)Create, control, and audit encryption keysIntegrated with most AWS services; every use is logged in CloudTrail; AWS managed keys vs customer managed keys
AWS CloudHSMDedicated hardware security moduleYou control the keys; for strict compliance (for example FIPS 140-2 Level 3)
AWS Secrets ManagerStore and automatically rotate secrets such as database passwords and API keysRotation, fine-grained access, cross-Region replication
SSM Parameter StoreStore configuration values and secretsCheaper, no built-in automatic rotation
AWS Certificate Manager (ACM)Provision and renew SSL/TLS certificatesFree public certificates for integrated services
AWS Private CACreate private certificate authoritiesInternal certificates
KMS vs CloudHSM
KMSCloudHSM
HardwareMulti-tenant managedDedicated single-tenant HSM
Who controls keysShared (AWS manages the service)You have exclusive control
Typical needGeneral encryptionStrict regulatory requirements
Secrets Manager vs Parameter Store
Secrets ManagerParameter Store
Automatic rotationYesNo
CostPaid per secretFree tier for standard parameters
Best forDB credentials, API keysConfig values and simple secrets

5. Network and threat protection services

1
2
3
4
5
6
7
8
9
10
11
12
Internet user
|
v
[ AWS Shield ] --> DDoS protection (network and transport layer)
|
[ AWS WAF ] --> Blocks SQL injection, XSS, bad bots (Layer 7 web rules)
|
[ CloudFront / ALB / API Gateway ]
|
[ Security group ] (instance firewall) + [ Network ACL ] (subnet firewall)
|
[ EC2 / app ] <--- monitored by GuardDuty, Inspector, Macie
ServiceWhat it doesRemember it asExam keywords
AWS Shield StandardAutomatic, free DDoS protection for all customersFree DDoS shield"DDoS", "free"
AWS Shield AdvancedPaid, enhanced DDoS protection, 24/7 DDoS response team, cost protectionPremium DDoS shield"DDoS response team"
AWS WAFWeb application firewall; rules for SQL injection, cross-site scripting, rate limits, IP and geo blockingLayer 7 web filter"SQL injection", "XSS", "web ACL"
AWS Firewall ManagerCentrally manage WAF, Shield Advanced, security groups across accountsOne console for all firewalls"Multi-account firewall rules"
AWS Network FirewallManaged stateful firewall and intrusion prevention for VPCsVPC-level firewall"Filter VPC traffic"
Amazon GuardDutyIntelligent threat detection by analyzing CloudTrail, VPC Flow Logs, DNS logs with MLThreat detective"Malicious activity", "unusual API calls", "compromised instance"
Amazon InspectorAutomated vulnerability scanning of EC2, container images (ECR), and LambdaVulnerability scanner"Software vulnerabilities", "CVE", "exposure"
Amazon MacieDiscovers sensitive data (PII) in S3 using MLPII finder"Personal data in S3"
Amazon DetectiveInvestigates and finds the root cause of security findingsInvestigator"Root cause analysis"
AWS Security HubCentral dashboard that aggregates findings from GuardDuty, Inspector, Macie and checks best practicesSingle security pane"Aggregate findings", "security posture"
AWS Shield + WAF + Firewall ManagerTogether protect edge and web layers
Amazon Security LakeCentralized security data lakeAwareness
AWS IAM Access AnalyzerExternal-access findings
GuardDuty vs Inspector vs Macie vs Detective
QuestionAnswer
"Detect threats or malicious behavior now"GuardDuty
"Scan for vulnerabilities in software"Inspector
"Find PII or sensitive data in S3"Macie
"Find the root cause of an incident"Detective
"See all findings in one place"Security Hub

Security Group vs Network ACL (preview, full detail on Day 5)

Security groupNetwork ACL
LevelInstanceSubnet
StateStatefulStateless
RulesAllow onlyAllow and deny

6. Logging, auditing, and compliance

ServiceWhat it doesMemory trick
AWS CloudTrailRecords API calls and account activity (who, what, when, from where). Event history keeps 90 days; create a trail to store logs in S3 for longer"Who did it?"
AWS ConfigRecords resource configuration changes over time and evaluates them against rules"What changed, and is it compliant?"
Amazon CloudWatchMetrics, logs, alarms and dashboards (performance)"How is it performing?"
AWS ArtifactSelf-service portal to download AWS compliance reports (SOC, PCI, ISO) and accept agreements such as BAA and GDPR DPA"Compliance paperwork"
AWS Audit ManagerContinuously collects evidence to simplify audits"Audit evidence"
AWS Trusted AdvisorChecks for cost, performance, security, fault tolerance, quotas, operations (covered Day 6)
VPC Flow LogsCapture IP traffic going to and from network interfaces"Network traffic logs"
AWS Security HubCompliance checks against standards (CIS, PCI)
1
2
3
4
5
6
7
Something changed in my account. Which service helps?

"Who made this API call?" ---> CloudTrail
"What did the configuration look ---> Config
like before and after?"
"Is the CPU too high right now?" ---> CloudWatch
"Where is the SOC 2 report?" ---> Artifact

Compliance and governance concepts

ConceptMeaning
Compliance programsAWS undergoes third-party audits (for example SOC 1/2/3, ISO 27001, PCI DSS, HIPAA eligibility, FedRAMP, GDPR support). You still own compliance for your workloads
Data residencyData stays in the Region you choose unless you move it
GovernancePolicies, guardrails, and processes (Organizations, Control Tower, Config)
AWS Customer Compliance CenterResources about compliance practices
Penetration testingCustomers may test their own resources for certain services without prior approval, following the AWS policy; prohibited activities include DDoS simulation outside approved partners
Reporting abuseContact the AWS Trust and Safety team

7. Exam traps for Day 2

TrapCorrect thinking
"AWS patches my EC2 OS"Wrong. Customer patches the guest OS on EC2
Using the root user for daily tasksWrong. Use IAM users/roles; root only for specific tasks
Putting access keys inside EC2 codeWrong. Attach an IAM role
GuardDuty finds PIIWrong. Macie finds PII. GuardDuty finds threats
Inspector detects DDoSWrong. Shield handles DDoS; Inspector finds vulnerabilities
CloudTrail monitors CPUWrong. That is CloudWatch
SCPs grant permissionsWrong. They only set the maximum allowed permissions
Groups can be nestedWrong. IAM groups cannot contain other groups
IAM is regionalWrong. IAM is global
Artifact is for storing your documentsWrong. Artifact provides AWS's compliance reports

8. Key takeaways

  • Shared responsibility: AWS = security of the cloud; customer = security in the cloud.
  • IAM: least privilege, MFA, roles over keys, root only when needed.
  • Remember the security service matrix (Shield, WAF, GuardDuty, Inspector, Macie, Detective, Security Hub).
  • CloudTrail = who, Config = what changed, CloudWatch = how it performs, Artifact = compliance reports.
  • KMS manages keys, Secrets Manager rotates secrets, ACM manages certificates.

9. Day 2 practice questions

#QuestionAnswer
1Who is responsible for patching the guest operating system on an EC2 instance?The customer
2Which service discovers sensitive data such as PII stored in S3?Amazon Macie
3Where can you download AWS SOC and ISO compliance reports?AWS Artifact
4Which service records API calls made in your AWS account?AWS CloudTrail
5Which service protects web applications from SQL injection?AWS WAF
6Which feature should an EC2 instance use to access S3 securely without storing keys?An IAM role
7Which service provides automatic, free DDoS protection to all customers?AWS Shield Standard
8Which service automatically rotates database credentials?AWS Secrets Manager
9What is the best practice for the root user?Enable MFA and avoid daily use
10Which service applies guardrails (SCPs) across many AWS accounts?AWS Organizations
11Which service performs intelligent threat detection using CloudTrail, VPC Flow Logs and DNS logs?Amazon GuardDuty
12Which service scans EC2 instances and containers for software vulnerabilities?Amazon Inspector
Up next on Day 3: AWS Compute: EC2, pricing options, Auto Scaling, containers, and serverless.
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