https://github.com/cludden/tf-lambda-api-gateway-example
example of using terraform to deploy a lambda function behind an api gateway
https://github.com/cludden/tf-lambda-api-gateway-example
Last synced: 9 months ago
JSON representation
example of using terraform to deploy a lambda function behind an api gateway
- Host: GitHub
- URL: https://github.com/cludden/tf-lambda-api-gateway-example
- Owner: cludden
- License: mit
- Created: 2017-09-28T22:13:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T19:38:11.000Z (almost 3 years ago)
- Last Synced: 2025-02-28T21:32:25.622Z (10 months ago)
- Language: JavaScript
- Size: 1.69 MB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# tf-lambda-api-gateway-example
example of using `terraform` to deploy a `node.js` lambda function behind an `AWS API Gateway`
## Installing
Prereqs:
- node v8+
```shell
# clone this repository
$ git clone https://github.com/cludden/tf-lambda-api-gateway.git
# install dependencies
$ cd tf-lambda-api-gateway && npm install
```
## Testing
Prereqs:
- node v8+
```shell
# run the test suite
$ npm run test
```
## Building
*Note: this project uses features from from Node 8, and as such requires a build step*
Prereqs:
- node v8+
```shell
# run webpack which runs transpilation/minification and generates an
# artifact for each lambda function in the ./dist directory
$ npm run build
```
## Deploying
Prereqs:
- Terraform v0.12+
- AWS account with high degree of privileges and credentials available in the environment
```shell
# change into the terraform directory
$ cd terraform
# create a new terraform environment
$ terraform env new dev
# install any missing plugins
$ terraform init
# run a plan
$ terraform plan -var env=dev
...
Plan: 13 to add, 0 to change, 0 to destroy.
# apply
$ terraform apply -var env=dev
...
Apply complete! Resources: 13 added, 0 changed, 0 destroyed.
Outputs:
url = https://.execute-api.us-west-2.amazonaws.com/example_lambda_dev
# destroy when finished
$ terraform destroy -var env=dev
```
*Note: it can take a few minutes before the integrations become active*
## License
Copyright (c) 2017 Chris Ludden
Licensed under the [MIT License](LICENSE.md)