Example of lambda logging behavior.
Use docker build
.
docker build -t example-lambda .
We use different accounts for ECR images and Lambda deployments for ease of image reuse across accounts. We use AWS profiles in conjunction with SSO to facilitate CLI usage across accounts.
Your setup will likely differ.
aws --profile lettuce-images ecr get-login-password \
| docker login -u AWS --password-stdin 607442316485.dkr.ecr.us-east-2.amazonaws.com
Use docker
to build
an image the expected name and push it to ECR.
docker build --platform linux/x86_64 -t 607442316485.dkr.ecr.us-east-2.amazonaws.com/example-lambda:latest .
docker push 607442316485.dkr.ecr.us-east-2.amazonaws.com/example-lambda:latest
Ensure that the Lambda function is using this image.
aws --profile lettuce-dev lambda update-function-code \
--function-name example \
--image-uri 607442316485.dkr.ecr.us-east-2.amazonaws.com/example-lambda:latest
aws --profile lettuce-dev lambda wait function-updated \
--function-name example