CloudKitect Patterns - v2.121.0

CloudKitect Patterns

This is the documentation of CloudKitect Patterns provided by CloudKitect Inc.

This project is an invaluable resource for startups and small-to-medium businesses (SMBs) poised to embark on a journey of application modernization to the cloud. CloudKitect Patterns provide expertly crafted architectures to accelerate your cloud migration, taking you from conception to full cloud integration in a matter of days instead of months. With CloudKitect Patterns, you're equipped to establish a fully compliant, cloud-native infrastructure using just a few lines of code. We have taken care of all the non-functional requirements so that you can focus on the functional requirements of your applications. For an indepth review of what non-functional requirements CloudKitect patterns provide please review our blog post https://cloudkitect.com/the-power-of-cloudkitect-revolutionizing-cloud-infrastructure-provisioning/

OnBoarding Process

In order to access CloudKitect Patterns customer need to be onboarded. For on-boarding customers provide their AWS account ID to be added to CloudKitect managed AWS Code Artifactory. If you would like to be on-boarded in order to use CloudKitect please email info@cloudkitect.com

Local Environment Configuration

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

Edit .npmrc file to add the following entry

registry=https://cloudkitect-ACCOUNT_ID.d.codeartifact.us-east-1.amazonaws.com/npm/cloudkitect-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 CloudKitect managed AWS Code Artifactory

aws codeartifact login --tool npm --domain cloudkitect --domain-owner CLOUDKITECT_AWS_ACCOUNT_ID --repository --profile npmregistry cloudkitect-artifacts --region us-east-1

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 CloudKitect Patterns dependency

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

{
"dependencies": {
"@cloudkitect/patterns": "CURRENT_VERSION"
}
}

Install Dependencies

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

npm install

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 CloudKitect codeartifact as its repository source.

DotNet

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

Python

aws codeartifact login --tool pip --domain cloudkitect --domain-owner 175815161984 --repository cloudkitect-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 cloudkitect --domain-owner 175815161984 --repository cloudkitect-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

Using Well Architected CDK Patterns

Now that you have all the patterns available from CloudKitect, use them just like any other CDK construct

For example the below code snippet is used to build a secure and compliant serverless API infrastructure.

import {RestApi} from "aws-cdk-lib/aws-apigateway";

new CpRestApi(this, "MyApis", {
cpDomainName: "example.com",
cpSubDomain: "test-api"
})

CloudKitect Patterns 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.

How to set up CICD pipeline for management account

This class is used to setup the management account and the organizational structure based on the best practice recommendations. Before using CpOrganizationalSetup the following steps need to be performed.

  • Create an AWS account, which will be used as management account.
  • Create admin user and admin group
  • Create access keys for admin user
  • Configure your local environment for using access keys by running the following command.
    • aws configure --profile management
  • Login to AWS console using admin user
  • Create and download git credentials
  • Allow access to code artifact domain and on the artifact in CloudKitect Repo for the management account
  • Create code commit repo in management account to hold management account source code.
  • Clone the repo to your local environment and configure to push code
  • Create SNS test topic to create kms keys in management account
  • Create pipeline project for setting up pipeline in management account. This pipeline will be used to deploy the management account setup stack
  • Botstrap management account for cdk
    • cdk bootstrap --profile management
  • Deploy management account setup pipeline
    • cdk deploy --profile management
  • This will be the only time you need to deploy from your local environment
  • Add the stage to the pipeline with the management account setup stack
  • Commit your code
  • Pipeline should detect the new commit and start the deployment of management account setup stack

Generated using TypeDoc