ws-cdk-deployer
v0.0.7
Published
This tool aim to ease the deployment of CDK app for Wokshop studio accounts provisionning.
Readme
Workshop studio cdk app deployer
This tool aim to ease the deployment of CDK app for Wokshop studio accounts provisionning.
Prerequesite
- To have a Workshop repo created and clone from https://studio.us-east-1.prod.workshops.aws/workshops
- 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)
- An instance of the CDK Deployer (https://constructs.dev/packages/aws-analytics-reference-architecture/v/2.5.0/api/CdkDeployer?lang=typescript)
- node installed
What it does ?
- Compress CDK app into a zip file
- Upload CDK app into the right bucket
- Generate CDK deployer CFN template (with proper buildspec)
- Populate workshop studio content spec
- 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 commandDev
npx projen && npm run build
cd ../MyProject
node ../ee-cdk-cli/bin f17befc027c248488537c7a122400985 -vvv