Implementing CodePipeLine
This demonstration by Adrian Cantrill provides valuable insights into setting up a complete code pipeline for automating deployment. It includes the utilization of Docker, Amazon ECR, Amazon ECS, AWS CodePipeline, a load balancer, and Git.
At the beginning of the demonstration, it was discovered that CodeCommit was being decommissioned, so I had to switch to using Git instead.
Although using a different service, the same logic applied.
I established a local repository and a remote repository, connected them, and pushed various files, including a Dockerfile, an index.html file, and some images.
Subsequently, I set up an ECR registry to store the Docker image.
Ensuring that the IAM role attached to the CodeBuild project had the necessary permissions to access ECR was also part of the process.
While working on CodeBuild, I configured some environment variables to specify the location for storing the built docker image. Initially, the build failed a few times because I accidentally passed the ECR repo URL to the repository name environment variable. Once I corrected this mistake, I was pleased to see the build complete successfully.
This process involves retrieving information from files stored in my git repository, examining the YAML file for instructions, then locating the Dockerfile in the same directory to build the image. Finally, the docker image is stored in the specified ECR as an environment variable.
You can see the docker image pushed to ECR once Codebuild is complete.
I could jump into EC2 and run newly created docker image and confirm that it is working as expected.
Now, let's set up CodePipeline to integrate GitHub and CodeBuild, and we can include CodeDeploy at a later stage.
After confirming the presence of new images in ECR, I proceeded to establish a load balancer directed towards a target group, configuring ECS by defining services and tasks, and connecting it to the load balancer.
Subsequently, I included the deployment stage in the pipeline.
After making changes and pushing them to my git repository, I observed the updated reflected in the DNS of the load balancer.












Comments