Skip to main content
AWS Shared Responsibility Model

Module Overview

Estimated Time: 6-8 hours | Difficulty: Intermediate | Prerequisites: Core Concepts
This module covers AWS security from IAM fundamentals to advanced patterns including threat detection, compliance monitoring, and network protection. Security in AWS follows the “shared responsibility model” — AWS secures the infrastructure (the building), and you secure what you put inside it (the doors, locks, and who gets the keys). The most common AWS security incidents are not sophisticated hacks — they are leaked access keys on GitHub, overly permissive IAM policies, and publicly accessible S3 buckets. Security is critical for the AWS certification exams and real-world architecture.
Important: Learning cloud without security is incomplete and can lead to major risks. This module covers core security services and best practices that are essential for any production workload.
What You’ll Learn:
  • 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 Architecture and Policy Flow

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.
IAM Identity Center Architecture

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

AWS Security and Monitoring Services
AWS provides a comprehensive suite of security services for threat detection, compliance monitoring, and network protection.

Threat Detection Services

Amazon GuardDuty

GuardDuty is an intelligent threat detection service that continuously monitors for malicious activity and unauthorized behavior.
Key Features:
  • 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.
CloudTrail Event Example:
CloudTrail Insights Configuration:

AWS Config

Config continuously monitors and records AWS resource configurations and evaluates them against desired configurations.
Config Rules Example:

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.
WAF Configuration Example:

AWS Shield

Shield provides DDoS protection for AWS resources.

AWS Firewall Manager

Centrally manage security rules across your organization.
Golden Rule: Never hardcode credentials in code. Use IAM roles for services, Secrets Manager for applications, and environment variables only for local development.

🎯 Interview Questions

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
IAM Roles:
  • Temporary credentials (15 min - 12 hours)
  • No password/keys stored
  • Assumed by users, services, or external identities
  • Preferred for applications
When to use each:
  • User: Human access to AWS Console
  • Role: EC2, Lambda, cross-account access, SSO
Evaluation order:
  1. All applicable policies collected
  2. Check for explicit DENY → DENY wins
  3. Check for explicit ALLOW → ALLOW
  4. No match → Implicit DENY
Key rules:
  • Explicit DENY always wins
  • Must have explicit ALLOW to proceed
  • Default is implicit DENY
Policy types evaluated:
  1. SCPs (Organizations)
  2. Identity-based policies
  3. Resource-based policies
  4. Permission boundaries
  5. Session policies
Strategy:
  1. Start with zero access, add as needed
  2. Use managed policies for common patterns
  3. Use conditions to narrow scope:
  4. Use resource-level permissions:
  5. Regular access reviews with IAM Access Analyzer
  6. Permission boundaries to cap maximum permissions
Options (in order of preference):
  1. IAM Roles (no secrets needed)
    • Best for AWS service-to-service
  2. Secrets Manager
    • Automatic rotation
    • RDS/Aurora integration
    • $0.40/secret/month
  3. Parameter Store (SecureString)
    • Free tier available
    • KMS encryption
    • No auto-rotation
  4. Environment Variables
    • Okay for non-sensitive config
    • Never for passwords/API keys
Anti-patterns:
  • ❌ Hardcoded in source code
  • ❌ Committed to git
  • ❌ Stored in unencrypted files
Scenario: Account A needs to access S3 in Account BSetup:
  1. Account B: Create role with trust policy
  1. Account B: Attach S3 permissions to role
  2. Account A: IAM policy allowing sts:AssumeRole
  3. Account A: Application assumes role
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
Use IAM Users when:
  • 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
Best Practice: Prefer Identity Center for human access, IAM roles for applications.
Layered approach:
  1. Threat Detection:
    • GuardDuty for continuous monitoring
    • Inspector for vulnerability scanning
    • Macie for sensitive data discovery
  2. Logging & Audit:
    • CloudTrail for API logging (all regions)
    • Config for resource compliance
    • VPC Flow Logs for network visibility
  3. Centralization:
    • Security Hub to aggregate findings
    • CloudWatch for metrics/alarms
    • S3 for long-term log storage
  4. Response:
    • EventBridge for automated remediation
    • SNS for alerting
    • Lambda for custom responses
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
AWS Shield:
  • 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
Firewall Manager:
  • Centralized management across Organization
  • Manages: WAF rules, Shield, Security Groups
  • Auto-remediation capabilities
  • Compliance enforcement
When to use together:
  • WAF + Shield Advanced for comprehensive protection
  • Firewall Manager to enforce policies across accounts
Data Sources Analyzed:
  • CloudTrail management and data events
  • VPC Flow Logs
  • DNS query logs
  • S3 data events
  • EKS audit logs
  • RDS login activity
Detection Methods:
  • Machine learning for anomaly detection
  • Threat intelligence feeds
  • Known attack patterns
Finding Categories:
  • Reconnaissance (port scans, API probing)
  • Instance compromise (crypto mining, C&C)
  • Account compromise (unusual API calls)
  • Bucket compromise (public exposure)
Response Integration:

🧪 Hands-On Lab: Secure Application Setup

Objective: Configure secure access for a web application with proper IAM roles
1

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