Sub topic 12
Creating and enrolling accounts with Account Factory
This chapter assumes you have launched a landing zone, you know your OU layout, and you can sign in through IAM Identity Center. You should also be comfortable with AWS Organizations accounts, IAM roles, and the AWS CLI. Account Factory is the part of AWS Control Tower that creates new member accounts and brings existing ones under governance.
What Account Factory does
Account Factory is a standardized way to get an account that already meets your landing zone's rules. It does two jobs:
- Provision a brand-new AWS account inside a registered OU.
- Enroll an account that already exists in AWS Organizations, so that Control Tower governs it.
Both jobs end with the same result. The account sits in a registered OU, the OU's enabled controls apply to it, and AWS Config and CloudTrail are set up to send records to the Log Archive and Audit accounts. Access is granted through IAM Identity Center.
Account Factory is backed by AWS Service Catalog. The console shows a product called AWS Control Tower Account Factory, and each account you create is a provisioned product. That detail explains several behaviors later in the chapter, such as why failed provisions leave a record behind.
What a new account receives
When provisioning finishes, Control Tower has done the following for the account:
- Created the account in AWS Organizations and placed it in the OU you chose.
- Applied the preventive controls (service control policies) enabled on that OU.
- Enabled the detective controls (AWS Config rules) and proactive controls (CloudFormation hooks) for that OU.
- Enrolled the account in the organization trail and in AWS Config recording for each governed Region.
- Created the IAM roles that Control Tower needs to manage the account, such as
AWSControlTowerExecution. - Created the account's baseline resources through StackSets.
Control Tower also removes or adjusts some defaults. Which of these apply depends on your landing zone version, so check the current documentation for your version.
Account Factory inputs
Whether you use the console or Service Catalog, you provide the same core values.
| Input | Meaning | Notes |
|---|---|---|
| Account email | Root user email of the new account | Must be unique across all of AWS |
| Account name | Display name | Cannot be changed through Account Factory afterward |
| IAM Identity Center user email | Person who receives access | Must be a user in Identity Center, or Control Tower creates one |
| IAM Identity Center user name | Name for that user | Used when a new user is created |
| Organizational unit | Where the account is placed | Must be registered with Control Tower |
The account email is the input that causes the most failures. AWS requires a unique address for every account's root user. A common pattern is plus addressing on a mailbox you control, such as [email protected], or a distribution list per account. Choose a scheme before you create many accounts, because root email addresses are hard to change later.
Provisioning an account
The flow is the same each time you create an account:
- Open the Control Tower console and choose Account Factory, then Create account.
- Fill in the account details and choose the target OU.
- Choose Create account.
- Wait for the status to change from in progress to succeeded. This often takes 20 to 30 minutes, and you cannot start more than one provision at a time in the older console workflow.
You can check the result from the command line. Because Account Factory is Service Catalog underneath, you can list provisioned products. The same Organizations commands from earlier chapters show where the account landed.
aws servicecatalog search-provisioned-products \
--region us-east-1 \
--query "ProvisionedProducts[].{Name:Name,Status:Status,Type:Type}"
aws organizations list-accounts-for-parent \
--parent-id <ou-id>A status of AVAILABLE means the provision succeeded. A status of ERROR or TAINTED means it failed or an update did not complete.
Enrolling an existing account
Most organizations already have accounts before they adopt Control Tower. You can enroll them rather than rebuild them. The account must already be a member of the same AWS Organizations organization as the landing zone.
Enrollment has a few prerequisites. Skipping them is the usual reason it fails.
- Execution role. Control Tower needs a role named
AWSControlTowerExecutionin the account. It must trust the management account and carry administrator permissions. Without it, Control Tower cannot deploy baselines. - No conflicting AWS Config setup. An existing configuration recorder or delivery channel in a governed Region blocks enrollment. Remove or adjust them, then retry.
- Accessible Regions. The account must be able to operate in the home Region and the governed Regions.
- Target OU. The destination OU must be registered with Control Tower. You can enroll into it, but you cannot enroll into the root.
Here is a minimal trust policy for the execution role. Replace the placeholder with your management account ID.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<management-account-id>:root"
},
"Action": "sts:AssumeRole"
}
]
}You can create the role by running this from the account you are enrolling. Save the policy above as trust.json first.
aws iam create-role \
--role-name AWSControlTowerExecution \
--assume-role-policy-document file://trust.json
aws iam attach-role-policy \
--role-name AWSControlTowerExecution \
--policy-arn arn:aws:iam::aws:policy/AdministratorAccessAfter the role exists, move the account to a registered OU, or use the Enroll account action on an unregistered account in the Control Tower console. Control Tower then deploys the baseline and applies the OU controls.
Enrolling a whole OU
If an existing OU contains many accounts, you can register it as a unit. Control Tower then offers to enroll every account in it. Plan this carefully, because the OU's existing service control policies stay in place and combine with the new Control Tower controls. An SCP that denies actions Control Tower needs can make enrollment fail.
Provisioning programmatically
Console provisioning does not scale to many accounts. You have three common options.
- Service Catalog API. Call
ProvisionProductagainst the Account Factory product, passing the same inputs as parameters. - Account Factory for Terraform (AFT). A pipeline that creates accounts from Terraform files in a repository. A later chapter covers it.
- Control Tower APIs and CloudFormation. Newer workflows let you manage enrollment and controls through Control Tower's own APIs.
Use the Service Catalog route when you only need a small script and you want to avoid running extra infrastructure.
Changing and closing accounts
You manage an account's lifecycle through the same product.
- Update. You can change the OU or the Identity Center assignment by updating the provisioned product. Moving the account to another OU through Organizations directly causes drift, because Control Tower did not make the change. Use Control Tower or Service Catalog for the move.
- Unmanage. Removing the provisioned product stops Control Tower governance. Choose the unmanage action for the account, and decide whether to close it.
- Close. Closing an account is a separate Organizations action with its own limits on how many accounts you can close in a period. Do not treat it as an instant clean-up step.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Provision fails right away | Root email already used by another AWS account | Use a unique address |
| Enrollment fails on Config | Existing recorder or delivery channel in a governed Region | Delete or reconfigure it, then re-enroll |
| Enrollment cannot assume a role | `AWSControlTowerExecution` is missing or has the wrong trust | Create it with the trust policy shown above |
| Provisioning fails on an OU | OU is not registered, or an SCP blocks required actions | Register the OU, review SCPs |
| Account shows but has no sign-in access | User is not assigned in Identity Center | Check the permission set assignment |
| Account hits quota errors | Organization account limit reached | Request a quota increase |
Decision guide
Pick the approach by how often you create accounts and how much customization each needs.
- A few accounts per year, no custom baseline: the console is enough.
- Regular requests, small automation: Service Catalog or the Control Tower APIs from a script.
- Many accounts with per-account settings in version control: Account Factory for Terraform.
- Standard resources added to every account: Customizations for Control Tower.
Exercise
You try to enroll an existing account and the enrollment fails. The account is in the same organization, and the target OU is registered. Name two prerequisites you would check, and say what each one does.
Show answer
First, check that the AWSControlTowerExecution role exists in the account, trusts the management account, and has administrator permissions. Control Tower assumes it to deploy baselines. Second, check for an existing AWS Config configuration recorder or delivery channel in a governed Region. Control Tower needs to set up its own, and a pre-existing one blocks enrollment until you remove or adjust it.
Exercise
A colleague moves a Control Tower account to another OU using the Organizations console. What problem does this cause, and how should the move have been done?
Show answer
Control Tower did not make the change, so the account is out of line with its expected state and shows as drift, and the new OU's controls may not be applied correctly. The move should have been done through Control Tower, by updating the account's provisioned product in Account Factory (or Service Catalog) with the new OU.