https://github.com/localstack-samples/lambda-ddb
Example APIGW Lambda DynamoDB solution with integration test
https://github.com/localstack-samples/lambda-ddb
Last synced: 8 months ago
JSON representation
Example APIGW Lambda DynamoDB solution with integration test
- Host: GitHub
- URL: https://github.com/localstack-samples/lambda-ddb
- Owner: localstack-samples
- License: other
- Created: 2024-01-06T21:50:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-01T13:11:46.000Z (almost 2 years ago)
- Last Synced: 2025-02-17T14:44:43.755Z (11 months ago)
- Language: TypeScript
- Size: 1.48 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lambda DynamoDB APIGW solution with integration test

# Overview
- IaC in AWS CDK
- DevOps tooling and makefile configuration
- Solution deploys to LocalStack and includes an integration test
- Solution deploys to AWS using the same IaC
## LocalStack Requirements
- LocalStack Pro subscription
# Deploy to LocalStack
## Deploy with AWS CDK to LocalStack
### Bootstrap AWS CDK Stacks on LocalStack
You need to do this once.
```shell
make local-awscdk-bootstrap
```
### Deploy App Stack on LocalStack
This will deploy the resources.
```shell
make local-awscdk-deploy
```
### Curl APIGW Url
```shell
make local-awscdk-invoke
```
### Run test
This will run the integration test asserting the Lambda AppConfig and DynamoDB integrations work.
```shell
make local-awscdk-test
```
## Deploy and Test in Integration Environment
To deploy and test in an integration environment, change all of the `local-` commands above to `integ-`.
### Cleanup and restart LocalStack
```shell
make local-awscdk-clean restart-ls
```
# Deploy to AWS
We use the same IaC pipelines to deploy to AWS! This is a very important point that LocalStack enables teams
to test their IaC pipelines locally before ever deploying them to a live AWS environment.
Do this from your host machine. Not inside the GDC.
Install AWS `cdk`
```shell
npm install -g aws-cdk
```
## Set Live AWS Credentials
However you set your credentials in your terminal, do it now.
### Deploy the AWS CDK IaC App Stack
Bootstrap the account. Only need to do this once per account/region.
```shell
make sbx-awscdk-bootstrap
```
This will deploy the resources.
```shell
make sbx-awscdk-deploy
```
### Invoke the Lambda in AWS
```shell
make sbx-awscdk-invoke
```
### Destroy the CDK Stack in AWS
```shell
make sbx-awscdk-destroy
```