boilerplate-lambda-container/containers/hello-deno/GUIDE.md

1.1 KiB

Guide

Deploy Lambda Container Image

Create the ECR (Elastic Container Registry) repository and authenticate docker to it.

export AWS_REGION=us-west-1
export AWS_PROFILE=playground
aws configure sso --profile $AWS_PROFILE
aws ecr create-repository --repository-name hello-world --region $AWS_REGION --profile $AWS_PROFILE
export REPOSITORY_URI=$(aws ecr describe-repositories --repository-names hello-world --region $AWS_REGION --profile $AWS_PROFILE | jq -r '.repositories[0].repositoryUri')
aws ecr get-login-password --region $AWS_REGION --profile $AWS_PROFILE | docker login --username AWS --password-stdin $REPOSITORY_URI

Build the docker image and push it to the ECR repository.

docker build -t hello-world .
docker tag hello-world:latest $REPOSITORY_URI:latest
docker push $REPOSITORY_URI:latest

Testing

Test the container image locally.

docker run -p 8000:8000 hello-world:latest

Check it in another terminal tab.

curl http://localhost:8000
docker stop $(docker ps -q)

Cleanup the repo.

aws ecr delete-repository --repository-name hello-world --region $AWS_REGION --profile $AWS_PROFILE --force