amazon-web-servicesaws-lambdaaws-api-gatewayaws-cdk

Testing AWS CDK Applications Locally


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?


Solution

  • 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/