Sub topic 1
The organization tree: root, OUs, and accounts
AWS Organizations arranges your accounts in a tree. SCPs and RCPs attach to nodes of this tree, so you need to know its shape before you write any guardrail. This chapter covers the three kinds of node and the rules that govern them.
Prerequisites
This chapter assumes you:
- Know what an AWS account, an IAM user, and an IAM role are.
- Can read IAM policy JSON (Effect, Action, Resource, Condition).
- Can run AWS CLI commands, or find the same pages in the Management Console.
- Have an organization with all features enabled. Policies such as SCPs and RCPs are not available in the consolidated-billing-only mode.
The three kinds of node
An organization has one root, any number of organizational units (OUs), and your accounts.
- Root: the top of the tree. Each organization has exactly one root. Its ID looks like
r-examplerootid. - Organizational unit (OU): a container for accounts and other OUs. Its ID looks like
ou-exam-ple12345. You use OUs to group accounts that should share the same rules, such as production workloads or sandboxes. - Account: a 12-digit AWS account. Accounts are the leaves of the tree. An account cannot contain other nodes.
Accounts come in two roles. The management account created the organization and pays the bills for it. Member accounts are all the others. Each organization has exactly one management account.
Rules of the tree
- One parent per node. An account or OU sits under exactly one parent. An account can be directly under the root or under one OU, but never in two places.
- Nesting has a limit. OUs can nest up to five levels below the root. Deep trees are hard to reason about, so most organizations stay at two or three levels.
- Accounts can move. You can move an account to a different OU. Its effective policies change immediately, because they depend on where the account sits.
- The management account is special. It is a node in the tree like any other, but SCPs do not restrict it. A later chapter covers this. For now, avoid running workloads in it.
Inspecting your tree with the CLI
Start at the root and walk down. The commands below list the organization, its root, the OUs under the root, and the accounts directly under it.
# Describe the organization and find the management account
aws organizations describe-organization
# Find the root ID
aws organizations list-roots
# List OUs directly under the root
aws organizations list-organizational-units-for-parent \
--parent-id r-examplerootid
# List accounts directly under an OU (or the root)
aws organizations list-accounts-for-parent \
--parent-id ou-exam-ple12345Each call returns only one level. To see a nested OU, call list-organizational-units-for-parent again with the child OU's ID as the parent.
To move an account, give its current parent and its new parent:
aws organizations move-account \
--account-id 111122223333 \
--source-parent-id r-examplerootid \
--destination-parent-id ou-exam-ple12345Designing the tree for guardrails
The tree is your main tool for scoping a control. A policy attached to an OU applies to every account in that OU and in the OUs below it. A good tree therefore groups accounts by the controls they need, not by your org chart.
Some common patterns:
- Separate production and non-production, because they usually need different restrictions.
- Keep a dedicated OU for new or untrusted accounts, so you can apply strict rules first.
- Keep a small OU for testing a new policy before you attach it more widely.
The next chapters build on this tree. First you will enable the policy types, then attach policies and see how they flow down.
Exercise
An account sits in the Experiments OU, which is inside the Sandbox OU, which is under the root. How many parents does the account have, and which nodes could policies attached to the tree reach it from?
Show answer
The account has exactly one parent, the Experiments OU. Policies can reach it from its own attachment and from three ancestors: Experiments, Sandbox, and the root. Nodes in other branches, such as Production, have no effect on it.