https://github.com/sano307/lambda-container-demo
How to manage Lambda Container and Amazon ECR on Terraform.
https://github.com/sano307/lambda-container-demo
amazon-ecr aws aws-lambda container terraform
Last synced: 2 months ago
JSON representation
How to manage Lambda Container and Amazon ECR on Terraform.
- Host: GitHub
- URL: https://github.com/sano307/lambda-container-demo
- Owner: sano307
- License: mit
- Created: 2021-04-12T00:57:39.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-16T13:46:37.000Z (almost 5 years ago)
- Last Synced: 2025-06-17T15:06:39.956Z (about 1 year ago)
- Topics: amazon-ecr, aws, aws-lambda, container, terraform
- Language: HCL
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lambda-container-demo
How to manage Lambda Container and Amazon ECR on Terraform.
## Requirements
- Terraform 0.14.9
- Python 3.8.8
- pipenv
## Environment
- macOS (Catalina)
## Usage
First of all, change the Amazon ECR repository name.
```diff
// main.tf
- ecr_repository_name = "sano307/lambda-container-python"
+ ecr_repository_name = "YOUR_ECR_REPOSITORY_NAME"
```
And then, Check the necessary infra resources and deploy to AWS cloud.
```sh
$ terraform init
$ terraform plan
$ terraform apply
```
Try to invoke an AWS Lambda using AWS CLI.
```sh
$ aws lambda invoke --function-name lambda-container response.json && cat response.json
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}
{"statusCode": 200, "body": "{\"message\": \"This is a container lambda.\"}"}
$ aws lambda invoke \
--function-name lambda-container out \
--log-type Tail \
--query 'LogResult' \
--output text | base64 -d
START RequestId: 5926d73f-d4c4-46ba-88cf-7cbeed6a4cb7 Version: $LATEST
id value
0 1 foo
1 2 boo
END RequestId: 5926d73f-d4c4-46ba-88cf-7cbeed6a4cb7
REPORT RequestId: 5926d73f-d4c4-46ba-88cf-7cbeed6a4cb7 Duration: 47.52 ms Billed Duration: 48 ms Memory Size: 128 MB Max Memory Used: 109 MB
```
## Local testing
TBD
## Author
Inseo Kim
## License
MIT