This is sample ai infrastructure on AWS Lambda.
Check here
$ docker run --rm -v ~/projects/indi/lambda-docker-ai:/var/task:ro,delegated -p 9000:8080 public.ecr.aws/lambda/python:3.12 lambda_function.lambda_handler
$ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
docker run --rm -v ~/projects/indi/lambda-docker-ai:/var/task:ro,delegated -p 9000:8080 public.ecr.aws/lambda/python:3.12 lambda_function.lambda_handler
- Login ECR
$ ws ecr get-login-password --region <region-name> | docker login --username AWS --password-stdin xxxxxxxxxxxx.dkr.ecr.<region-name>.amazonaws.com
- Image build
$ docker build -t lambda-python:latest .
- Add tag
$ docker tag lambda-python:latest xxxxxxxxxxxx.dkr.ecr.<region-name>.amazonaws.com/lambda-python:latest
- Run docker container
$ docker push xxxxxxxxxxxx.dkr.ecr.<region-name>.amazonaws.com/lambda-python:latest
Attention: Create Lambda function -made by container image- before exec command.
$ aws lambda update-function-code --function-name <your-function-name> --image-uri <your-ecr-repository-url>/<image-name>:latest