How do I use container images with Lambda?
I want to create AWS Lambda container images with dependencies. How do I do that?
"I want to create AWS Lambda container images with dependencies. How do I do that?ResolutionVerify that you have permissions configured for the IAM user or role that creates the Lambda container images. Then, follow these steps to use Docker to deploy your container images:1.    Go to the Get Docker webpage. Choose the Docker Desktop application that meets your requirements. Follow the directions provided to install Docker Desktop.Note: Docker is a third-party website.2.    On your local machine, create one folder with three files: Dockerfile, requirements.txt with libraries, and app.py with import statements. Note: Use the latest version of Python for Amazon Elastic Container Registry (Amazon ECR) public registry.This example Dockerfile uses Python 3.8:FROM public.ecr.aws/lambda/python:3.8# Copy function codeCOPY app.py ${LAMBDA_TASK_ROOT}# Install the function's dependencies using file requirements.txt# from your project folder.COPY requirements.txt .RUN pip3 install -r requirements.txt —target "${LAMBDA_TASK_ROOT}"# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)CMD [ "app.handler" ]This example app.py file includes an example import statement:import sysdef handler(event, context):    return 'Hello from AWS Lambda using Python' + sys.version + '!'3.    Build your Docker image with the docker build command and an image name.This is a docker build command with a “hello-world” example:docker build -t hello-world .4.    Start the Docker image with the docker run command.This is a docker run command with a “hello-world” example:docker run -p 9000:8080 hello-world5.    Test your application by using the Lambda Runtime Interface Emulator (RIE). From a new terminal window, post an event to the following endpoint using a curl command:curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'This command invokes the function running in the container image and then returns a response.6.    Authenticate the Docker CLI to your Amazon ECR registry. Change the account ID and the AWS Region in the command to make sure that it meets your requirements.This is an example of authenticating the Docker CLI to the Amazon ECR registry:aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com7.    Create a repository in Amazon ECR using the create-repository command.This is an example create-repository command:aws ecr create-repository --repository-name hello-world --image-scanning-configuration scanOnPush=true --image-tag-mutability MUTABLE8.    Tag your image to match your repository name using the docker tag command. Then, deploy the image to Amazon ECR using the docker push command.Change the account ID and the AWS Region in these commands to ensure that they meet your requirements.This is an example docker tag command:docker tag hello-world:latest 123456789012.dkr.ecr.us-east-1.amazonaws.com/hello-world:latestThis is an example docker push command:docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com/hello-world:latest9.    With your container image in the Amazon ECR container registry, create and run a Lambda function. For more information, see Creating the function.Follow"