<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>sleepy_keita</author><text>Yes, unit tests are the way to go. Lambda being a single function with a defined output makes this really simple. We have unit tests for sublibraries, but the &amp;quot;integration test&amp;quot;-level test are just calling the handler with the test payload and comparing it against the expected response.</text><parent_chain><item><author>andreineculau</author><text>I&amp;#x27;ve been in the AWS world for 4+ years now and my immediate feedback is don&amp;#x27;t run any local emulators. None!
Write unit tests for the internals and test your system end-to-end. I say that both because AWS services can have unpredictable behavior that you need to account for but also because local emulators are at best functional, but in reality far from emulating the AWS world on a 1:1 scale (especially the unpredictable behaviors i mentioned). So instead optimize for many local unit tests and many live end-to-end tests (implies many deployments and parallel environments prod, staging, dev, etc)&lt;p&gt;When it comes to Lambdas, given the reasons above, there&amp;#x27;s only one thing that can improve the experience: PROXY. Before i went on parental leave i had the idea is creating a proxy lambda which can be configured with an IP and port number. That IP and port is for your local dev environment. This way, when developing you can instruct a live system to short-circuit and to proxy calls to a local lambda available om the respective port. Trigger end-to-end tests by invoking AWS services that will eventually call the proxy lambda, and then your local lambda with the same environment&amp;#x2F;context&amp;#x2F;input, reply with output which will reach the proxy lambda, which will output the same content forward.</text></item></parent_chain></comment><story><title>Ask HN: Does anyone else find the AWS Lambda developer experience frustrating?</title><text>Hey HN,&lt;p&gt;I&amp;#x27;ve been using AWS lambda a bit recently, mostly as a way to glue together various bits and pieces.&lt;p&gt;Maybe I&amp;#x27;m doing this wrong but does anyone else find the experience to be really frustrating?&lt;p&gt;I can unit test bits of the code just fine, but at some point I always end up stuck in a slow feedback loop where I deploy the code, do some manual invoking, go and dig through the logs in CloudWatch, add another print statement in my lambda... and so on.&lt;p&gt;What I want is to run the lambdas locally, ideally more than one, and then exercise them with streams of test events (perhaps captured from a real environment). It would be quite cool if I could define BDD style tests around them too.&lt;p&gt;Anyone have any suggestions or share my frustrations?&lt;p&gt;I have heard localstack is quite good although I haven&amp;#x27;t given it a go yet. Would that work for me? I did try SAM but I was a bit underwhelmed and I don&amp;#x27;t want to use a separate IaC tool for these.&lt;p&gt;Alternatively, do other FaaS providers solve this problem?&lt;p&gt;Thanks for any help.</text></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>tdfirth</author><text>To check my understanding, you basically deploy a place holder lambda which proxies events to your dev machine?&lt;p&gt;That&amp;#x27;s pretty neat if so, I might have to try that out. Are there any downsides to this approach do you think?&lt;p&gt;Thanks for your thoughts on emulators&amp;#x2F;tests too.</text><parent_chain><item><author>andreineculau</author><text>I&amp;#x27;ve been in the AWS world for 4+ years now and my immediate feedback is don&amp;#x27;t run any local emulators. None!
Write unit tests for the internals and test your system end-to-end. I say that both because AWS services can have unpredictable behavior that you need to account for but also because local emulators are at best functional, but in reality far from emulating the AWS world on a 1:1 scale (especially the unpredictable behaviors i mentioned). So instead optimize for many local unit tests and many live end-to-end tests (implies many deployments and parallel environments prod, staging, dev, etc)&lt;p&gt;When it comes to Lambdas, given the reasons above, there&amp;#x27;s only one thing that can improve the experience: PROXY. Before i went on parental leave i had the idea is creating a proxy lambda which can be configured with an IP and port number. That IP and port is for your local dev environment. This way, when developing you can instruct a live system to short-circuit and to proxy calls to a local lambda available om the respective port. Trigger end-to-end tests by invoking AWS services that will eventually call the proxy lambda, and then your local lambda with the same environment&amp;#x2F;context&amp;#x2F;input, reply with output which will reach the proxy lambda, which will output the same content forward.</text></item></parent_chain></comment><story><title>Ask HN: Does anyone else find the AWS Lambda developer experience frustrating?</title><text>Hey HN,&lt;p&gt;I&amp;#x27;ve been using AWS lambda a bit recently, mostly as a way to glue together various bits and pieces.&lt;p&gt;Maybe I&amp;#x27;m doing this wrong but does anyone else find the experience to be really frustrating?&lt;p&gt;I can unit test bits of the code just fine, but at some point I always end up stuck in a slow feedback loop where I deploy the code, do some manual invoking, go and dig through the logs in CloudWatch, add another print statement in my lambda... and so on.&lt;p&gt;What I want is to run the lambdas locally, ideally more than one, and then exercise them with streams of test events (perhaps captured from a real environment). It would be quite cool if I could define BDD style tests around them too.&lt;p&gt;Anyone have any suggestions or share my frustrations?&lt;p&gt;I have heard localstack is quite good although I haven&amp;#x27;t given it a go yet. Would that work for me? I did try SAM but I was a bit underwhelmed and I don&amp;#x27;t want to use a separate IaC tool for these.&lt;p&gt;Alternatively, do other FaaS providers solve this problem?&lt;p&gt;Thanks for any help.</text></story>