7.2 Create ECR Image for Lambda Function
Preparation
For this section, your computer must have Docker and AWS CLI installed. You can refer to the Docker installation guide at Docker Installation and AWS CLI at AWS CLI Installation[1].
Steps to Implement
Go to the AWS Management Console and search for the Amazon ECR service by typing ECR.
In the Amazon ECR interface, select Create from the left menu.
In the repository creation interface, enter the following information:
- Repository name:
fashion-ecr-repository
- Then click Create to create the repository.
- Repository name:
In the interface of the newly created repository, select the repository and click View push commands to see the necessary commands for pushing a Docker Image to the repository.
In the code you cloned from git, navigate to the
lambda/kinesis-to-dynamo-db
directory and open a terminal there.Open Docker Desktop and execute the commands shown in the Push commands section of AWS ECR in your terminal.
- Note: If you are using Windows to build the Docker Image, you need to add the following to the
docker build
command to be compatible with the lambda function:--platform linux/amd64
and--provenance=false
- Example:
docker build -t fashion-ecr-repository . --platform linux/amd64 --provenance=false
- Note: If you are using Windows to build the Docker Image, you need to add the following to the
After completion, you will see the following:
In the ECR repository interface, you will see that the Docker Image has been successfully pushed.