Lesson 4 of 4 Multi-Account Governance

Automating Account Provisioning and Cross-Account Access

Account creation is only the beginning: every new account needs security services enabled, baseline roles and networking connected, and people and automation need controlled access to it. This lesson explains how to standardise account provisioning with event-driven automation, how organisation-wide services are enabled automatically, and how IAM roles, AWS STS and IAM Identity Center provide access across accounts.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe an automated account vending process from request to a fully baselined account.
  • Explain how organisation-wide security and governance services enrol new accounts automatically.
  • Explain cross-account role assumption, including trust policies, session duration, role chaining and external IDs.
  • Distinguish between access patterns for human identities and for automation across accounts.

The Account Vending Process

A standardised process turns an account request into a ready-to-use account without manual steps. The typical stages are listed below; the tools for each were introduced in the previous lessons.

  1. Request: a team submits a request with the account name, owner, environment, cost centre and OU, through a pull request (AFT), a Service Catalog product (Account Factory) or an internal portal that calls an API.
  2. Create and enrol: the account is created in the correct OU, so SCPs, RCPs and Control Tower controls apply from the start.
  3. Baseline: service-managed StackSets with automatic deployment, CfCT or AFT customisations deploy IAM roles, logging configuration, EventBridge forwarding rules and AWS Config rules.
  4. Enable organisation services: delegated administrators of security services enrol the account automatically, as described below.
  5. Connect: networking automation attaches the account's VPC to the shared Transit Gateway and associates Route 53 Resolver rules, often through AWS RAM shares to the OU.
  6. Hand over: access is granted to the owning team through IAM Identity Center, and budgets and alerts are created.

Without Control Tower, the same flow is built with Organizations CreateAccount, an EventBridge rule on the account creation completion event, and a Step Functions state machine that moves the account to its OU, waits for StackSets automatic deployment and performs the remaining steps.

The following diagram shows the stages of account vending.

The account vending process. A request with the name, owner, environment, cost centre and OU arrives through a pull request, a Service Catalog product or a portal. The account is created in its OU, so guardrails apply from the start. StackSets or customisations deploy the baseline, delegated administrators enrol it in security services, networking automation attaches it to the shared Transit Gateway, and the owning team receives access through IAM Identity Center with budgets in place. Without Control Tower, CreateAccount, an EventBridge rule and a Step Functions state machine build the same flow.
Placing the account in its OU first makes guardrails apply from the start.

Enabling Organisation Services Automatically

Most security and governance services can enrol every current and future account from a delegated administrator, so that a new account is never left unprotected. The table below lists the mechanism for each service.

ServiceOrganisation-wide mechanism
AWS CloudTrailAn organisation trail created in the management account (or by a delegated administrator) logs every account
AWS ConfigConfig recorders deployed by Control Tower or StackSets; an organisation aggregator in the delegated administrator; organisation Config rules and conformance packs
Amazon GuardDutyDelegated administrator with auto-enable for new member accounts
AWS Security HubDelegated administrator with central configuration policies applied to OUs
IAM Access AnalyzerOrganisation analyzer in the delegated administrator
Amazon Inspector and Amazon MacieDelegated administrator with automatic activation for new accounts
AWS Firewall ManagerAdministrator account applies security policies to accounts and OUs
AWS BackupBackup policies attached to OUs
Systems ManagerQuick Setup configurations deployed to OUs, such as Host Management

Cross-Account Role Assumption

Access to another account is granted by an IAM role in that account. The role's trust policy names the principals that may assume it, such as a specific role in a tooling account or an entire account; the role's permissions policies define what the assumed session may do. The caller needs sts:AssumeRole on the role ARN in its own identity policy. Calling AssumeRole returns temporary credentials (an access key ID, a secret access key and a session token) valid for the requested duration, from 15 minutes up to the role's maximum session duration, which can be set between one and 12 hours.

Role chaining

Using the credentials of one assumed role to assume another role is role chaining. Chained sessions are limited to a maximum of one hour, regardless of the second role's maximum session duration. Automation that chains roles and needs longer sessions must refresh credentials or assume the target role directly from a long-lived identity such as an instance profile.

External IDs and the confused deputy

When a third party, such as a monitoring vendor, assumes a role in your account on your behalf, the trust policy should require an sts:ExternalId condition with a value that the third party assigns uniquely to you. This prevents the confused deputy problem, in which another customer of the vendor tricks the vendor into using your role. For AWS services acting on your behalf, the equivalent protection is the aws:SourceAccount or aws:SourceArn condition in resource and trust policies.

Organisation-scoped trust

Trust policies and resource policies can use aws:PrincipalOrgID or aws:PrincipalOrgPaths to trust any principal in the organisation or in particular OUs, which avoids listing account IDs and adapts automatically as accounts are added.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"AWS": "arn:aws:iam::111111111111:role/DeploymentPipelineRole"},
    "Action": "sts:AssumeRole",
    "Condition": {"StringEquals": {"aws:PrincipalOrgID": "o-a1b2c3d4e5"}}
  }]
}
Scenario questions

Trust the right callers

Exam skills 2.2.3 · 6.1.1

Practise trust policies for cross-account roles.

Log in to try this activity Interactive activities are free with an account.

Human Access and Automation Access

People and automation should reach accounts differently. People sign in through IAM Identity Center, connected to the corporate identity provider, and receive access to accounts through permission sets, which Identity Center provisions as IAM roles in each assigned account. Sessions are temporary, MFA is enforced at sign-in, and access is managed centrally by group membership. Long-term IAM users with access keys should not be used for people.

Automation in AWS runs with IAM roles: pipeline service roles, Lambda execution roles, instance profiles and ECS task roles, each assuming roles in target accounts as needed. Automation outside AWS uses IAM Roles Anywhere with X.509 certificates, or OpenID Connect federation, for example from GitHub Actions, so that no long-term access keys are stored. These patterns are covered in more depth in the Identity and Access Management module.

Human access
MechanismIAM Identity Center permission sets
AuthenticationCorporate identity provider with MFA
Credential lifetimeSession-based, temporary
Choose when Engineers and operators.
Automation access
MechanismIAM roles assumed with AWS STS
AuthenticationService principals, instance profiles, OIDC or Roles Anywhere
Credential lifetimeTemporary; up to 12 hours, one hour when chained
Choose when Pipelines, functions and tools.
Sort into groups

How should it get access?

Exam skills 2.2.3 · 6.1.4

Choose how each person or workload should reach AWS accounts.

Log in to try this activity Interactive activities are free with an account.
Worked example

Event-Driven Account Baselining

An organisation without Control Tower creates accounts with the Organizations API. New accounts must join the correct OU, have GuardDuty and Security Hub enabled, receive a deployment role trusted by the pipeline account and be attached to the Transit Gateway.

  1. Trigger

    An EventBridge rule in the management account matches the CreateAccountResult event with a SUCCEEDED state and starts a Step Functions state machine.

  2. Place

    The state machine calls MoveAccount to place the account in its OU, so the OU's SCPs and the service-managed StackSets with automatic deployment apply.

  3. Baseline

    StackSets deploy the deployment role with an organisation-scoped trust policy; GuardDuty and Security Hub auto-enable the account from their delegated administrator.

  4. Network

    The Transit Gateway is shared with the OU through AWS RAM, and a StackSet creates the VPC attachment.

Check yourself

A Lambda function assumes role A, then uses those credentials to assume role B in another account with DurationSeconds set to 4 hours. The call fails. Why?

Show answer

This is role chaining, and chained role sessions are limited to one hour. The function should request a duration of one hour or less, or assume role B directly from its execution role.

Exam Tips

Remember for the exam

  • Automate account vending: create in the correct OU, baseline with StackSets or AFT or CfCT, auto-enable security services from delegated administrators, then connect networking.
  • GuardDuty, Security Hub, Inspector and Macie can auto-enable new member accounts from a delegated administrator; CloudTrail uses an organisation trail.
  • Cross-account access needs a trust policy in the target role and sts:AssumeRole in the caller's policy; role chaining limits sessions to one hour.
  • Require sts:ExternalId for third parties to prevent the confused deputy problem; use aws:PrincipalOrgID to trust the whole organisation.
  • Humans use IAM Identity Center permission sets; automation uses IAM roles, OIDC federation or IAM Roles Anywhere instead of long-term keys.