In this step we will use the LazyStackSMF.ps1 script to create an AWS Organization, AWS Organizational Units, and AWS Tutorial System Accounts with CI/CD pipelines.
This step also creates AWS CLI Profiles for the AWS Accounts created in the Organization. These profiles allow the management workstation to perform administrative operations each of the AWS accounts in the organization.
..\LazyStackSMF\LzConfigure.ps1
You will be prompted for the following:
There is an occasional problem with setting the CodeBuild Personal Access Token for CodeBuild
projects during the creation of System accounts. This seems to be caused by some "timing" issue on
the AWS side of things. When LazyStack encounters this issue, it retries the ImportSourceCredentials
step. You might see the following under the
"- Updating AWS CodeBuild GitHub Credentials" step:
...
- Updating AWS CodeBuild GitHub Credentials
Retrying ImportSourceCredentials due to 'Payer ID' issue.
Retrying ImportSourceCredentials due to 'Payer ID' issue.
Retry Successful
...
We have written the script to be fault tolerant. If you get an error, you should receive a meaningful error message and the script will stop. You can then address the underlying issue and re-run the script, it will pick up where it left off. If you get an error when running the script, it is most likely going to be because of one of the following issues:
For more details on how this script works, visit the LazyStackSMF Script User Guide section.
LzConfigure.ps1 V1.0.0
Use this script to setup and manage your LazyStackSMF Organization
Creating new SMF settings file:
Please enter OrgCode: LzStk
Enter AWS CLI Managment Account (default: LzStkMgmt):
Enter AWS Region (us-east-1):
Enter your GitHub Management Acct Name: LzStkAdmin
Enter your GitHub Organization Name: LzStk
Tutorial Repo (default: https://github.com/LzStk/Petstore.git):
LazyStack Util Repo (default: https://github.com/LzStk/LazyStackSmfUtil.git):
OrgCode: LzStk
AWS Management Account: LzStkMgmt
Checking AWS Configuration
- No AWS Organization Found for the LzStkMgmt account.
- We need to create one to continue installation.
Create AWS Organization? (Y/n): y
- AWS Organization Created for the LzStkMgmt account.
- AWS OrgUnits
- Creating OrgUnit DevOU
- Creating OrgUnit TestOU
- Creating OrgUnit ProdOU
- Systems
- System: Tut (Tutorial System)
- Accounts
- Account: LzStkTutTest
Note: An email address can only be associated with one AWS Account.
Enter unique email for Test System Account: LzStkTutTest@LzStk.net
- Creating System Account: LzStkTutTest
- Checking for successful account creation. TryCount=1
- LzStkTutTest account creation successful. AccountId: 541943406928
- Moving LzStkTutTest account to Test Organizational Unit
- Adding or Updating LzStkTutTestAccessRole profile and associating it with the LzStkMgmt profile.
- Creating Administrators group in the LzStkTutTest account.
- Adding AdministratorAccess Policy to Administrators group
- Creating IAM User LzStkTutTestIAM in LzStkTutTest account.
- Writing the IAM User Credentials into LzStkTutTestIAM_credentials.txt
- Adding IAM User LzStkTutTestIAM to the LzStkTutTest Account Administrators group.
- Updating AWS CodeBuild GitHub Credentials
- Account: LzStkTutProd
Note: An email address can only be associated with one AWS Account.
Enter unique email for Prod System Account: LzStkTutProd@LzStk.net
- Creating System Account: LzStkTutProd
- Checking for successful account creation. TryCount=1
- LzStkTutProd account creation successful. AccountId: 630416782635
- Moving LzStkTutProd account to Prod Organizational Unit
- Adding or Updating LzStkTutProdAccessRole profile and associating it with the LzStkMgmt profile.
- Creating Administrators group in the LzStkTutProd account.
- Adding AdministratorAccess Policy to Administrators group
- Creating IAM User LzStkTutProdIAM in LzStkTutProd account.
- Writing the IAM User Credentials into LzStkTutProdIAM_credentials.txt
- Adding IAM User LzStkTutProdIAM to the LzStkTutProd Account Administrators group.
- Updating AWS CodeBuild GitHub Credentials
Deploy Pipelines? (Y/n):
PipeLine Deployments
- Pipeline: Test_PR_Create in Account Test
...
- Pipeline: Test_PR_Merge in Account Test
...
- Pipeline: Prod_PR_Merge in Account Prod
In this step we created our AWS Organization, AWS Organizational Units, and AWS Tutorial System Accounts with CI/CD pipelines.