devHọc Dev

Week 2 - Day 1: AWS Organizations, Multi-Account Patterns and IAM Identity Center

Week 2 – Day 1

This lesson combines 3 topics: AWS Organizations, Multi-Account Patterns, IAM Identity Center (AWS SSO).

Learning Objectives

  • Understand how AWS Organizations works
  • Master the OU structure and account hierarchy
  • Know how to use Service Control Policies (SCPs)
  • Understand common multi-account patterns
  • Master how to design an account structure
  • Know cross-account access patterns
  • Understand how IAM Identity Center works
  • Master Permission Sets and Account Assignments
  • Know how to integrate with external identity providers

Part 1: AWS Organizations

1. AWS Organizations Overview

Definition

AWS Organizations lets you centrally manage multiple AWS accounts, including:

  • Consolidated billing
  • Hierarchical grouping (OUs)
  • Policy-based management
  • Automated account provisioning

Basic structure

┌─────────────────────────────────────────────────────────┐│AWSOrganization││┌─────────────────────────────────────────────────┐│││ManagementAccount││││(Root/PayerAccount)│││└───────────────────────┬─────────────────────────┘│││││┌─────────────┴─────────────┐││││││┌────┴────┐┌────┴────┐│││OU││OU││││(Prod)││(Dev)│││└────┬────┘└────┬────┘││││││┌──────┼──────┐┌──────┼──────┐││││││││││┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐│││Acc││Acc││Acc││Acc││Acc││Acc││││1││2││3││4││5││6│││└───┘└───┘└───┘└───┘└───┘└───┘│└─────────────────────────────────────────────────────────┘

2. Organizational Units (OUs)

Best Practice OU Structure

Root├──SecurityOU│├──LogArchiveAccount│└──SecurityToolingAccount├──InfrastructureOU│├──NetworkAccount│└──SharedServicesAccount├──SandboxOU│└──DeveloperSandboxAccounts├──WorkloadsOU│├──ProductionOU││├──App1Production││└──App2Production│└──Non-ProductionOU│├──Development│├──Staging│└──Testing└──SuspendedOU└──DecommissionedAccounts

OU Design Principles

  1. Flat structure: Avoid too many levels (max 5)
  2. Purpose-based: Group by purpose
  3. Policy inheritance: SCPs inherit from the parent
  4. Separation of duties: Separate responsibilities

3. Service Control Policies (SCPs)

How it works

SCPsdefinetheMAXIMUMpermissionsavailabletoaccountsinanOU┌─────────────────────────────────────────────┐│PermissionEvaluation││││SCP∩IAMPolicy=EffectivePermissions││││┌─────────────┐┌─────────────┐│││SCP│∩│IAMPolicy││││Allow:A,B,C││Allow:B,C,D│││└─────────────┘└─────────────┘││││││└────────┬────────┘││▼││┌─────────────────┐│││Effective:││││B,C│││└─────────────────┘│└─────────────────────────────────────────────┘

SCP Inheritance

Root(FullAccessSCP)│┌─────────┴─────────┐▼▼ProductionOUDevOU(DenyRiskyActions)(AllowAll)││▼▼AppAccountSandboxAccount(InheritsDeny)(FullAccess)

SCP Strategies

Strategy 1: Deny List (Recommended)

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyLeaveOrg",
      "Effect": "Deny",
      "Action": "organizations:LeaveOrganization",
      "Resource": "*"
    },
    {
      "Sid": "DenyRootUser",
      "Effect": "Deny",
      "Action": "*",
      "Resource": "*",
      "Condition": {
        "StringLike": {
          "aws:PrincipalArn": "arn:aws:iam::*:root"
        }
      }
    }
  ]
}

Strategy 2: Allow List

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:*",
        "s3:*",
        "rds:*"
      ],
      "Resource": "*"
    }
  ]
}

Common SCP Use Cases

Use CaseSCP Action
Prevent leaving organizationDeny organizations:LeaveOrganization
Restrict regionsDeny all actions in non-approved regions
Prevent root user usageDeny * with root principal
Require encryptionDeny if encryption disabled
Prevent public S3Deny s3:PutBucketPublicAccessBlock

Example: Region Restriction SCP

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyNonApprovedRegions",
      "Effect": "Deny",
      "NotAction": [
        "cloudfront:*",
        "iam:*",
        "route53:*",
        "support:*"
      ],
      "Resource": "*",
      "Condition": {
        "StringNotEquals": {
          "aws:RequestedRegion": [
            "ap-southeast-1",
            "us-east-1"
          ]
        }
      }
    }
  ]
}

Resource Control Policies (RCPs) — launched 11/2024

An SCP answers the question "what can principals in the org do?". An RCP answers the opposite question: "who can resources in the org grant access to?". RCPs are the main tool for building a data perimeter at org scale — for example, preventing any S3 bucket in any member account from being shared with principals outside the org, no matter which team wrote the bucket policy.

SCPRCP
Boundary forPrincipals (IAM users/roles) in member accountsResources (buckets, keys, queues...) in member accounts
Affects principals outside the orgNoYes — applies when a principal outside the org calls a resource in the org
Grants permissions?NoNo
DefaultFullAWSAccessRCPFullAWSAccess
Affects Management AccountNoNo
Limits10 SCPs/entity, 10,240 characters (raised from 5 / 5,120 in 05/2026)5 RCPs/entity, 5,120 characters (RCPFullAWSAccess counts toward the quota and cannot be detached)
Supported servicesAllA limited, gradually expanding list: S3, STS, KMS, SQS, Secrets Manager (at launch), with more services added later

The classic RCP pattern — only principals in the org (or AWS services) can access resources:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "EnforceOrgIdentities",
      "Effect": "Deny",
      "Principal": "*",
      "Action": ["s3:*", "sqs:*", "kms:*", "secretsmanager:*", "sts:AssumeRole"],
      "Resource": "*",
      "Condition": {
        "StringNotEqualsIfExists": {
          "aws:PrincipalOrgID": "o-xxxxxxxxxx"
        },
        "BoolIfExists": {
          "aws:PrincipalIsAWSService": "false"
        }
      }
    }
  ]
}

Common exam points:

  • "Prevent resources from being shared with identities outside the organization" → RCP (not SCP, because SCPs don't apply to principals outside the org).
  • "Prevent identities in the organization from accessing resources outside the organization" → SCP with aws:ResourceOrgID.
  • RCP + SCP + VPC endpoint policy = the three sides of the data perimeter (identity, resource, network).
  • An RCP has Principal in its statements (like a resource policy); an SCP does not.
  • RCPs you create can only use Effect: Deny; Allow exists only in the default RCPFullAWSAccess. Actions must be service-specific (s3:*, kms:*...); you can't use "*" for everything.
  • RCPs don't apply to service-linked roles and AWS managed KMS keys — if a question asks "why does the service-linked role still work", this is the reason.

Declarative Policies — launched 12/2024

A declarative policy declares the default configuration of a service for the whole org/OU, and the service enforces it at the API layer, with no need to write complex IAM/SCP denies. It currently supports EC2 and related services:

AttributeMeaning
ec2_attributes.allowed_images_settingsOnly allow launches from AMIs of permitted accounts/partners (Allowed AMIs)
ec2_attributes.image_block_public_accessBlock public AMIs
ec2_attributes.snapshot_block_public_accessBlock public EBS snapshots
ec2_attributes.instance_metadata_defaultsIMDSv2 required by default
ec2_attributes.serial_console_accessDisable the serial console
ec2_attributes.vpc_block_public_accessBlock internet gateway ingress/egress for the whole VPC

Difference from SCPs: an SCP blocks an API call, while a declarative policy sets a configuration state and provides an account status report to see which accounts are not yet compliant. Exam keyword: "enforce IMDSv2 / block public AMI across all accounts with least operational overhead" → declarative policy.

4. Consolidated Billing

How it works

┌─────────────────────────────────────────────────────────┐│ManagementAccount(Payer)││││Receivesconsolidatedbillforallmemberaccounts││││┌─────────┐┌─────────┐┌─────────┐┌─────────┐│││AccA││AccB││AccC││AccD││││$100││$200││$150││$50│││└─────────┘└─────────┘└─────────┘└─────────┘││││TotalBill:$500││+Volumediscountsappliedacrossallaccounts│└─────────────────────────────────────────────────────────┘

Benefits

  1. Volume discounts: Usage aggregated across accounts
  2. Reserved Instance sharing: RIs apply across organization
  3. Savings Plans sharing: SPs apply across organization
  4. Single payment method: One bill, one payment

5. Organization Features

All Features vs Consolidated Billing Only

FeatureAll FeaturesBilling Only
Consolidated billing✓✓
SCPs✓✗
Resource control policies (RCPs)✓✗
Declarative policies✓✗
Tag policies✓✗
Backup policies✓✗
AI services opt-out✓✗
Service access✓✗

Delegated Administrator

ManagementAccount││Delegate▼┌─────────────────────────────────────┐│SecurityAccount││(DelegatedAdminfor)││-GuardDuty││-SecurityHub││-Config││-FirewallManager│└─────────────────────────────────────┘→ReduceaccesstoManagementAccount→Securityteammanagessecurityservices

6. AWS Control Tower

Relationship with Organizations

┌─────────────────────────────────────────────────────────┐│AWSControlTower││(OrchestrationLayer)││││┌─────────────────────────────────────────────────┐│││AWSOrganizations││││(Foundation)│││└─────────────────────────────────────────────────┘││││Features:││-LandingZonesetup││-Controls(preventive+detective+proactive)││-AccountFactory││-Dashboard│└─────────────────────────────────────────────────────────┘

7. CloudTrail Organizational Trail

Concept

An organizational trail is a CloudTrail trail created from the management account (or from the delegated administrator for CloudTrail) that automatically applies to EVERY member account in the Organization — including accounts created/joined later.

Key characteristics (frequently tested)

  • Create once, cover the whole org: no need to go into each account and create a separate trail — reduces operational overhead.
  • Member accounts CANNOT interfere: a member account sees the organizational trail (read-only) in its console/API but cannot disable (StopLogging), modify, or delete it. This is the anti-tampering mechanism — even the member account's admin cannot turn off the audit log.
  • Logs centralized in one place: all events from every account are written to a single S3 bucket in a central account, partitioned by the prefix AWSLogs/<org-id>/<account-id>/....
  • New accounts are covered automatically: when a new account joins the org → the trail applies immediately, with no extra steps.

Centralized logging architecture

┌──────────────────────────────────────────────────────────────┐│AWSOrganization││││ManagementAccount────createsOrganizationalTrail││(orDelegatedAdmin)││││auto-applied││┌──────────────┬───────┴──────┬──────────────┐││▼▼▼▼││┌─────────┐┌─────────┐┌─────────┐┌────────┐│││AccA││AccB││AccC││AccN││││(trail││(trail││(trail││(trail││││visible,││read-││cannot││cannot││││noedit)││only)││disable)││delete)│││└────┬────┘└────┬────┘└────┬────┘└───┬────┘││││││││└──────────────┴──────┬───────┴─────────────┘││▼││┌───────────────────────────┐│││LogArchiveAccount││││S3bucket(central)││││AWSLogs/o-xxxx/<acct>/│││└───────────────────────────┘│└──────────────────────────────────────────────────────────────┘

Bucket policy for the central S3 bucket

The S3 bucket in the central account must have a bucket policy that allows the service principal cloudtrail.amazonaws.com to write logs, scoped to the org trail's ARN via aws:SourceArn (confused deputy protection):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AWSCloudTrailWrite",
      "Effect": "Allow",
      "Principal": {"Service": "cloudtrail.amazonaws.com"},
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::central-audit-logs/AWSLogs/*",
      "Condition": {
        "StringEquals": {
          "s3:x-amz-acl": "bucket-owner-full-control",
          "aws:SourceArn": "arn:aws:cloudtrail:ap-southeast-1:111111111111:trail/org-trail"
        }
      }
    }
  ]
}

Best practice

  • Log to an S3 bucket in a separate Log Archive account (not the management account) — separating log access from org administration rights. AWS Control Tower does exactly this when setting up the landing zone: it automatically creates an organizational trail that writes to the Log Archive account.
  • Enable log file validation + S3 Object Lock/versioning to strengthen the immutability of the audit trail.
  • Delegate CloudTrail administration to the security account (delegated administrator) to reduce use of the management account.

Exam keyword: "centralize audit logs across all accounts in the organization" + "prevent member accounts from tampering/disabling logging" → CloudTrail organizational trail (not a per-account trail + a manual SCP).

8. aws:PrincipalOrgID in Resource Policies

The problem

You want all accounts in the Organization to access a resource (S3 bucket, SQS queue, SNS topic, KMS key, Secrets Manager secret, Lambda, VPC endpoint policy...) — listing every account ID in the resource policy bloats the policy, and you have to update it every time an account is added or removed.

Solution: the aws:PrincipalOrgID condition key

A global condition key that compares the Organization ID of the calling principal with a specified value. With a single condition, every principal (IAM user/role) in any account in the org matches — accounts that join the org get access automatically, and accounts that leave lose it automatically.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowOrgWideAccess",
      "Effect": "Allow",
      "Principal": "*",
      "Action": ["s3:GetObject", "s3:ListBucket"],
      "Resource": [
        "arn:aws:s3:::shared-artifacts",
        "arn:aws:s3:::shared-artifacts/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:PrincipalOrgID": "o-a1b2c3d4e5"
        }
      }
    }
  ]
}

Note: "Principal": "*" combined with the aws:PrincipalOrgID condition is not public — only authenticated principals belonging to the org satisfy the condition (anonymous access has no org ID, so it is excluded).

aws:PrincipalOrgPaths — scoping by OU

When you only want to allow accounts in a specific OU (not the whole org), use aws:PrincipalOrgPaths with the OU path:

{
  "Condition": {
    "ForAnyValue:StringLike": {
      "aws:PrincipalOrgPaths": "o-a1b2c3d4e5/r-ab12/ou-ab12-11111111/*"
    }
  }
}
  • The path has the form <org-id>/<root-id>/<ou-id>/...; a trailing * wildcard also covers the sub-OUs below.
  • It is a multivalued key → you must use the set operator ForAnyValue/ForAllValues.

Quick comparison

Condition keyScopeUse case
aws:PrincipalOrgIDThe entire organizationShare a resource with every account in the org
aws:PrincipalOrgPathsA specific OU (and its sub-OUs)Only the Production OU has access
aws:PrincipalAccountOne accountGrant to a single account

Exam keyword: "grant access to all accounts in the organization" / "without listing/maintaining individual account IDs" → resource policy with aws:PrincipalOrgID. If the question restricts to "only accounts in the Production OU" → aws:PrincipalOrgPaths.

Part 2: Multi-Account Patterns

1. Why Multi-Account?

Single Account Problems

SingleAccount:┌─────────────────────────────────────────────┐│Account││┌─────────┐┌─────────┐┌─────────┐│││Dev││Test││Prod│││└─────────┘└─────────┘└─────────┘││││Problems:││-Blastradius(mistakeaffectsall)││-Permissioncomplexity││-Resourcelimitsshared││-Billingnotseparated││-Compliancechallenges│└─────────────────────────────────────────────┘

Benefits of Multi-Account

Multi-Account:┌───────────┐┌───────────┐┌───────────┐│Dev││Test││Prod││Account││Account││Account│└───────────┘└───────────┘└───────────┘│││└─────────────┴─────────────┘│┌──────────────┴──────────────┐│SecurityAccount││(Centralizedlogging)│└─────────────────────────────┘Benefits:✓Workloadisolation✓Clearsecurityboundaries✓Separatebilling✓Independentservicelimits✓Simplifiedcompliance

2. Common Account Patterns

Pattern 1: Environment-based

┌─────────────────────────────────────────────┐│Organization││││┌─────────────────────────────────────┐│││WorkloadsOU││││┌─────────┐┌─────────┐┌───────┐│││││Dev││Stage││Prod││││││Account││Account││Account│││││└─────────┘└─────────┘└───────┘│││└─────────────────────────────────────┘│└─────────────────────────────────────────────┘Usecase:Simpleapplications,smallteams

Pattern 2: Team-based

┌─────────────────────────────────────────────┐│Organization││││┌──────────────┐┌──────────────┐│││TeamAOU││TeamBOU││││┌───┐┌───┐││┌───┐┌───┐│││││Dev││Prd││││Dev││Prd│││││└───┘└───┘││└───┘└───┘│││└──────────────┘└──────────────┘│└─────────────────────────────────────────────┘Usecase:Autonomousteams,microservices

Pattern 3: Application-based

┌─────────────────────────────────────────────┐│Organization││││┌────────────┐┌────────────┐│││App1OU││App2OU││││┌────────┐││┌────────┐│││││Dev│Prd││││Dev│Prd│││││└────────┘││└────────┘│││└────────────┘└────────────┘│└─────────────────────────────────────────────┘Usecase:Multipleproducts,differentcompliance

3. AWS Landing Zone Pattern

Root│├──ManagementAccount(root/payer—alwayssitsatRoot,│cannotbemovedintoanOU)│├──CoreOU│├──LogArchiveAccount││└──Centralizedlogs(CloudTrail,Config,etc.)│├──SecurityAccount││└──Securitytools(GuardDuty,SecurityHub)│└──AuditAccount│└──Read-onlyaccessforauditors│├──InfrastructureOU│├──NetworkAccount││└──TransitGateway,DirectConnect│└──SharedServicesAccount│└──AD,DNS,CI/CDtools│├──SandboxOU│└──Developerexperimentationaccounts│├──WorkloadsOU│├──ProductionOU││└──Productionaccounts│└──Non-ProductionOU│└──Dev,Test,Stagingaccounts│└──SuspendedOU└──Accountspendingdeletion

4. Cross-Account Access

┌─────────────────┐┌─────────────────┐│AccountA││AccountB││(Source)││(Target)││││││┌───────────┐│Assume│┌───────────┐│││IAMUser││──────────►││IAMRole││││orRole││Role│││││└───────────┘││└───────────┘││││││Needs:││Needs:││sts:AssumeRole││TrustPolicy││permission││allowingAccA│└─────────────────┘└─────────────────┘

Trust Policy (Account B):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111111111111:root"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": {
          "sts:ExternalId": "unique-external-id"
        }
      }
    }
  ]
}

Method 2: Resource-based Policies

┌─────────────────┐┌─────────────────┐│AccountA││AccountB││││││┌───────────┐│Direct│┌───────────┐│││IAMUser││──────────►││S3Bucket││││││Access│││││└───────────┘││└───────────┘││││││Needs:││Needs:││s3:GetObject││BucketPolicy││permission││allowingAccA│└─────────────────┘└─────────────────┘

Bucket Policy (Account B):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111111111111:user/username"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::bucket-name/*"
    }
  ]
}

When to use which?

ScenarioMethod
Access multiple resourcesIAM Role
Temporary accessIAM Role
Single resource accessResource Policy
S3, SQS, SNS, KMSEither
Audit requirementsIAM Role (better audit)

5. Centralized Services Pattern

Centralized Logging

┌─────────────────────────────────────────────────────────┐│LogArchiveAccount││││┌─────────────────────────────────────────────────┐│││S3Bucket(Logs)││││││││CloudTrail←Allaccounts││││Config←Allaccounts││││VPCFlows←Allaccounts││││CloudWatch←Allaccounts│││└─────────────────────────────────────────────────┘││││Features:││-Bucketpolicypreventsdeletion││-S3ObjectLockforcompliance││-Lifecyclepoliciesforcostoptimization│└─────────────────────────────────────────────────────────┘

Centralized Security

┌─────────────────────────────────────────────────────────┐│SecurityAccount││(DelegatedAdmin)││││┌──────────┐┌──────────┐┌──────────┐┌──────────┐│││GuardDuty││Security││Config││Inspector││││Admin││Hub││Aggregator││Admin│││└──────────┘└──────────┘└──────────┘└──────────┘││││││││└────────────┴────────────┴────────────┘│││││Aggregatesfindingsfrom││allmemberaccounts│└─────────────────────────────────────────────────────────┘

Centralized Network

┌─────────────────────────────────────────────────────────┐│NetworkAccount││││┌─────────────────────────────────────────────────┐│││TransitGateway│││││││││┌──────────────┼──────────────┐│││││││││││▼▼▼││││VPCAVPCBVPCC││││(Acc1)(Acc2)(Acc3)│││└─────────────────────────────────────────────────┘││││Alsocontains:││-DirectConnectGateway││-VPNconnections││-DNS(Route53Resolver)│└─────────────────────────────────────────────────────────┘

6. Account Vending

AWS Service Catalog

AccountRequest→ServiceCatalog→CloudFormation│▼┌─────────────────────┐│NewAccount││││-StandardVPC││-IAMRoles││-SecurityConfig││-Loggingenabled│└─────────────────────┘

AWS Control Tower Account Factory

┌─────────────────┐│ControlTower││AccountFactory│└────────┬────────┘│┌──────────────┼──────────────┐│││▼▼▼┌──────────┐┌──────────┐┌──────────┐│Apply││Create││Apply││Controls││Account││Baseline│└──────────┘└──────────┘└──────────┘

Part 3: IAM Identity Center (AWS SSO)

1. IAM Identity Center Overview

Definition

IAM Identity Center (formerly AWS SSO) provides:

  • Single sign-on for multiple AWS accounts
  • Centralized access management
  • Integration with external IdPs
  • Temporary credentials (no long-term keys)

Architecture

┌─────────────────────────────────────────────────────────┐│IAMIdentityCenter││││┌─────────────────┐┌─────────────────────────────┐│││IdentitySource││PermissionSets││││││││││-Built-in││┌──────────────────────┐││││-ADConnector│││AdminAccess│││││-AWSManagedAD│││ViewOnlyAccess│││││-ExternalIdP│││DatabaseAdmin│││││(Okta,Azure)│││CustomPermissions││││└─────────────────┘│└──────────────────────┘│││└─────────────────────────────┘│││││┌──────────────┴──────────────┐││▼▼▼││┌──────────┐┌──────────┐┌──────────┐│││Account1││Account2││Account3│││└──────────┘└──────────┘└──────────┘│└─────────────────────────────────────────────────────────┘

2. Identity Sources

Option 1: Built-in Identity Store

Pros:
- Simplest setup
- No additional cost
- Built-in MFA

Cons:
- Separate user management
- No sync with corporate directory

Use case: Small organizations without existing IdP

Option 2: AWS Managed Microsoft AD

┌─────────────────────────────────────────────┐│AWSManagedAD││││┌─────────────┐┌─────────────┐│││Domain││Domain││││Controller││Controller││││(AZ1)││(AZ2)│││└─────────────┘└─────────────┘││││││└────────┬─────────┘│││││ADTrustwithon-prem│└─────────────────────────────────────────────┘Usecase:ExistingADenvironment,needADfeatures

Option 3: External Identity Provider (SAML 2.0)

┌─────────────────┐┌─────────────────┐│ExternalIdP│SAML│IAMIdentity││(Okta,Azure│───────►│Center││AD,Ping)│││└─────────────────┘└─────────────────┘Benefits:-Singlesourceoftruth-LeverageexistingIdPinvestment-ConsistentuserexperienceUsecase:EnterprisewithexistingIdP

Comparison

FeatureBuilt-inManaged ADExternal IdP
Setup complexityLowMediumMedium
User managementManualAD toolsIdP tools
Corporate syncNoYes (trust)Yes (SCIM)
MFABuilt-inAD MFAIdP MFA
CostFreeAD costIdP cost

3. Permission Sets

Definition

Permission Sets are collections of policies that define access permissions to AWS accounts.

Types

1. AWS Managed Policies
   - AdministratorAccess
   - ViewOnlyAccess
   - Billing
   - PowerUserAccess

2. Customer Managed Policies
   - Custom policies you create

3. Inline Policies
   - Policies attached directly to the permission set

Permission Set Structure

{
  "PermissionSet": {
    "Name": "DatabaseAdmin",
    "Description": "Full access to RDS and DynamoDB",
    "SessionDuration": "PT4H",
    "ManagedPolicies": [
      "arn:aws:iam::aws:policy/AmazonRDSFullAccess",
      "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess"
    ],
    "InlinePolicy": {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Deny",
          "Action": "rds:DeleteDBInstance",
          "Resource": "*",
          "Condition": {
            "StringNotEquals": {
              "aws:ResourceTag/Environment": "dev"
            }
          }
        }
      ]
    },
    "PermissionsBoundary": {
      "ManagedPolicyArn": "arn:aws:iam::aws:policy/boundary-policy"
    }
  }
}

Permission Set Best Practices

  1. Least privilege: Grant only the permissions needed
  2. Separation of duties: Separate responsibilities
  3. Use managed policies: Easy to maintain
  4. Permission boundaries: Cap the maximum permissions
  5. Session duration: Set appropriate timeout

4. Account Assignments

How it works

┌──────────────────────────────────────────────────────┐│AccountAssignment││││User/Group+PermissionSet+Account=Access││││┌─────────┐┌──────────────┐┌─────────┐│││John│+│AdminAccess│+│Prod│=✓│││Doe││││Account│││└─────────┘└──────────────┘└─────────┘││││┌─────────┐┌──────────────┐┌─────────┐│││DevTeam│+│PowerUser│+│Dev│=✓│││Group││Access││Account│││└─────────┘└──────────────┘└─────────┘│└──────────────────────────────────────────────────────┘

Assignment Matrix Example

PermissionSetsAdmin│PowerUser│ReadOnlyAccount─────────────────────────────Production✓✓(SecurityTeam)✓(AuditTeam)Staging✓✓(PlatformTeam)✓(DevTeam)Development✓✓(Everyone)

5. Temporary Credentials Flow

User Login Flow

1.UseraccessesSSOportal│▼2.AuthenticatewithIdP(username/password+MFA)│▼3.SelectAWSaccount│▼4.SelectPermissionSet│▼5.Gettemporarycredentials(viaSTSAssumeRole)│▼6.AccessAWSConsoleorCLI

CLI Access

# Configure SSO
aws configure sso
# → Enter SSO start URL
# → Enter SSO Region
# → Browser opens for authentication
# → Select account and role

# Use profile
aws s3 ls --profile my-sso-profile

# Or set default
export AWS_PROFILE=my-sso-profile
aws s3 ls

6. ABAC with IAM Identity Center

Attribute-Based Access Control

UserAttributes(fromIdP):-Department:Engineering-CostCenter:CC-123-Project:ProjectASessionTags:┌───────────────────────────────────────────┐│aws:PrincipalTag/Department=Engineering││aws:PrincipalTag/CostCenter=CC-123││aws:PrincipalTag/Project=ProjectA│└───────────────────────────────────────────┘Policyusingtags:{"Effect":"Allow","Action":"ec2:*","Resource":"*","Condition":{"StringEquals":{"ec2:ResourceTag/Project":"${aws:PrincipalTag/Project}"}}}

7. Multi-Account Permissions

Delegated Administration

ManagementAccount││Delegateto▼┌─────────────────────────────────────┐│IAMIdentityCenterAdmin││(DelegatedAdministrator)││││Canmanage:││-UsersandGroups││-PermissionSets││-AccountAssignments│└─────────────────────────────────────┘Benefit:ReduceaccesstoManagementAccount

8. Integration Patterns

Pattern 1: Okta Integration

Okta(IdP)││SAML2.0│SCIM(UserProvisioning)│▼IAMIdentityCenter││AssumeRole│▼AWSAccounts

Pattern 2: Azure AD Integration

AzureAD(IdP)││SAML2.0│SCIM│▼IAMIdentityCenter│▼AWSAccounts+AzureADConditionalAccess+AzureMFA

Review Questions

  1. Is the Management Account affected by SCPs?

    Show answer

    No — SCPs do not apply to the management account, not even the SCP at the root OU. Best practice: don't deploy workloads in the management account. Use the management account only for organization management, billing, and Control Tower. All workloads should live in member accounts — subject to SCP governance.

  2. How does SCP inheritance work?

    Show answer

    SCPs apply hierarchically: Root → OU → Sub-OU → Account. An account must have an SCP allow at every parent level for an action to be permitted. Example: a Root SCP denies us-west-2 → no account, including those in child OUs, can use us-west-2. An OU SCP restricts further within what the Root SCP already allows. You cannot use an OU SCP to "unblock" what the Root SCP has blocked.

  3. Deny List vs Allow List SCP strategy: which one is recommended?

    Show answer

    AWS recommends the Deny List (allow all by default, explicitly deny specific things). Reason: easier to start — all permissions are available by default, and you only add a Deny when you need to restrict (for example: deny region access, deny specific services). An Allow List (deny all by default, explicitly allow everything needed) is more complex, risks blocking unexpected services, and has high maintenance overhead. Deny Lists are more common in production Organizations.

  4. Can Reserved Instances be shared across the organization?

    Show answer

    Yes — with consolidated billing, the RIs and Savings Plans of one account in the Organization automatically apply (as a discount) to other accounts if those accounts have matching usage and the RI isn't fully used. You can disable sharing per account if you want (RI credit sharing settings in Billing). This is why consolidated billing saves money: unused RIs aren't "wasted" but benefit the entire org.

  5. What is a Delegated Administrator used for?

    Show answer

    It lets a member account manage an AWS service for the entire Organization (instead of doing it from the management account). Examples: delegate GuardDuty admin to the Security account, delegate Config admin to the Audit account, delegate IAM Identity Center admin to a dedicated SSO account. It reduces the need to access the management account and separates concerns — the security team manages from its own security account.

  6. A company needs to centralize CloudTrail logs from 50 accounts and ensure that member account admins cannot disable logging. Which solution has the least operational overhead?

    Show answer

    A CloudTrail organizational trail created from the management account (or delegated administrator), logging to an S3 bucket in the Log Archive account. The trail automatically applies to every member account (including newly joined accounts); member accounts see the trail but cannot StopLogging/modify/delete it. Compared with creating a trail in each account + an SCP denying cloudtrail:StopLogging: the organizational trail has less overhead (a single trail, no need to maintain 50 trails + an SCP), and tamper protection is built in rather than depending on a correctly written SCP.

  7. How do you allow all accounts in the Organization to read an S3 bucket without listing every account ID?

    Show answer

    Use a bucket policy with the aws:PrincipalOrgID condition: "Condition": {"StringEquals": {"aws:PrincipalOrgID": "o-xxxx"}} together with "Principal": "*". Only authenticated principals belonging to the org satisfy the condition (it's not public); accounts that join the org get access automatically, and accounts that leave lose it automatically — no need to maintain a list of account IDs. If you only want to restrict to a specific OU → use aws:PrincipalOrgPaths (a multivalued key, requires ForAnyValue:StringLike) with the path o-xxxx/r-xxxx/ou-xxxx/*.

  8. What are the 3 common multi-account patterns?

    Show answer

    (1) Environment separation: Prod, Dev, Test, Staging in separate accounts — blast radius isolation, different IAM policies per environment. (2) Workload/team separation: each team or product in its own account — ownership clarity, independent billing, IAM isolation. (3) Security/Shared services: dedicated accounts for Log Archive, Security/Audit, Network Hub, Shared Services (CI/CD, monitoring). All 3 patterns are usually combined.

  9. What does cross-account access via an IAM Role require on both sides?

    Show answer

    Account A (owns the role being assumed): the role's trust policy allows a principal from Account B to assume the role (sts:AssumeRole). Account B (wants to assume the role): the identity has an IAM policy with sts:AssumeRole permission on Account A's role ARN. Both conditions must be satisfied — they cannot be bypassed. Optionally: an External ID in the trust policy for additional security with 3rd-party vendors.

  10. What should the Log Archive Account contain?

Show answer

All audit/compliance logs: CloudTrail (the Organization Trail records logs from every account), CloudWatch Logs (centralized), Config snapshots, S3 Access Logs, ALB Access Logs. Policies: an S3 bucket policy that only allows appends (no delete), Vault Lock on AWS Backup, MFA delete on the S3 bucket. Access: only the Security/Compliance team has read access. Member accounts have write only, no delete.

  1. Which services does the Network Account usually manage?
Show answer

Transit Gateway (hub routing between VPCs and on-premises), Direct Connect connections, AWS Network Firewall, Route 53 Resolver (central DNS), VPC Sharing (sharing subnets from a centralized VPC to member accounts), NAT Gateways (centralized egress). Centralized networking reduces cost (no need for a separate DX per account) and increases visibility and control over traffic flow.

  1. How does an account vending machine work?
Show answer

Account Factory (in Control Tower) automatically creates accounts with: pre-configured controls (formerly: guardrails), SSO access, a baseline VPC, and logging setup. Process: the team fills in a form → Account Factory triggers Service Catalog → creates a new AWS account → applies SCPs, baselines, SSO configuration → notifies the requester. The account is ready to use in minutes instead of the days a manual process takes. Customizable with Account Factory Customization (hooks).

  1. What are the Identity Source options?
Show answer

3 options: (1) IAM Identity Center directory (built-in, create/manage users in Identity Center), (2) Active Directory (AWS Managed Microsoft AD or AD Connector for on-premises AD), (3) External IdP (Okta, Azure AD, OneLogin, Google Workspace) via SAML 2.0. You can only choose 1 identity source at a time. Changing the identity source requires reassigning account assignments.

  1. What is a Permission Set and what does it contain?
Show answer

A Permission Set is a template that defines the permissions assigned to a user/group when they access an account. It contains: AWS managed policies (e.g. ReadOnlyAccess, AdministratorAccess), Customer managed policies, an Inline policy, and a Permission Boundary. When a user accesses an account through the IAM Identity Center portal, the Permission Set creates a temporary IAM Role in that account with the defined permissions.

  1. How does an Account Assignment work?
Show answer

An Account Assignment is a mapping: User/Group → Permission Set → AWS Account. Example: the group "Developers" has the Permission Set "DevAccess" assigned to the account "Dev-123". When a Developer logs in to the Identity Center portal, they see Dev-123 in their account list and can assume the DevAccess role. IAM Identity Center automatically creates and maintains IAM Roles in the target accounts based on the assignments.

  1. What is ABAC with IAM Identity Center?
Show answer

Attribute-Based Access Control — uses user attributes (from the Identity Source: department, title, team) as tags to control access. Example: a user with the attribute Department=Finance is assigned to accounts tagged Department=Finance. Less need to manage individual assignments — add a user to the right group with the right attribute → access is granted automatically. Especially powerful when the user directory syncs with AD/Okta (attributes populate automatically).

  1. What is a Delegated Administrator used for?
Show answer

It lets you delegate administration of IAM Identity Center from the management account to a member account (usually a Security/Identity account). Administrators in that member account can manage users, groups, permission sets, and account assignments for the entire Organization — without accessing the management account. Best practice for separation of duties: minimal management account credentials, with the Identity admin team working from a dedicated account.

Hands-on Exercises

Part 1: AWS Organizations

  • Create an AWS Organization with 2 OUs
  • Create an SCP that denies a specific region
  • Setup consolidated billing view
  • Explore Control Tower landing zone

Part 2: Multi-Account Patterns

  • Design a multi-account structure for a fictitious company
  • Setup cross-account role
  • Configure centralized CloudTrail
  • Explore Control Tower Account Factory

Part 3: IAM Identity Center (AWS SSO)

  • Enable IAM Identity Center
  • Create permission sets
  • Create a user and assign to accounts
  • Test CLI access with SSO

References


Next lesson →