Module Overview
Estimated Time: 6-8 hours | Difficulty: Intermediate | Prerequisites: Core Concepts
- IAM users, groups, roles, and policies
- IAM Identity Center (AWS SSO) for centralized access
- Policy evaluation logic and troubleshooting
- AWS Organizations and SCPs
- KMS encryption and key management
- Secrets management patterns
- Threat Detection: GuardDuty, Inspector, Macie
- Compliance & Audit: CloudTrail, AWS Config, Security Hub
- Monitoring: CloudWatch logs, metrics, and alarms
- Network Protection: WAF, Shield, Firewall Manager
- Defense in depth strategies
IAM (Identity and Access Management)
IAM controls WHO can access WHAT in your AWS account. Think of IAM as the badge access system for a corporate office — Users are employees with badges, Groups are department access lists (“Engineering gets floor 3”), Roles are temporary visitor badges that anyone can pick up and drop off, and Policies are the rules programmed into each badge reader. IAM is the most fundamental AWS security service and arguably the most important thing to get right. Think of IAM as the keycard system for your entire building: it determines which doors (services) each person (or service) can open, at what times, and under what conditions. Getting IAM wrong is the number one cause of AWS security breaches — nearly every publicized S3 data leak traces back to misconfigured IAM or bucket policies.IAM Components
Users vs Roles
IAM Policies
JSON documents that define permissions. Every action in AWS — from launching an EC2 instance to reading an S3 object — is evaluated against one or more policies. The most common beginner mistake is granting"Action": "*" and "Resource": "*" to get things working, then never tightening it. This is the equivalent of giving everyone a master key to every room in your building.
Policy Structure
Policy Elements
Common Policy Patterns
Policy Evaluation Logic
IAM Roles for Services
Allow AWS services to access other AWS resources.EC2 Instance Profile
AWS Organizations
Manage multiple AWS accounts centrally.IAM Identity Center (AWS SSO)
IAM Identity Center provides centralized identity management for workforce users across your AWS Organization. It replaces the need to create individual IAM users in each account.Why Use IAM Identity Center?
Single Sign-On
One login provides access to all AWS accounts and applications
Centralized Management
Manage users and permissions from a single place
No Long-Term Credentials
Temporary credentials automatically issued and rotated
External IdP Integration
Connect to Okta, Azure AD, Google Workspace, and more
Identity Sources
Setting Up External IdP with SAML 2.0
Permission Sets
Permission Sets define what users can do in AWS accounts. They are reusable templates attached to users/groups for specific accounts.Identity Center CLI Configuration
External IdP Configuration (Okta Example)
ABAC (Attribute-Based Access Control)
Identity Center supports passing user attributes from your IdP for fine-grained access control.Encryption
Encryption at Rest
Encryption in Transit
- TLS/SSL for all API calls
- HTTPS endpoints
- VPN for hybrid connectivity
AWS KMS (Key Management Service)
Security Best Practices
Enable MFA
Require MFA for root and privileged users
Least Privilege
Grant only necessary permissions
Use Roles
Prefer roles over long-term credentials
Rotate Keys
Regularly rotate access keys
Enable CloudTrail
Log all API calls for auditing
Use SCPs
Enforce guardrails across accounts
Security Checklist
Security Services Overview
Threat Detection Services
Amazon GuardDuty
GuardDuty is an intelligent threat detection service that continuously monitors for malicious activity and unauthorized behavior.- No agents required: Analyzes AWS logs directly
- Multi-account support: Centralized via Organizations
- Automated response: Integrate with EventBridge for remediation
- 30-day free trial: Test before committing
Amazon Inspector
Inspector automatically discovers and scans workloads for software vulnerabilities and network exposure.Amazon Macie
Macie uses machine learning to discover, classify, and protect sensitive data in S3.Logging and Audit Services
AWS CloudTrail
CloudTrail records all API calls made in your AWS account - essential for security analysis, compliance, and troubleshooting.AWS Config
Config continuously monitors and records AWS resource configurations and evaluates them against desired configurations.AWS Security Hub
Security Hub provides a comprehensive view of security alerts and compliance status across AWS accounts.Monitoring with CloudWatch
Amazon CloudWatch provides monitoring and observability for AWS resources and applications.CloudWatch Components
Security-Focused CloudWatch Alarms
CloudWatch Logs Insights Queries
Database Monitoring
Network Protection Services
AWS WAF (Web Application Firewall)
WAF protects web applications from common exploits that could affect availability, compromise security, or consume excessive resources.AWS Shield
Shield provides DDoS protection for AWS resources.AWS Firewall Manager
Centrally manage security rules across your organization.🎯 Interview Questions
Q1: Explain the difference between IAM Users and Roles
Q1: Explain the difference between IAM Users and Roles
IAM Users:
- Permanent identities with long-term credentials
- Password and/or access keys
- Used for humans or CI/CD systems
- Should always have MFA enabled
- Temporary credentials (15 min - 12 hours)
- No password/keys stored
- Assumed by users, services, or external identities
- Preferred for applications
- User: Human access to AWS Console
- Role: EC2, Lambda, cross-account access, SSO
Q2: How does IAM policy evaluation work?
Q2: How does IAM policy evaluation work?
Evaluation order:
- All applicable policies collected
- Check for explicit DENY → DENY wins
- Check for explicit ALLOW → ALLOW
- No match → Implicit DENY
- Explicit DENY always wins
- Must have explicit ALLOW to proceed
- Default is implicit DENY
- SCPs (Organizations)
- Identity-based policies
- Resource-based policies
- Permission boundaries
- Session policies
Q3: How would you implement least privilege?
Q3: How would you implement least privilege?
Strategy:
- Start with zero access, add as needed
- Use managed policies for common patterns
-
Use conditions to narrow scope:
-
Use resource-level permissions:
- Regular access reviews with IAM Access Analyzer
- Permission boundaries to cap maximum permissions
Q4: How do you securely manage secrets in AWS?
Q4: How do you securely manage secrets in AWS?
Options (in order of preference):
-
IAM Roles (no secrets needed)
- Best for AWS service-to-service
-
Secrets Manager
- Automatic rotation
- RDS/Aurora integration
- $0.40/secret/month
-
Parameter Store (SecureString)
- Free tier available
- KMS encryption
- No auto-rotation
-
Environment Variables
- Okay for non-sensitive config
- Never for passwords/API keys
- ❌ Hardcoded in source code
- ❌ Committed to git
- ❌ Stored in unencrypted files
Q5: Explain cross-account access with IAM roles
Q5: Explain cross-account access with IAM roles
Scenario: Account A needs to access S3 in Account BSetup:
- Account B: Create role with trust policy
- Account B: Attach S3 permissions to role
- Account A: IAM policy allowing sts:AssumeRole
- Account A: Application assumes role
Q6: When would you use IAM Identity Center vs IAM Users?
Q6: When would you use IAM Identity Center vs IAM Users?
Use IAM Identity Center when:
- Managing access across multiple AWS accounts
- You have an existing IdP (Okta, Azure AD, etc.)
- You want SSO experience for users
- Need centralized permission management
- Want to eliminate long-term credentials
- Single AWS account with few users
- CI/CD pipelines (though roles are preferred)
- Service accounts that can’t use roles
- Legacy applications requiring access keys
Q7: How would you set up a security monitoring strategy?
Q7: How would you set up a security monitoring strategy?
Layered approach:
-
Threat Detection:
- GuardDuty for continuous monitoring
- Inspector for vulnerability scanning
- Macie for sensitive data discovery
-
Logging & Audit:
- CloudTrail for API logging (all regions)
- Config for resource compliance
- VPC Flow Logs for network visibility
-
Centralization:
- Security Hub to aggregate findings
- CloudWatch for metrics/alarms
- S3 for long-term log storage
-
Response:
- EventBridge for automated remediation
- SNS for alerting
- Lambda for custom responses
Q8: Explain AWS WAF vs Shield vs Firewall Manager
Q8: Explain AWS WAF vs Shield vs Firewall Manager
AWS WAF:
- Layer 7 (application) protection
- Protects against: SQL injection, XSS, bad bots
- Custom rules for specific threats
- Rate limiting
- Deployed on: CloudFront, ALB, API Gateway
- Layer 3/4 (network) DDoS protection
- Standard: Free, automatic protection
- Advanced: $3K/month, 24/7 DRT support, cost protection
- Protects: EC2, ELB, CloudFront, Route 53
- Centralized management across Organization
- Manages: WAF rules, Shield, Security Groups
- Auto-remediation capabilities
- Compliance enforcement
- WAF + Shield Advanced for comprehensive protection
- Firewall Manager to enforce policies across accounts
Q9: How does GuardDuty detect threats?
Q9: How does GuardDuty detect threats?
Data Sources Analyzed:
- CloudTrail management and data events
- VPC Flow Logs
- DNS query logs
- S3 data events
- EKS audit logs
- RDS login activity
- Machine learning for anomaly detection
- Threat intelligence feeds
- Known attack patterns
- Reconnaissance (port scans, API probing)
- Instance compromise (crypto mining, C&C)
- Account compromise (unusual API calls)
- Bucket compromise (public exposure)
🧪 Hands-On Lab: Secure Application Setup
Objective: Configure secure access for a web application with proper IAM roles1
Create IAM Role for EC2
Attach policy for S3 read, DynamoDB access
2
Create Application Secrets
Store database password in Secrets Manager with rotation
3
Configure KMS Key
Create CMK for application encryption, define key policy
4
Enable CloudTrail
Enable in all regions, log to S3 with encryption
5
Configure Access Analyzer
Find and fix overly permissive policies
Security Quick Reference
Next Module
Well-Architected Framework
Learn the 6 pillars of AWS Well-Architected Framework