In this section, you will create and setup a build project in AWS CodeBuild.
AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.
With CodeBuild, you don’t need to provision, manage, and scale your own build servers
In the AWS Management Console search bar, type and select CodeBuild. Double check that you are using CodeBuild in the same AWS Region that you have used in the previous steps.
Click on Create build project.
In the Project configuration section, enter MyDemoBuild as the Project name and leave the rest as defaults in this section.
REPO_NAME=isc22-container
aws ecr describe-repositories --query repositories[].[repositoryName,repositoryUri] --region $AWS_REGION | grep "/${REPO_NAME}"
In the Buildspec section, select Use a buildspec file option. By default CodeBuild looks for a file named buildspec.yml in the source code root directory. Since we named our buildspec file as buildspec.yml and put it in the root directory of the CodeCommit repo, you can skip providing a name or absolute path
Keep the defaults in Batch configuration and Artifacts section.
In the Logs section enable the CloudWatch logs. This option will upload the build output logs to CloudWatch
Click on Create build project
aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess --role-name codebuild-MyDemoBuild-service-role
When executing the above if you run into an error as shown below, it means you have not disabled AWS managed temporary credentials in Cloud9 as covered in the Preparation section of the Lab. Kindly fix that and re-do the above step.
In the next section, you will build a CodePipeline which you will use to automate your container build process