DEV Community

Discussion on: API Gateway and Lambda

Collapse
 
mackittipat profile image
Mac

Thanks for sharing Andrew. It is very interesting especially it can run Lambda and API gateway locally.
I am just curious that will running locally works if my Lambda need to connect to SQS and DynamoDB on AWS?

Collapse
 
andrewdmay profile image
Andrew May

For talking to other AWS services you can provide it with an AWS profile to use (see the --profile option on sam invoke local and sam local start-api) and it will then use those services in your AWS account.

It is possible, but somewhat more complicated to run test versions of DynamoDB and mock versions of some services in Docker (see the localstack project) - but requires you to run the services in the same docker network and override the endpoint that is used to communicate with the services.

If you're just consuming messages from SQS, the sam local generate-event command can be used to create test events to feed to sam local invoke.

Thread Thread
 
mackittipat profile image
Mac

Thanks Andrew