Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
.
  • Loading branch information
engel80 authored Jul 26, 2022
1 parent 456e2b7 commit 30b4971
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 7 deletions.
36 changes: 36 additions & 0 deletions 1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
```text
├── app
│   └── hello.js
├── build.gradle
├── clean-up.sh
├── deploy-all.sh
├── device-api
│   ├── bin
│   │   └── index.ts
│   ├── cdk.json
│   ├── config.ts
│   ├── jest.config.js
│   └── lib
│   └── device-api-stack.ts
├── package-lock.json
├── package.json
├── product-api
│   ├── bin
│   │   └── index.ts
│   ├── cdk.json
│   ├── config.ts
│   ├── jest.config.js
│   └── lib
│   └── product-api-stack.ts
├── root-api
│   ├── bin
│   │   └── index.ts
│   ├── cdk.json
│   ├── config.ts
│   ├── jest.config.js
│   └── lib
│   └── root-api-stack.ts
├── screenshots
│   └── apigw.png
└── tsconfig.json
```
65 changes: 58 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ Use the `cdk` command-line toolkit to interact with your project:

| Stack | Time |
|-------------------------------|---------|
| root-api (24kb) | 1m 30s |
| device-api (24kb) | 1m 30s |
| product-api (20kb) | 1m 30s |
| root-api (24kb) | 1m 30s |
| device-api (24kb) | 1m 30s |
| product-api (20kb) | 1m 30s |
| Total | 4m 30s |

## Steps

Use the [deploy-all.sh](./deploy-all.sh) file if you want to deploy all stacks without prompt at a time.

### Step 1: root-api

Create the Root API and dummy method to import from device-api and product-api.
Create the root API and dummy method to import from device-api and product-api stacks.

```bash
cd root-api
Expand Down Expand Up @@ -75,7 +79,54 @@ SSM parameter:
* /cdk-lambda-apigateway/rest-api-id
* /cdk-lambda-apigateway/root-resource-id

### Reference
## Clean Up

[clean-up.sh](./clean-up.sh)

## Structure

```text
├── app
│   └── hello.js
├── build.gradle
├── clean-up.sh
├── deploy-all.sh
├── device-api
│   ├── bin
│   │   └── index.ts
│   ├── cdk.json
│   ├── config.ts
│   ├── jest.config.js
│   └── lib
│   └── device-api-stack.ts
├── package-lock.json
├── package.json
├── product-api
│   ├── bin
│   │   └── index.ts
│   ├── cdk.json
│   ├── config.ts
│   ├── jest.config.js
│   └── lib
│   └── product-api-stack.ts
├── root-api
│   ├── bin
│   │   └── index.ts
│   ├── cdk.json
│   ├── config.ts
│   ├── jest.config.js
│   └── lib
│   └── root-api-stack.ts
├── screenshots
│   └── apigw.png
└── tsconfig.json
```
## Reference

* [CloudFormation quotas](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html)
* Template body size: 512k
* Template body size in an Amazon S3: 1M

### CDK Lib

* Template body size: 512k
* Template body size in an Amazon S3: 1M
* [API Gateway](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway-readme.html)
25 changes: 25 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apply plugin: 'base'
apply plugin: 'org.sonarqube'
archivesBaseName = 'cdk-lambda-apigateway'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5")
}
}

sonarqube {
properties {
property "sonar.projectName", "cdk-lambda-apigateway"
property "sonar.projectKey", "cdk-lambda-apigateway"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.sources", "."
property "sonar.exclusions", "**/node_modules/**"
property "sonar.cpd.exclusions", "**/*index.ts"
property "sonar.links.ci", "https://github.com/engel80/cdk-lambda-apigateway"
property "sonar.log.level", "DEBUG"
}
}
17 changes: 17 additions & 0 deletions clean-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

find . -name "cdk.out" -exec rm -rf {} \;
find . -name "cdk.context.json" -exec rm -f {} \;

echo "destroy product-api"
cd product-api
cdk destroy

echo "destroy device-api"
cd ../device-api
cdk destroy

echo "destroy root-api"
cd ../root-api
cdk destroy

rm -rf "node_modules";
13 changes: 13 additions & 0 deletions deploy-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
find . -name "cdk.context.json" -exec rm -f {} \;

echo "Deploy root-api"
cd ./root-api
cdk deploy --require-approval never

echo "Deploy device-api"
cd ../device-api
cdk deploy --require-approval never

echo "Deploy product-api"
cd ../product-api
cdk deploy --require-approval never

0 comments on commit 30b4971

Please sign in to comment.