Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unit2795/localstack-terraform-aws-lambda
A simple example of hot-reloading lambda functions with LocalStack and local Terraform deploys
https://github.com/unit2795/localstack-terraform-aws-lambda
aws aws-lambda cdktf development example hcl hot-module-replacement hot-reload javascript live-reload local localstack rest-api terraform terraform-cdk tutorial typescript
Last synced: 4 days ago
JSON representation
A simple example of hot-reloading lambda functions with LocalStack and local Terraform deploys
- Host: GitHub
- URL: https://github.com/unit2795/localstack-terraform-aws-lambda
- Owner: Unit2795
- Created: 2023-05-26T02:37:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-22T02:00:43.000Z (over 1 year ago)
- Last Synced: 2025-01-22T18:14:03.106Z (4 days ago)
- Topics: aws, aws-lambda, cdktf, development, example, hcl, hot-module-replacement, hot-reload, javascript, live-reload, local, localstack, rest-api, terraform, terraform-cdk, tutorial, typescript
- Language: TypeScript
- Homepage:
- Size: 67.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LocalStack & Terraform REST API
This is an example that uses [Terraform](https://developer.hashicorp.com/terraform) and [LocalStack](https://localstack.cloud/) to spin up a local [hot-reloading](https://docs.localstack.cloud/user-guide/tools/lambda-tools/hot-reloading/) Node.js [AWS Lambda](https://aws.amazon.com/lambda/) and [API Gateway](https://aws.amazon.com/api-gateway/) development environment. The features used in this guide require you to have [LocalStack Pro](https://localstack.cloud/pricing/). There is a trial membership available. Develop rapidly for the cloud without the associated costs, slow feedback, and risk of actual deployments. LocalStack also works with Pulumi, AWS CloudFormation/CDK, SAM, and more.
**In this guide we will:**
1. [Set up LocalStack Pro](./docs/initial-setup.md)
2. Deploy resources to LocalStack using one of the following IaC providers:
1. [Terraform HCL](./docs/iac/terraform-hcl.md) `.tf`
2. [Terraform CDK (CDKTF)](./docs/iac/terraform-cdk.md) `.ts`3. [Query your local REST API](./docs/query-your-api.md)
## Key Files/Directories
- π /cdktf
- Terraform CDK code used to create and manage AWS resources
- π /docs
- Markdown documentation about the project
- π /lambda
- Very simple lambda function that returns a JSON object `{ message: 'Hello World' }` and `200` http status code
- π.env.example
- File that contains LocalStack Pro key, copy this to a `.env` file
- πmain.tf
- Primary Terraform HCL file used to create and manage AWS resources## Why do I need to have LocalStack Pro?
Some functionality like [UpdateIntegration](https://docs.localstack.cloud/references/coverage/coverage_apigatewayv2/#updateintegration) for API Gateway is not currently available for the community edition of LocalStack. It's possible to force the recreation of the API Gateway integration and get around this, but Pro includes a lot of other handy features, such as the [Resource Browser](https://docs.localstack.cloud/user-guide/web-application/resource-browser/) which is a web interface for browsing your LocalStack AWS resources.
----
If this example was helpful to you or you have questions, drop me a line at [[email protected]](mailto:[email protected]). Contributions are welcome!