This tutorial will walk you through how to use the “Starting a CodeBuild project” feature.
We will assume you have:
We are going to perform the following steps to “Starting a CodeBuild project”:
Here are the steps you need to follow to “Starting a CodeBuild project”
Log into the account where you installed service catalog puppet and navigate to the AWS CodeBuild console in the region where you installed service catalog puppet.
Create a new project named ping-host
. It should have three environmental variables named:
TARGET_ACCOUNT_ID
TARGET_REGION
HOST_TO_PING
For the build spec you should have the following command:
echo "I have been asked to ping ${HOST_TO_PING} from ${TARGET_REGION} of ${TARGET_ACCOUNT_ID}"
Add the following snippet to your manifest file:
If you already had a code-build-runs please append the ping-host declaration to the existing code-build-runs section.
You will most likely need to update the tag from role:all to whatever you are using in your environment.
The parameters section supports all capabilities that launches supports. You can read more in the “Using parameters in the real world” section under the “Design considerations” heading.
You told service catalog puppet to get a list of all regions for all accounts with the tag you specified. For each item in the list you told service catalog puppet to run a codebuild project. If you have 2 regions and 4 accounts the codebuild project will be triggered 8 times. The codebuild projects will run in serial to avoid hitting service or api throttling limits.
To verify the codebuild runs you can use the codebuild console. Look at the history for the ping-host project and verify the number of runs was correct. For each run you can verify the environmental variables that were overridden.
You have now successfully run a codebuild project!