Account Factory - provision AWS Accounts
Tags: governance, security, aws
Published: 2021-03-04 14:09:31

---
title: Account Factory - provision AWS Accounts
published: true
date: 2021-03-04 11:00:00 UTC
tags: 
- governance
- security
- aws
canonical_url: https://globaldatanet.com/blog/account-factory-provision-aws-accounts
---

Best Practice for creating AWS Accounts

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yd8w767j3cbwmg2o27cx.png)


</br>

## What is an Account Factory?

The Account Factory is a solution to manage account creation and bootstrapping in a scalable and efficient manner so that new accounts are created with a defined baseline and governance guardrails are in place. If you want to get your hands dirty with an Account Factory - you can take a look at this [workshop](https://controltower.aws-management.tools/core/accountfactory/).

## Why should I use a Account Factory?

1. ⚙️ Equivalent process for every account

2. 💸 Save time and resources

3. 🔐 Secure and well-architected accounts

4. 📜 Documented process

5. 🔌 Native integration to your ticket system like [Jira](https://support.atlassian.com/jira-service-management-cloud/docs/connect-jira-service-management-cloud-to-aws-service-catalog/) - [ServiceNow](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/config-sn.html); this means that internal approval processes can be used to trigger the Account provisioning

6. 🚀 Ready to use accounts in minutes

## What solutions are outside for account provisioning?

If you use the Control Tower for your Landing Zone it's coming already with an [Account Factory](https://docs.aws.amazon.com/controltower/latest/userguide/account-factory.html) - there's also already existent solutions to [customize](https://aws.amazon.com/de/solutions/implementations/customizations-for-aws-control-tower/) the Account Factory to your needs. Even if you use the official landing zone solution there are some examples of [Account vending machines](https://github.com/aws-samples/aws-account-vending-machine) on github.


## What steps are part of an account factory?

1. Creation of a new AWS Account - the first part of the Account Factory is to provision a new Account, the solution is using the [organizations API](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreateAccount.html) for that.  
💡 Activate [IamUserAccessToBilling](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreateAccount.html#organizations-CreateAccount-request-IamUserAccessToBilling) - othwerwise only the root user of the new account can access account billing information.

</br>

2. Deploy the baseline template to new AWS Accounts - regardless of whether you want to provide resources via API / CDK, StackSets or CodePipeline, you need a role that you can assume in the new account, so we need an AccountBaseline that includes a role with trust for the management or automation account.

</br>

3. Remove default VPC - A default VPC is suitable for getting started quickly - not for production workloads. 

</br>

4. Deploy security baseline and other customized ressources - this step includes eg.: the activation of GuardDuty, Config, CloudTrail - if you dont use the [Organizational Trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-trail-organization.html), creation of own VPC, security notification service etc.
You can use StackSets or CodePipeline for that. It would make sense to separate the configuration which stacks /resources  you want to activate  from the actual Account Factory. 
💡 You can for example use SSM Parameter Store for that - You could also think of using different configs for services , which are deployed in to new accounts or not depending on the selection in the Account Factory. 

</br>

5. Optional: 
    - Use support case API to activate enterprise Account in the new Account.
    - Activate root MFA automatically.

</br>

6. Move new Account to desired organizional unit. According to best practices, it is recommend to structure your accounts in an organization and assign scps to organizational units. Since SCPs can cause problems when providing a new account, I recommend to move the new accounts at the end of the Account Factory to the corresponding unit.  

</br>

7. Send status mail or slack / teams message. In order to get a status overview of the new Account,  you should think of collecting information while the Account Factory is running and send them as a message to the new Account owner or governance at scale team. 

![Account Factory Example Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9q3jcj31b98hc72dm2b1.png)