Stubbing Lambda Functions in your CDK Stack
Given you have a stack with one or more Lambda functions (e.g. as part of a Step Functions state machine), it can be pretty useful to stub long running parts with a known response.
This makes use of cdk Aspects, which allows modifying all or a filtered subsset of resources for a given scope (Stack, Construct).
In addition this leverages raw overrides to remove the original code of the Lambda function.
Please note, that the stub has to be in Python or NodeJS, since inlining code is only supported by those runtimes.