Sub topic 2
AWS Organizations, OUs and SCPs in Brief
This chapter covers the working model of AWS Organizations: the management account, member accounts, the root, organizational units (OUs), and service control policies (SCPs). Control Tower builds on all of these, so you need to know where each one starts and stops before you launch a landing zone.
Assumed prerequisites: you know what an AWS account, an IAM user, an IAM role and an IAM policy are. You can run AWS CLI commands and sign in to the console.
The working model
AWS Organizations is a service that lets you manage many AWS accounts as one unit. It gives you four things:
- A hierarchy for grouping accounts.
- Policies that apply to groups of accounts.
- Consolidated billing, so one payer account pays for all the others.
- Integration with other AWS services, which can be enabled for the whole organization.
The main pieces are:
| Piece | What it is |
|---|---|
| Organization | The whole structure. It has exactly one management account. |
| Management account | The account that created the organization. It pays the bills and manages the structure. |
| Member account | Any other account in the organization. |
| Root | The top container of the hierarchy. It is not the same as the root user of an account. |
| Organizational unit (OU) | A container for accounts and other OUs. OUs can nest. |
| Policy | A document attached to the root, an OU or an account. |
The word "root" appears twice in AWS with different meanings. The organization root is the top of the tree. The account root user is the identity that owns a single account. Keep them apart in your head.
Each account sits in exactly one place in the tree: directly under the root or inside one OU. You can move accounts between OUs. A policy attached to a node applies to everything below it.
Inspecting an organization from the CLI
The management account can list the structure. You need the root ID first, then the OUs under it.
aws organizations describe-organization
aws organizations list-roots
aws organizations list-organizational-units-for-parent \
--parent-id <root-id>
aws organizations list-accounts-for-parent \
--parent-id <ou-id>Identifiers follow patterns you will see often:
- Root IDs look like
r-ab12. - OU IDs look like
ou-ab12-cdef5678, which combines the root ID and a random suffix. - Account IDs are 12 digits.
Control Tower operations use the OU's ARN, not just its ID. An OU ARN has the form arn:aws:organizations::<management-account-id>:ou/<organization-id>/<ou-id>. When a later chapter asks for <ou-arn>, build it from these parts or read it from describe-organizational-unit.
Policy types
Organizations supports several policy types. Only some are relevant to a landing zone.
| Policy type | Purpose |
|---|---|
| Service control policies (SCPs) | Set the maximum permissions available to accounts. |
| Resource control policies (RCPs) | Set the maximum permissions on resources in accounts. |
| Tag policies | Standardize tag keys and values. |
| Backup policies | Apply AWS Backup plans across accounts. |
| AI services opt-out policies | Control whether AWS AI services may store your content. |
Control Tower's preventive controls are implemented as SCPs, so SCPs are the type that matters most here. Policy types must be enabled on the root before you can attach them.
Service control policies
An SCP is a policy that defines the maximum permissions for the IAM users and roles in the accounts it affects. This is the most common misunderstanding about SCPs, so read the next point twice.
An SCP never grants permissions. It only limits what identity-based policies can grant. For an action to be allowed, both of these must be true:
- An SCP allows it at every level between the root and the account.
- An identity-based or resource-based policy in the account also allows it.
If either layer is missing, the request is denied.
Deny lists and allow lists
By default, every new organization has an AWS-managed policy named FullAWSAccess attached to the root, every OU and every account. It allows all actions. That is why a new organization works as you expect.
There are two strategies for restricting access:
- Deny list. Keep
FullAWSAccessin place and add SCPs with explicitDenystatements. This is the approach Control Tower uses, and it is simpler to maintain. - Allow list. Remove
FullAWSAccessand attach SCPs that allow only specific services. This is stricter, but every new service you want to use must be added by hand.
Here is a deny-list SCP that blocks leaving the organization and prevents disabling CloudTrail:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyLeavingOrganization",
"Effect": "Deny",
"Action": "organizations:LeaveOrganization",
"Resource": "*"
},
{
"Sid": "DenyStoppingTrails",
"Effect": "Deny",
"Action": [
"cloudtrail:StopLogging",
"cloudtrail:DeleteTrail"
],
"Resource": "*"
}
]
}How SCPs inherit
SCPs flow down the tree. An account's effective permissions are the intersection of the SCPs at the root, each OU on the path, and the account itself. Adding a deny at a higher level cannot be undone by an allow lower down.
Say the root has FullAWSAccess, the Workloads OU has a deny on ec2:* outside two Regions, and the Dev OU has FullAWSAccess only. A Dev account is still limited by the Workloads OU deny. The Dev OU cannot widen what its parent has narrowed.
What SCPs do not affect
Knowing the limits prevents false confidence. SCPs do not apply to:
- The management account. No SCP restricts it, which is why you keep workloads out of it.
- Service-linked roles.
- Actions performed by AWS itself on your behalf in some cases, such as certain AWS-managed operations.
- Anything outside the organization, such as requests from principals in other accounts to your resources (resource control policies cover that).
Also, SCPs restrict principals in member accounts, including the account's root user. This makes them useful for blocking risky actions even by a user who signs in as the root user of a member account.
Common errors
- Assuming an SCP grants access. Attaching an SCP that allows
s3:*does nothing if no IAM policy in the account allows it. - Detaching
FullAWSAccesswithout a replacement. Every action in the affected accounts is then denied, and you can lock out all users in them. Always attach the replacement allow first, then detach. - Putting workloads in the management account. SCPs cannot protect it, and a compromise there reaches the entire organization.
- Mixing up the two roots. The organization root is a container. The account root user is an identity.
- Moving accounts without checking policies. When an account moves to another OU, it takes on that OU's SCPs immediately. Workloads can stop working.
- Editing Control Tower SCPs directly. Control Tower creates and manages its own policies. Changes you make outside Control Tower cause drift, which a later chapter covers.
- Hitting policy limits. An SCP document is limited in size (5,120 characters), and each root, OU or account can have a limited number of SCPs attached. Long policies may need splitting or condensing.
How this connects to Control Tower
Control Tower does not replace Organizations. It uses it. When you launch a landing zone, Control Tower works in your organization, or creates one if you do not have one yet. It creates OUs, creates the shared accounts, and attaches SCPs to OUs as you enable controls. The OU you choose for a control is the OU whose accounts that control then governs.
This is why OU design matters. SCPs and controls attach to OUs, and every account inherits from its parents. A flat, well-named structure that groups accounts by security need makes controls easier to reason about than one grouped by team.
Exercise
An organization has the FullAWSAccess SCP on the root, an SCP on the Workloads OU that denies all actions outside us-east-1 and eu-west-1, and an SCP on the child Dev OU that explicitly allows ec2:* in every Region. A developer in a Dev account has an IAM policy allowing ec2:RunInstances everywhere. Can the developer launch an instance in ap-southeast-2? Explain.
Show answer
No. SCPs combine as an intersection, and the Workloads OU deny applies to every account beneath it. The allow on the Dev OU cannot override a deny from a parent, and an SCP never grants permissions on its own. The IAM policy also cannot get around the SCP, because both layers must allow the action.
Exercise
Why is it a bad idea to run application workloads in the management account of an organization?
Show answer
SCPs do not apply to the management account, so you cannot use them to restrict what runs there. A compromise or mistake in that account can also affect the whole organization, because it controls the structure, policies and billing.