X: what's your opinion on VTL templates vs direct lambda invocations with AppSync?
me: you should use VTL templates (e.g. for DynamoDB) by default until it's either impossible or the VTL is getting too complex
X: but why?
me: well, let's see..
me: you can do whatever you want with Lambda, that gives you a lot of flexibility, but also all the drawbacks
X: such as?
me: cold starts, esp for resolvers that don't see a lot of traffic or the complexity overhead for mitigating them (Provisioned Concurrency or lambda warmer)
me: and you also have to consider the operational limits specific to Lambda, such as the *soft regional concurrency limit, and the *hard limit of 500 new concurrent executions per min after the init burst capacity (3000 concurrent executions)
X: ok, fair point.. anything else?
me: yes, there's also the extra cost for invoking the Lambda function, plus the cost for monitoring that function (e.g. CW Logs and X-Ray)
X: aren't there any other upside for using Lambda?
me: there is, actually!
me: the AWS SDKs give you retry & exponential backoff OOTB; you can implement fall-back & circuit breakers to make your app more resilient to failures; you can do failure injection to proactively identity failure modes in your app
X: but you'd still prefer VTL by default?
me: yes!
X: why..?
me: because simplicity wins and most of the time good enough is good enough 🤷‍♂️ You should start with the simplest solution and make it more complex when you need to, not the other way around
You can follow @theburningmonk.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.