AWS Lambda Use Docker (ECR)
ECR
- get-login-password
aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com
aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin 420798909600.dkr.ecr.ap-southeast-1.amazonaws.com
aws_account_id go to Iamv2 Page
- Create a repository
aws ecr create-repository --repository-name hello-world --image-scanning-configuration scanOnPush=true --region ap-southeast-1
- To tag and push an image to Amazon ECR
docker tag hello-world:latest 420798909600.dkr.ecr.ap-southeast-1.amazonaws.com/hello-world:latest
docker push 420798909600.dkr.ecr.ap-southeast-1.amazonaws.com/hello-world:latest
參考文獻
- 使用 Python 建置 Lambda 函數
- Deploy Python Lambda functions with container images
- Creating Lambda container images
- Using Amazon ECR with the AWS CLI