Inspired from Bite-Sized Serverless courses and serverless-integration-testing-with-step-functions .
This sample repository integrates serverless-integration-testing-with-step-functions with CDK Pipelines, in TypeScript.
All credits go to @donkersgood for his work on bitesizedserverless.com.
The following tools need to be installed on your system prior to installing the CDK:
- Node.js >= 14.15.0
- We recommend using a version in Active LTS
- Yarn >= 1.19.1, < 2
- Docker >= 19.03
- the Docker daemon must also be running
Deploying AWS CDK apps into an AWS environment (a combination of an AWS account and region) may require that you provision resources the AWS CDK needs to perform the deployment. These resources include an Amazon S3 bucket for storing files and IAM roles that grant permissions needed to perform deployments. The process of provisioning these initial resources is called bootstrapping.
$ cdk bootstrap aws://<ACCOUNT-NUMBER-1/REGION-1
By default, the pipeline authenticates to GitHub using a personal access token stored in Secrets Manager under the name
github-token
.
Read more about CodePipeline sources here.
$ cdk deploy
If you need to test a feature before making a PR you can deploy your own stack by creating a stage inside bin/curation-tool-cdk
.
This saves you the trouble of triggering CodePipelines.
new PipelineStage(app, 'your-local-stage', {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION
}
})
Synthesize an AWS CloudFormation template for the app, as follows.
$ cdk synth
Deploy your temporary stage CloudFormation template, as follows.
$ cdk deploy -a cdk.out/assembly-your-local-stage
Once done, don't forget delete the stack.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template