Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuanyu90221/golang_hello_lambda
https://github.com/yuanyu90221/golang_hello_lambda
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/yuanyu90221/golang_hello_lambda
- Owner: yuanyu90221
- Created: 2023-04-11T10:01:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-11T17:38:57.000Z (over 1 year ago)
- Last Synced: 2024-04-21T13:59:56.744Z (9 months ago)
- Language: Makefile
- Size: 4.65 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# test for golang_lambda with localstack
## prerequest
1. run up a localstack
2. pip install awslocal## usage
```makefile
PWD=$(shell pwd)
build:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main main.gozip_file: build
zip main.zip maincreate_lambda: zip_file
awslocal lambda create-function \
--function-name hello_v1 \
--runtime go1.x \
--zip-file fileb://${PWD}/main.zip \
--handler main \
--role arn:aws:iam::000000000000:role/lambda-role \
--region=us-east-1invoke:
awslocal lambda invoke --function-name hello_v1 --endpoint http://localhost:4566 --region=us-east-1 result.txt
getfunction:
awslocal lambda get-function --function-name hello_v1 --endpoint-url=http://localhost:4566 --region=us-east-1
delfunction:
awslocal lambda delete-function --function-name hello_v1 --endpoint-url=http://localhost:4566 --region=us-east-1
```