https://github.com/artemnikitin/lambda-code-example
Example of AWS Lambda's in Go
https://github.com/artemnikitin/lambda-code-example
aws aws-dynamodb aws-ec2 aws-lambda aws-sdk example-code example-project examples go golang lambda serverless
Last synced: 6 months ago
JSON representation
Example of AWS Lambda's in Go
- Host: GitHub
- URL: https://github.com/artemnikitin/lambda-code-example
- Owner: artemnikitin
- License: mit
- Created: 2019-01-24T13:51:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T11:38:50.000Z (over 2 years ago)
- Last Synced: 2025-01-08T01:27:01.711Z (over 1 year ago)
- Topics: aws, aws-dynamodb, aws-ec2, aws-lambda, aws-sdk, example-code, example-project, examples, go, golang, lambda, serverless
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# lambda-code-example
Examples of AWS Lambda code in Go
### Setup
You need to install Go 1.11 or higher.
On MacOS simply run `brew install go`. To install Go on other platforms check [official docs](https://golang.org/doc/install).
### Run tests
To run tests simply invoke `make`. It will run linters and unit tests.
### Run Lambda locally
1) Install [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli)
2) Run it:
via SAM CLI
```bash
make build
sam local generate-event dynamodb update | sam local invoke
```
or via make:
```bash
make run-local
```
### Deploy Lambda with Terraform
1) Install [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html)
2) Run it:
via command line
```bash
make build & terraform init & terraform apply -auto-approve
```
or via make:
```bash
make tf-deploy
```
### Deploy Lambda with AWS SAM CLI
1) Install [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli)
2) Run it:
via SAM CLI
```bash
make build
sam package \
--template-file template.yaml \
--output-template-file serverless-output.yaml \
--s3-bucket your-s3-bucket # put name of your S3 bucket here
sam deploy \
--template-file serverless-output.yaml \
--stack-name my-lambda-deployment \
--capabilities CAPABILITY_IAM
```
or via make:
```bash
make sam-deploy
```