Patched implementation of CDK Workshop described at AWS CDK Workshop. Differences are:
- Lambda functions are compiled as ESM and not CommonJS (which is used by default)
- In order for lambda functions to be picked up correctly they are transpiled into files with
*.mjs
extension NodeJSFunction
is NOT used, commonFunction
ofaws-cdk-lib/aws-lambda
is used instead, the reason is thatNodeJSFunction
uses ESBuild under the hood to transpile each lambda function and requires ESBuild config at the place, I prefer common way of defining ESBuild options (e.g. inesbuild.config.js
file)Vitest
used instead ofJest
(typings out-of-the-box, HMR withwatch
option)AWS SDK
is updated to v3 (modularized approach is used insrc/lambdas/hitcounter.ts
)
The cdk.json
file tells the CDK Toolkit how to execute your app.
npm run lint
run typescript types verificationnpm run build
compile typescript to jsnpm run test
perform Vitest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation templatecdk destroy
destroys created application