DEV Community

Discussion on: API Gateway and Lambda

Collapse
 
andrewdmay profile image
Andrew May

I would add the AWS Serverless Application Model (SAM) to that list.
Behind the scenes it's mostly CloudFormation, but using a transformation that allows you to configure a lambda function and it's event sources in a more compact way very similar to the Serverless Framework.
Like Serverless it comes with a CLI and makes it easy to deploy and update lambda functions. It also has some ability to run your Lambda functions locally within official AWS Docker containers, and even serve a light form of API Gateway (REST only currently) locally.

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