ws-cdk-deployer

0.0.7 • Public • Published

Workshop studio cdk app deployer

This tool aim to ease the deployment of CDK app for Wokshop studio accounts provisionning.

Prerequesite

  1. To have a Workshop repo created and clone from https://studio.us-east-1.prod.workshops.aws/workshops
  2. An AWS CDK app folder part of a git repository (it can be the same as the workshop, but only committed file will be added to the deployable zip)
  3. An instance of the CDK Deployer (https://constructs.dev/packages/aws-analytics-reference-architecture/v/2.5.0/api/CdkDeployer?lang=typescript)
  4. node installed

What it does ?

  1. Compress CDK app into a zip file
  2. Upload CDK app into the right bucket
  3. Generate CDK deployer CFN template (with proper buildspec)
  4. Populate workshop studio content spec
  5. Push changes to git

Usage

Add the CDKDeployer stack to your CDK app

  • TypeScript example bin/myCdkApp.ts
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { MyCdkAppStack } from '../lib/my_cdk_app-stack';
import { CdkDeployer, DeploymentType } from 'aws-analytics-reference-architecture';

const app = new cdk.App();
const stackName = 'MyCdkAppStack';
new MyCdkAppStack(app, stackName, {});

new CdkDeployer(app, {
  deploymentType: DeploymentType.WORKSHOP_STUDIO,
  deployBuildSpec: BuildSpec.fromSourceFilename('buildspec-deploy.yml'),
  destroyBuildSpec: BuildSpec.fromSourceFilename('buildspec-destroy.yml'),
  cdkParameters: {
    queueName: {
      type: 'String',
      default: 'my-queue',
    },
  }
});
  • Python example app.py
#!/usr/bin/env python3
import os

import aws_cdk as cdk

from als_ara.als_ara_stack import AlsAraStack
import aws_analytics_reference_architecture as ara

app = cdk.App()
stackName = 'AlsAraStack'
AlsAraStack(app, stackName,)

ara.CdkDeployer( app,
    deployment_type=ara.DeploymentType.WORKSHOP_STUDIO,
    stack_name=stackName,
)

app.synth()

For more details about the CDKDeployer API, check https://constructs.dev/packages/aws-analytics-reference-architecture/v/2.5.0/api/CdkDeployer?lang=typescript

Set your workshop through the CLI

npx ws-cdk-deployer <WORKSHOP_ID> --cdk-project-path ./myCdkApp --workshop-repo-path ./

Help

npx ws-cdk-deployer --help

Usage: bin [options] <workshopId>

A simple tool to make your CDK app works in Workshop studio. 
 
 Prerequisite : Export AWS credentials from Workshop studio page !

Arguments:
  workshopId                          Workshop ID available in "Workshop details"
                                      of your workshop
                                      (https://studio.us-east-1.prod.workshops.aws/workshops)

Options:
  -p, --cdk-project-path <string>     Path to the cdk app (default: "./")
  -ws, --workshop-repo-path <string>  Path to the workshop repo (default: "./")
  -st, --skip-templates               add this flag to skip template update and
                                      only update cdk app (default: false)
  -vvv, --verbose                     debug mode (default: false)
  -h, --help                          display help for command

Dev

npx projen && npm run build
cd ../MyProject
node ../ee-cdk-cli/bin f17befc027c248488537c7a122400985 -vvv

Readme

Keywords

none

Package Sidebar

Install

npm i ws-cdk-deployer

Weekly Downloads

2

Version

0.0.7

License

MIT-0

Unpacked Size

83.5 kB

Total Files

23

Last publish

Collaborators

  • flochaz