In this post, I want to share how I build CI/CD system that Bibucket Pipeline can build and deploy Lambda Container Image in AWS.
The architecture of this post:
Step 1: Create a repository at Elastic Container Registry
I set it as private repository, Linux Operating systems, Architecture x86
After create the ECR repository, we can see the image URI and the push command to know how we upload our container to ECR.
The push commands:
Step 2: Push a container from your local machine to ECR.
Currently, I use sample python lambda docker from https://github.com/lambci/docker-lambda.git
Step 5: Add bitbucket-pipelines.yml file to the projects to run pipeline and push it to Bitbucket Pipeline
We need to fill some information from AWS to bitbucket-pipelines.yml like IMAGE_NAME, FUNCTION_NAME, the link in "docker login"
Step 7: Run the pipeline in Bitbucket and wait for the pipeline completes build Lambda container images, push to ECR and Update Lambda Image URI.
Step 8: Check the image we pushed in ECR from Bitbucket pipeline, check the Lambda's Image URI with the name convention: TAG=$BITBUCKET_BUILD_NUMBER-$BITBUCKET_BRANCH-$BITBUCKET_TAG
In my case, the BITBUCKET_BUILD_NUMBER = 2 and run in master branch with empty BITBUCKET_TAG
That's all of what I want to share in this post.
Please let me know if you have other questions!