Skip to main content
Welcome back. This lesson reviews the current project status and recaps what we’ve completed so far. The focus is on how CodeBuild, CodeCommit, and Amazon ECR fit together in our CI workflow, how the Docker image is produced and validated, and the commands you can reuse to reproduce or debug the flow. We have completed the following:
  • Set up AWS CodeBuild and integrated it with AWS CodeCommit for automated builds.
  • Configured CodeBuild to use a buildspec.yml file to produce Docker images during the build lifecycle.
  • Pushed the resulting Docker image into Amazon ECR (Elastic Container Registry).
  • Validated the Docker image by running it on an EC2 instance.
  • Learned how to authenticate locally to ECR so developers can pull and test images on their machines.
The image shows a project architecture status diagram with components including AWS CodeBuild, AWS CodeCommit, and a Registry, along with key tasks completed such as setting up ECR and testing Docker images.
What to remember
  • CodeBuild reads the buildspec.yml in your repository root (or a path you specify in the CodeBuild project). It executes the standard phases: install, pre_build, build, and post_build. Make sure buildspec.yml is in the intended location and correctly formatted YAML.
  • The Docker image produced during the build must be tagged for your ECR repository and pushed using authenticated Docker commands. Typical steps are to obtain ECR auth token, log in Docker, tag the image, and push.
  • To validate images on EC2, authenticate the instance to ECR the same way you authenticate locally, then docker pull the image and run it with docker run.
Quick reference: common commands and snippets
  • Authenticate Docker to ECR (Linux/macOS):
  • Tag and push the image:
  • Pull and run on EC2 (after authenticating on the instance):
  • Minimal buildspec.yml example (used by CodeBuild to build and push a Docker image):
Checklist: where to find things and why they matter
Do not commit credentials, tokens, or long-lived secrets into your repository. Use IAM roles (for CodeBuild and EC2) or secrets managers to provide secure access to ECR and other resources.
Summary of completed tasks: ECR setup, CodeBuild project creation and integration with CodeCommit, buildspec.yml-driven Docker builds, pushing images to ECR, and validating images from both EC2 and local development environments.
Further reading and references That’s it for this lesson — see you in the next one.

Watch Video