diff --git a/1.txt b/1.txt new file mode 100644 index 0000000..d05869e --- /dev/null +++ b/1.txt @@ -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 +``` \ No newline at end of file diff --git a/README.md b/README.md index 0adf462..d111f95 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..07c94ce --- /dev/null +++ b/build.gradle @@ -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" + } +} diff --git a/clean-up.sh b/clean-up.sh new file mode 100755 index 0000000..a72e804 --- /dev/null +++ b/clean-up.sh @@ -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"; diff --git a/deploy-all.sh b/deploy-all.sh new file mode 100755 index 0000000..343f2e5 --- /dev/null +++ b/deploy-all.sh @@ -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