From root to routine.
You have a pristine AWS account that is owned exclusively by you. This is not an AWS account that your enterprise provisioned for you. You can sign in as the root user and no other users exist.
-
Go to your Security credentials settings and add an MFA device to the root user.
Any account-local unique name is fine. We assume
mfa-rootfor this document. -
In the IAM console, create a new User.
Any account-local unique name is fine. We assume
igniterfor this document.
This user DOES NOT have AWS Management Console access.Attach policies directly, and select the AdministratorAccess policy.
-
Add an MFA device to the
igniteruser.Any account-local unique name is fine. We assume
mfa-igniterfor this document. -
Add an Access key to the
igniteruser.Use the Download .csv file button to grab the credentials. We assume the file is called
igniter_accessKeys.csv.Add the missing
User Namefield to the first line of the.csvfile, and add the user name on the second line in the same column.Import the credentials into a new AWS CLI v2 profile:
aws configure import --csv file://igniter_accessKeys.csv
Verify setup with
aws --profile igniter sts get-caller-identity -
Use
aws-mfa-auth.shto establish a temporary session.Verify setup with
aws --profile igniter-mfa sts get-caller-identity
Warning
Don't skip switching over to the MFA session. We will break the ability to operate in single-factor-authenticated sessions during further setup.
Deploy a new IaC state storage backend using iac-aws-bootstrap:
AWS_PROFILE=igniter-mfa AWS_REGION=eu-west-1 terraform apply
./display-backend.tf.sh > backend.tf-
If you haven't already, take note of the
idof theseedfor your backend:terraform output seed
-
Copy the
backend.tfto theterraformfolder in this workspace.
-
Deploy the configuration in the
terraformfolder.AWS_PROFILE=igniter-mfa AWS_REGION=eu-west-1 \ terraform init && \ terraform apply -var="github_owner=owner/repo" -
Prepare the handover to GitHub IaC management.
terraform output github
-
Create a new repository secret named
IAC_ARNand put thegithub.role_arninside the secret. -
Create a new repository secret named
IAC_SEEDand put theseed.idinside the secret.