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
*.mjsextension NodeJSFunctionis NOT used, commonFunctionofaws-cdk-lib/aws-lambdais used instead, the reason is thatNodeJSFunctionuses 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.jsfile)Vitestused instead ofJest(typings out-of-the-box, HMR withwatchoption)AWS SDKis 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 lintrun typescript types verificationnpm run buildcompile typescript to jsnpm run testperform Vitest unit testscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation templatecdk destroydestroys created application