We’re interested in having the ability to run our entire app locally. This app consists of an ECS API service and a handful of lambdas that are triggered by SQS queues which are triggered by the API, EventBridgeScheduler and the Lambdas themselves.
Is it typical to use something like Local Stack for this use case? Or is something like the server less framework better here?
I’ve heard a lot against using things like local stack because it will never replicate the cloud environment.
Edit: Not saying it’s bad. Just wanted to hear your thoughts .
Well, you make local changes and they reflect instantly in dev AWS environment. That’s pretty sleek to me. If you have used react on frontend, it has this thing where code changes appear in the browser instantly (hot reloading or something). Same idea for serverless.
I would avoid this. You’re going to spend a lot of resources trying to replicate your cloud environment locally. I would focus on strong unit tests based on the API contracts for the services that you use. Then invest in automated integration testing involving your full stack as a part of your release process.
We have a slim node.js app that parses our cloudformation (SAM) and uses AWSMocks to capture and trigger functions locally. It only works with node.js functions right now though
For development and testing, Serverless Stack (ie. SST, not to be confused with the Serverless Framework) does a pretty decent job of this. It runs shim Lambdas that forward to local… “Lambdas”.
Be aware that the documentation is in a state of flux at the moment, so the tutorials have some inconsistencies in them. Grabbing the project from Github and using the examples their will save a lot of frustration rather than following the tutorials on the website.
We use local stack + same terraform modules used to provision the cloud resources and work well. The key for us was to encapsulate all in a justfile command with recipes like “just up” and “just destroy”.
I’ve used local stack at a previous job and there weren’t really any problems with it. We were able to run and test things locally without many issues. Ironically, the one thing that I recall it wasn’t good at test was lambdas, so not sure if it’ll help OP much. But that was also back in 2020 since I last had to use it.
You shouldn’t test cloud resources in the cloud as a matter of full integration test.
Half assed way is to run lambda locally with an event json similar to real event
Quarter assed way is to have local creds so that lambda sdk assumes them while pulling sqs from the cloud