Deploying AWS Accounts
This step-by-step process outlines how to deploy AWS accounts using Taskfile
workflows and ClickOps steps. This Automated Cold Start Implementation covers necessary preparations, such as configuring the AWS Organization, increasing account quotas, and verifying account configurations. The guide details the deployment processes and post-deployment configurations, including setting up account settings, enabling AWS RAM for Organizations, and performing certain manual configurations via ClickOps.
# | Steps | Actions |
---|---|---|
1 | Deploy AWS Organization | task workflow deploy/organization -f accounts |
2 | Prepare accounts creation | Click Ops |
3 | Deploy accounts | task workflow deploy/accounts -f accounts |
4 | Deploy accounts settings | task workflow deploy/account-settings -f accounts |
5 | Finalize account setup | Click Ops |
1 Prepare Account Deployment
Review the "account" configuration in the stack catalog. This is the hardest part to change/fix once the accounts are provisioned. If you aren't confident about the email configuration, account names, or anything else, now is the time to make changes or ask for help.
Terraform Infrastructure Automation for Enterprise Corporation
-
This guide outlines an End-to-end Terraform Infrastructure Automation framework designed for Enterprise Corporations (Security, Compliance, and Governance). The structure leverages Taskfiles and Terraform modules to enforce security, compliance, governance, and scalability while supporting compliance frameworks such as NIST, ISO 27001, and SOC 2.
-
The configuration targets the Core-Root Management Account for managing AWS Organizations and AWS IAM Identity Center (SSO), and Service Control Policies (SCP).
The end-to-end Terraform Infrastructure Automation for Enterprise Corporation (Security, Compliance, and Governance) should double-check the following:
- 1. AWS Management Account
- 2. Organizations, Identity-Center (SSO), and Service Control Policies (SCPs)
- Check that
groups.yml
andusers.yml
interraform-aws/account/management/identity-center-users-and-groups
has the values you expect, especially account email format
- Check that
- 3. Initialize Environment Variables (.env):
AWS_REGION=ap-southeast-2
AWS_PROFILE=core-root-admin
AWS_ACCOUNT_ID=1234567890
ENVIRONMENT=dev
STACK=management
BACKEND_BUCKET=terraform-state-backend
- Key Features
- Key Modules
- Directory Structure
Component | Purpose | Details |
---|---|---|
Core-Root Management Account | Centralized billing and governance for AWS Organization. | ➕ Create/manage AWS accounts. ➕ Set up SCPs. ➕ Manage centralized CloudTrail logs. |
AWS Organizations | Hierarchical account structure for enterprise governance. | ➕ Enforces guardrails using SCPs. ➕ Centralized management of accounts and policies. |
AWS IAM Identity Center (SSO) | Unified identity management across AWS accounts. | ➕ Enforces user and group-based access policies. ➕ Integration with SAML/IdP. |
Taskfiles with Terraform | Automated workflows for infrastructure as code (IaC). | ➕ Handles environment-specific provisioning. ➕ Simplifies CI/CD pipelines. |
Security & Compliance | Implements SCPs and IAM Policies for least privilege. | ➕ Continuous security scans with TFLint and Tfsec. ➕ Drift detection with Driftctl. |
Terraform Module | Description | URL |
---|---|---|
terraform-aws-organization | Manage AWS Organizations, Organizational Units (OUs), accounts, and policies. | AWS Organization Module |
terraform-aws-sso | Configure AWS IAM Identity Center (SSO) for identity federation and permission sets. | AWS SSO Module |
terraform-aws-scp | Manage Service Control Policies (SCPs) to enforce compliance across AWS accounts. | AWS SCP Module |
terraform-aws-iam | Manage IAM users, roles, policies, and permissions. | AWS IAM Module |
terraform-aws-config | Deploy AWS Config rules to audit and monitor compliance. | AWS Config Module |
terraform-aws-cloudtrail | Enable AWS CloudTrail for auditing and logging API activities. | AWS CloudTrail Module |
terraform-aws-securityhub | Integrate AWS Security Hub for continuous monitoring and automated security checks. | AWS Security Hub Module |
TODO: Directory Structure HERE ...
2 Deploy the AWS Organization:
- Commands
- Taskfile Workflow
deploy/organization
workflow in the examples/snippets/stacks/workflows/accounts.yaml
file:- No commands found
task workflow deploy/organization -f accounts
3 Configure Root Account as Organization
Before performing the "Deploy Accounts" step, the root account needs to be configured as an AWS Organization.
This process also enables AWS RAM for Organizations via a CLI command, which is required for connecting the Organization.
4 Raise Account Limits
To deploy all accounts, we need to request an increase of the Account Quota from AWS support, which requires an AWS Organization to be created first.
From the root
account (not super-admin-user
), increase the account quota to 20+ for the DevOps Accelerator reference architecture, or more depending on your business use-case
5 Deploy Accounts
With the addition of support for dynamic Terraform roles, our baseline
cold start refarch layer now depends
on/requires that we have aws-teams
and aws-team-roles
stacks configured. This is because account-map
uses those
stacks to determine which IAM role to assume when performing Terraform in the account, and almost every other component
uses account-map
(indirectly) to chose the role to assume. However, these components do not need to be deployed yet.
Again verify the "account" configuration in stacks/catalog/account.yaml
. In the next step, we will create and configure all accounts in the AWS Organization using the configuration in that stack file.
Once confident, begin the accounts deployment:
- Commands
- Taskfile Workflow
deploy/accounts
workflow in the examples/snippets/stacks/workflows/accounts.yaml
file:- No commands found
task workflow deploy/accounts -f accounts
These deployments will create all AWS member accounts and store relevant account metadata as "mappings" in the Terraform
outputs of the account-map
component. Rather than querying this account
component each time we need an Account ID or
role, we provision a static component account-map
.
Always run task terraform apply account-map -s core-gbl-root
after provisioning accounts.
Once you've created the accounts, you'll need to provision the baseline configuration within the accounts themselves. Run the following:
- Commands
- Taskfile Workflow
deploy/account-settings
workflow in the examples/snippets/stacks/workflows/accounts.yaml
file:- No commands found
task workflow deploy/account-settings -f accounts
The workflows will kick off several sequential Terraform runs to provision all the AWS member account settings for member accounts in the Organization.
6 ClickOps to Complete Account Setup
For each new account, you will need to perform some manual configurations via ClickOps. These configurations include setting up the root account credentials, enabling MFA, and unsubscribing the account's email address from all marketing emails.
-
Reset the root user password:
-
Perform a password reset by attempting to log in to the AWS console as a "root user" using that account's email address
-
Click the "Forgot password?" link
-
You will receive a password reset link via email, which should be forwarded to the shared Slack channel for automated messages. Click the link
-
Enter a new password
Tip:Use 1Password to create a password 26-38 characters long, including at least 3 of each class of character: lower case, uppercase, digit, and symbol
-
Save the email address and generated password as web login credentials in 1Password
-
Finally, record the account number in a separate field of the 1Password item, and save it. This is optional but recommended.
-
-
Configure MFA:
- Log in to the AWS console using the new password
- Choose "My Security Credentials" from the account dropdown menu
- Set up Multi-Factor Authentication (MFA) to use a Virtual MFA device
- Save the MFA TOTP key in 1Password with 1Password's "One-Time Password" field
- Enter the generated MFA codes in AWS to verify the MFA device
- Save the Virtual MFA ARN in the same 1Password entry. We will need this to set up the MFA device for
super-admin-user
in Leapp
-
Enable any necessary optional regions
-
Optional, but highly recommended - unsubscribe the account's email address from all marketing emails
- Go to AWS Marketing Preferences
- Click "Unsubscribe from Email"
- Enter the account's email address
- Check "Unsubscribe from all AWS marketing emails"
For more details, review the detailed "AWS Cold Start" documentation.