I recently started developing a serverless application using the AWS CDK with TypeScript, and I find it much more efficient than managing everything through the console. I can host my code in a repository, and the organization and maintenance benefits significantly from this approach. However, one advantage of using the AWS Console was the ability to quickly test code. You could write a Lambda function and test it instantly without any issues. In contrast, with the CDK, you first need to deploy, push updates to the cloud, and only then test them. Is there a way to test CDK applications locally? Not just Lambda functions, but something that simulates AWS services as a whole?
Question posted in Amazon Web Sevices
The official Amazon Web Services documentation can be found here.
The official Amazon Web Services documentation can be found here.
2
Answers
It sounds like what you’re after is LocalStack ( see https://github.com/localstack/localstack ). There is a free and paid version of this product, where the latter is far more advanced and feature-rich.
Here’s a link showing a run down of the supported APIs and emulated services:
https://docs.localstack.cloud/user-guide/aws/feature-coverage/
I have dealt with CDK testing in the past extensively let me break this for you.
Testing Application layer like creating Lambda function by CDK
Testing AWS service or infrastructure resource created by CDK