kamii
kamii

Reputation: 227

Deploy a CDK stack with API Gateway and Lambda locally

I have a CDK stack that sets up an API Gateway and routes resources to lambda functions. Very simple, not using SLS or SAM, but I do use s3 and sqs for this service.

Is there a way to:

  1. Deploy this gateway locally and have it run on localhost?
  2. Simulate the queues, RDS, Dynamo, and s3? This isn't necessary as I can always just have each developer on my team have their own queue/s3 and configure their service to use those.

Ideally I can just type something like 'cdk deploy local' and deploy my cdk stack to this resource just like I do to our dev test and prod environments.

Upvotes: 0

Views: 1113

Answers (1)

sytech
sytech

Reputation: 41119

You can use the AWS CDK with Localstack (cdklocal). Localstack resources essentially behave just like AWS cloud resources and most resource types are supported -- you can create buckets, lambda functions, api gateways, dynamo db tables, or whatever you need locally.

You will likely need to tweak some things to ensure the code you deploy locally uses the localstack endpoints.

See also: https://docs.localstack.cloud/getting-started/

Upvotes: 0

Related Questions