Automate account creation by using the Landing Zone Accelerator on AWS
Created by Justin Kuskowski (AWS), Joe Behrens (AWS), and Nathan Scott (AWS)
Summary
This pattern explains how to use the Landing Zone Accelerator on AWS
Optionally, you can integrate Microsoft Entra ID groups and assign AWS IAM Identity Center permission sets during the account creation process. If your organization is using Microsoft Entra ID as an identity source, this optional feature helps you automatically manage and configure access to the new account.
Prerequisites and limitations
Prerequisites
Access to the management account in AWS Organizations
AWS Cloud Development Kit (AWS CDK) version 2.118.0 or later, installed and configured
Python version 3.9 or later, installed
AWS Command Line Interface (AWS CLI) version 2.13.19 or later, installed
Docker version 24.0.6 or later, installed
Landing Zone Accelerator on AWS solution, deployed in the management account
(Optional) Microsoft Entra ID and IAM Identity Center, integrated
Limitations
The account creation workflow supports sequential executions to deploy a single AWS account. This limitation makes sure that the account creation workflow has successfully completed without having to compete for resources during a parallel run.
Architecture
Target architecture
The following image shows the high-level architecture of automating creation of a new AWS account by using the Landing Zone Accelerator on AWS. AWS Step Functions orchestrates the automation. Each task in the Step Functions workflow is performed by one or more AWS Lambda functions.

The diagram shows the following workflow:
The user requests an account by either running a Python script or by using Amazon API Gateway.
The Account Creation Orchestrator workflow starts in AWS Step Functions.
The workflow updates the
account-config.yaml
file in the source code repository. It also initiates the Landing Zone Accelerator on AWS pipeline and checks the status of the pipeline. This pipeline creates and sets up the new account. For more information about how this works, see the Architecture overview for the Landing Zone Accelerator on AWS.(Optional) When the pipeline is complete, the workflow checks whether the group exists in Microsoft Entra ID. If the group doesn’t exist in Microsoft Entra ID, the workflow adds the group to Microsoft Entra ID.
The workflow performs additional steps that the Landing Zone Accelerator on AWS solution can't do. The default steps include:
Creating an account alias in AWS Identity and Access Management (IAM)
Attaching tags to the account in AWS Organizations
Creating parameters in AWS Systems Manager Parameter Store based on the tags assigned to the account
(Optional) The workflow assigns one or more permission sets to the Microsoft Entra ID group that you previously specified. The permission sets allow users in the group to access the new account and allow them to perform the actions you configure.
An AWS Lambda function runs QA and validation tests. It validates resource creation, checks that tags have been created, and validates that security resources have been deployed.
The workflow releases the account and uses Amazon Simple Email Service (Amazon SES) to notify the user that the process has completed successfully.
For more information about the Step Functions workflow, see Step Functions workflow diagram in the Additional information section of this pattern.
Microsoft Entra ID applications
If you choose to integrate with Microsoft Entra ID, you create the following two applications when you deploy this pattern:
An application that is linked to IAM Identity Center and makes sure that Microsoft Entra ID groups are available in IAM Identity Center. In this example, this Microsoft Entra ID application is named
LZA2
.An application that allows a Lambda function to communicate with Microsoft Entra ID and call the Microsoft Graph APIs
. In this pattern, this application is named create_aws_account
.
These applications collect data that is used to sync the Microsoft Entra ID group and assign permission sets.
Tools
AWS services
Amazon API Gateway helps you create, publish, maintain, monitor, and secure REST, HTTP, and WebSocket APIs at any scale. In this pattern, you use API Gateway to check the availability of AWS account names, initiate the AWS Step Functions workflow, and check the status of the Step Functions execution.
AWS Cloud Development Kit (AWS CDK) is a software development framework that helps you define and provision AWS Cloud infrastructure in code.
AWS Control Tower helps you set up and govern an AWS multi-account environment, following prescriptive best practices.
Amazon EventBridge is a serverless event bus service that helps you connect your applications with real-time data from a variety of sources. For example, AWS Lambda functions, HTTP invocation endpoints using API destinations, or event buses in other AWS accounts. This solution uses an EventBridge rule that starts a Lambda function if the Step Functions workflow state changes to
Failed
,Timed-out
, orAborted
.AWS Identity and Access Management (IAM) helps you securely manage access to your AWS resources by controlling who is authenticated and authorized to use them.
AWS IAM Identity Center helps you centrally manage single sign-on (SSO) access to all of your AWS accounts and cloud applications.
AWS Key Management Service (AWS KMS) helps you create and control cryptographic keys to help protect your data. In this pattern, AWS KMS keys are used to encrypt data, such as data stored in Amazon Simple Storage Service (Amazon S3), Lambda environment variables, and data in Step Functions.
AWS Lambda is a compute service that helps you run code without needing to provision or manage servers. It runs your code only when needed and scales automatically, so you pay only for the compute time that you use.
AWS Organizations is an account management service that helps you consolidate multiple AWS accounts into an organization that you create and centrally manage.
Amazon Simple Email Service (Amazon SES) helps you send and receive emails by using your own email addresses and domains. After a new account is successfully created, you receive a notification through Amazon SES.
Amazon Simple Notification Service (Amazon SNS) helps you coordinate and manage the exchange of messages between publishers and clients, including web servers and email addresses. If an error occurs during the account creation process, Amazon SNS sends a notification to the email addresses that you configure.
AWS Step Functions is a serverless orchestration service that helps you combine AWS Lambda functions and other AWS services to build business-critical applications.
AWS Systems Manager Parameter Store provides secure, hierarchical storage for configuration data management and secrets management.
Other tools
awscurl
automates the process of signing AWS API requests and helps you make requests as a standard curl command. Microsoft Entra ID
, formerly known as Azure Active Directory, is a cloud-based identity and access management service. Microsoft Graph APIs
help you access data and intelligence in Microsoft cloud services, such as Microsoft Entra and Microsoft 365.
Code repository
The code for this pattern is available in the GitHub lza-account-creation-workflow
The lambda_layer
account_creation_helper
– This layer includes the modules for assuming roles and checking the progress in AWS Service Catalog. boto3
– This layer includes the AWS SDK for Python (Boto3) module to make sure that AWS Lambda has the latest version. identity_center_helper
– This layer supports calls to IAM Identity Center.
The lambda_src
AccountTagToSsmParameter
– This function uses the tags attached to the account in AWS Organizations in order to create parameters in Parameter Store. Each parameter starts with an /account/tags/
prefix.AttachPermissionSet
– This function adds a permission set to an IAM Identity Center group. AzureADGroupSync
– This function syncs the target Microsoft Entra ID group to IAM Identity Center. CheckForRunningProcesses
– This function checks whether the AWSAccelerator-Pipeline
pipeline is currently running. If the pipeline is running, the function delays the AWS Step Functions workflow.CreateAccount
– This function uses AWS Service Catalog and AWS Control Tower to create the new AWS account. CreateAdditionalResources
– This function creates the AWS resources that aren't managed by Landing Zone Accelerator or AWS CloudFormation, such as the account alias and AWS Service Catalog tags. GetAccountStatus
– This function scans for the provisioned product in AWS Service Catalog to determine if the account creation process has completed. GetExecutionStatus
– This function retrieves the status of a running or completed AWS Step Functions execution. NameAvailability
– This function checks if an AWS account name already exists in AWS Organizations. ReturnResponse
– If the account creation was successful, this function returns the ID of the new account. If the account creation was not successful, it returns an error message. RunStepFunction
– This function runs the AWS Step Functions workflow that creates the account. SendEmailWithSES
– This function sends emails to the users who are waiting for the account creation to finish. ValidateADGroupSyncToSSO
– This function checks if the specified Microsoft Entra ID groups are synced with IAM Identity Center. ValidateResources
– This function validates that all AWS Control Tower customizations have run successfully.
Best practices
We recommend the following naming conventions for the AWS CDK:
Start all parameters with a
p
prefix.Start all conditions with a
c
prefix.Start all resources with an
r
prefix.Start all outputs with an
o
prefix.
Epics
Task | Description | Skills required |
---|---|---|
Prepare the Landing Zone Accelerator on AWS for customization. |
| AWS DevOps |
Prepare to deploy the | Now, you customize the solution to deploy the
| AWS DevOps |
Prepare to deploy the | Now, you customize the solution to deploy the
| AWS DevOps |
Prepare to deploy the | Now, you customize the solution to deploy the
| AWS DevOps |
Task | Description | Skills required |
---|---|---|
Create the application that that allows a Lambda function to communicate with Microsoft Entra ID. |
| Microsoft Entra ID |
Retrieve values for the | Now, you retrieve the values that you need for the
| Microsoft Entra ID |
Create the application that integrates Microsoft Entra ID with IAM Identity Center. | In the Microsoft Entra ID admin center, register the | Microsoft Entra ID |
Retrieve values for the | Now, you retrieve the values that you need for the
| Microsoft Entra ID |
Create a secret. |
| AWS DevOps |
Task | Description | Skills required |
---|---|---|
Clone the source code. |
| DevOps engineer |
Update the |
| AWS DevOps |
Deploy the solution in your AWS environment. |
NoteThis solution uses an Amazon S3 bucket to store the source code for this solution. You can use the upload_to_source_bucket.py | AWS DevOps |
Task | Description | Skills required |
---|---|---|
Identify which arguments to use. | Choose which arguments to use when you run the Python script that initiates the Step Functions workflow. For a complete list of arguments, see the Additional information section of this pattern. | AWS DevOps, Python |
Start the Python script. |
| DevOps engineer, Python |
Task | Description | Skills required |
---|---|---|
Set up the variables for awscurl. |
| AWS DevOps |
Check name availability. | Enter the following command to verify that the name is available for the AWS account. Replace
| AWS DevOps |
Run the account creation workflow. |
| AWS DevOps |
Task | Description | Skills required |
---|---|---|
Remove objects from the Amazon S3 buckets. | Remove any objects in the following Amazon S3 buckets:
| AWS DevOps |
Delete the CloudFormation stack. | Enter the following command to delete the CloudFormation stack:
| AWS DevOps |
Delete the pipeline. | Enter the following command to delete the
| AWS DevOps |
Related resources
Landing Zone Accelerator on AWS
(AWS Solutions Library) Troubleshooting common AWS CDK issues (AWS CDK documentation)
Additional information
Step Functions workflow diagram
The following image shows the states in the Step Functions workflow.

Arguments
The following are the arguments that you can use when you run the Python script that initiates the Step Functions workflow.
The following arguments are required:
account-name (-a)
(string) – The name of the new AWS account.support-dl (-s)
(string) – The email address that receives notification when the account creation process is complete.managed-org-unit (-m)
(string) – The managed organizational unit (OU) that will contain the new account.
The following arguments are optional:
ad-integration (-ad)
(string dictionary) – The Microsoft Entra ID group and assigned permission set. The following is an example of how to use this argument:--ad-integration "{\"<PermissionSetName>\": \"<EntraIdGroupName>\"}"
account-email (-e)
(string) – The email address for the root user of the new AWS account.Note
If this argument isn't used, an email address will be generated by using the values
rootEmailPrefix
androotEmailDomain
from theconfigs/deploy-config.yaml
file. If an email address isn't provided, an email address is generated by using the following format:rootEmailPrefix+accountName@rootEmailDomain
.region (-r)
(string) – The AWS Region where the Step Functions workflow was deployed. The default value isus-east-1
.force-update (-f)
(string Boolean) – Entertrue
to force AWS Service Catalog to update the provisioned product.bypass-creation (-b)
(string Boolean) – Entertrue
to bypass adding the account to theaccounts-config.yaml
file and bypass running theAWSAccelerator-Pipeline
pipeline. This argument is typically used to test the account creation workflow process or to run the rest of the Step Functions steps if an error occurs in theLanding Zone Accelerator
pipeline.tags (-t)
(string) – Additional tags that you want to add to the AWS account. By default, the following tags are added:account-name
,support-dl
, andpurpose
. The following is an example of how to use this argument:--tags TEST1=VALUE1 TEST2=VALUE2