Skip to content

aws-samples/aws-cdk-stack-builder-tool

AWS CDK Builder

Release Notes License: MIT

🔥 Try AWS CDK Builder 🔥

sample

Table of content

Features

AWS CDK Builder is a browser-based tool designed to streamline bootstrapping of Infrastructure as Code (IaC) projects using the AWS Cloud Development Kit (CDK). Equipped with a dynamic visual designer and instant TypeScript code generation capabilities, the CDK Builder simplifies the construction and deployment of CDK projects. It stands as a resource for all CDK users, providing a platform to explore a broad array of CDK constructs.

sample sample

Deploy

You do not need to deploy the AWS CDK Builder to use it; an online version is available.

https://aws-samples.github.io/aws-cdk-stack-builder-tool

But if you wish to deploy it on your own account, here is a step-by-step guide.

Environment setup

Deploy with AWS Cloud9

We recommend deploying with AWS Cloud9. If you'd like to use Cloud9 to deploy the solution, you will need the following before proceeding:

  • use Amazon Linux 2023 as the platform.

Local deployment

If you have decided not to use AWS Cloud9, verify that your environment satisfies the following prerequisites:

You have:

  1. An AWS account
  2. AdministratorAccess policy granted to your AWS account (for production, we recommend restricting access as needed)
  3. Both console and programmatic access
  4. NodeJS 18 installed
    • If you are using nvm you can run the following before proceeding
    • nvm install 18 && nvm use 18
      
  5. AWS CLI installed and configured to use with your AWS account
  6. Typescript 3.8+ installed
  7. AWS CDK CLI installed
  8. Docker installed
  9. Python 3+ installed

Deployment

  1. Clone the repository
git clone https://github.com/aws-samples/aws-cdk-stack-builder-tool
  1. Move into the cloned repository
cd aws-cdk-stack-builder-tool

3. Install the project dependencies by running this command

npm install
  1. (Optional) Bootstrap AWS CDK on the target account and region

Note: This is required if you have never used AWS CDK on this account and region combination. (More information on CDK bootstrapping).

npx cdk bootstrap aws://{targetAccountId}/{targetRegion}

You can now deploy by running:

npx cdk deploy

You can view the progress of your CDK deployment in the CloudFormation console in the selected region.

  1. Once deployed, take note of the DomainName
...
Outputs:
cdk-builder.DomainName = https://dxxxxxxxxxxxxx.cloudfront.net
...
  1. Open the DomainName Url for the outputs above, i.e. https://dxxxxxxxxxxxxx.cloudfront.net

Clean up

You can remove the stacks and all the associated resources created in your AWS account by running the following command:

npx cdk destroy

Architecture

AWS CDK Builder is a serverless static website application, created using React and TypeScript.

sample

Adding private constructs

If there are constructs which are not in the public npm js registry, they can be added as follows:

  1. Download the npm package:
npm pack <your-package> --pack-destination ./src/react-app/public/constructs
  1. Modify a blueprint to use the newly added package. For example, to change the Blank blueprint:
open ./src/react-app/src/blueprints/cdk-blank.ts
  1. Modify libs: { as follows:
libs: {
  "@aws-cdk/aws-amplify-alpha": "2.x",
  ...
  "@aws-cdk/region-info": "2.x",
  "my-cool-lib-1.2.3.tgz": "local" // <-- This is the line to add, use filename as found in ./src/react-app/src/public/constructs as the key, and "local" as the value
},

Now when a project is created using the modified blueprint, it will have access to the private constructs.

License

This library is licensed under the MIT-0 License. See the LICENSE file.