Well Architected CDK - v2.69.0

Well Architected CDK

This package contains Well Architected CDK constructs. In order to access Well Architected CDK customer need to be onboarded. For on-boarding customer provides their AWS account ID to be added to CRE8IVELOGIX managed AWS Code Artifactory If you would like to be on-boarded in order to use Well Architected CDK please email info@cre8ivelogix.com

Local Environment Configuration

After on-boarding customer will update npm config file to use CRE8IVELOGIX managed AWS Code Artifactory as their npm registry

Edit .npmrc file to add the following entry

registry=https://cre8ivelogix-ACCOUNT_ID.d.codeartifact.us-east-1.amazonaws.com/npm/cre8ivelogix-artifacts/

Configure AWS CLI

Then AWS cli needs to be configured with credentials for the customer AWS Account used for on-boarding

aws configure --profile npmregistry

Login to Code Artifactory

Then use the following command to login to CRE8IVELOGIX managed AWS Code Artifactory

aws codeartifact login --tool npm --domain cre8ivelogix --domain-owner ACCOUNT_ID --repository wa-cdk-artifacts --profile npmregistry

Create a CDK project

Once the login is successful, you can create a new CDK project by running the following commands

cdk init app --language typescript

This will create a bare bone CDK project.

Adding WA-CDK dependency

Open CDK project in your favorite IDE and goto package.json file to add the WA-CDK dependency

{
"dependencies": {
"@cre8ivelogix/wa-cdk": "CURRENT_VERSION"
}
}

Install Dependencies

Once package.json file is updated, you can install the dependencies by running the following commands

npm install

Using Well Architected CDK constructs

Now that you have all the constructs available from Well Architected CDK, use them just like any other CDK construct

For example the below code snippet we are using WaBucket that extends the Bucket construct provided by AWS CDK

import {WaBucket} from "./wa-bucket";

new WaBucket(this, "MyBucket", {})

Building Java/.Net/Python/Javascript Distribution

Make sure you have the following installed locally

  • Java version 8 install
  • Maven installed
  • DotNet 6.0 or later installed
  • Python3 installed
  • pip3 installed
  • pip symlinked to pip3

You can also use docker superchain if it has all the required packages, current version is on older .NetCore (3.1)

docker run -it --rm --entrypoint sh -v $(pwd)/wa-cdk:/wa-cdk jsii/superchain:1-buster-slim-node16

Run JSII Build

npm run jsii-build

Build Packages for all languages

In order to build packages each language has a different configuration setup to use cre8ivelogic codeartifact as its repository source.

DotNet

aws codeartifact login --tool dotnet --domain cre8ivelogix --domain-owner 175815161984 --repository cre8ivelogix-artifacts --region us-east-1  —profile repo

Python

aws codeartifact login --tool pip --domain cre8ivelogix --domain-owner 175815161984 --repository cre8ivelogix-artifacts --region us-east-1 --profile repo

Java

Currently, there is no way to configure Maven to talk to codeartifact, logged a bug with JSII packmak project

Typescript and Javascript

aws codeartifact login --tool npm --domain cre8ivelogix --domain-owner 175815161984 --repository cre8ivelogix-artifacts --region us-east-1 --profile repo

After all the logins are successful you can run the following command to create packages.

npm run package

Release Java JSII Packages

Run the following script, once the packages are build in dist folder, update the version in the script

./publish-java.sh

Release Nuget JSII Packages

Run the following script, once the packages are build in dist folder, update the version in the script

./publish-nuget.sh

Release Python JSII Packages

Run the following script, once the packages are build in dist folder, update the version in the script

./publish-pypi.sh

Release NPM JSII Packages

./publish-js.sh

For some reason the following script did not work for NPM, i had to put in AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN and AWS_ACCESS_KEY_ID and then ran the

npx publib-npm

Well Architected CDK Version Updates

The version of all CDK packages are fixed to the same version. If an upgrade is desired, please make sure that all CDK packages are upgraded to the same version at the same time. Different versions of CDK mixed in the project may cause type incompatibilities.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests

Generated using TypeDoc