<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aleksandr Zakharov</title>
    <description>The latest articles on DEV Community by Aleksandr Zakharov (@xezed).</description>
    <link>https://dev.to/xezed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F614818%2F32310f9c-bb1d-4d34-8404-3b56c773b13b.jpeg</url>
      <title>DEV Community: Aleksandr Zakharov</title>
      <link>https://dev.to/xezed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xezed"/>
    <language>en</language>
    <item>
      <title>Lessons we've learned after burning many thousands thanks to AWS Lambda. Expect no mercy from AWS.</title>
      <dc:creator>Aleksandr Zakharov</dc:creator>
      <pubDate>Wed, 20 Oct 2021 02:10:55 +0000</pubDate>
      <link>https://dev.to/xezed/lessons-weve-learned-after-burning-many-thousands-thanks-to-aws-lambda-expect-no-mercy-from-aws-39ph</link>
      <guid>https://dev.to/xezed/lessons-weve-learned-after-burning-many-thousands-thanks-to-aws-lambda-expect-no-mercy-from-aws-39ph</guid>
      <description>&lt;h2&gt;
  
  
  Preface.
&lt;/h2&gt;

&lt;p&gt;A year ago, we decided to make a transition towards serverless architecture. Our management was very excited about it, and its excitement resulted in many tries and failures for developers(including me). So one Monday, we started our working day and realized that one of our lambdas had been going right into the rabbit hole the whole weekend. We were astonished, management was dissatisfied, and I was happy with the new material for the current article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our setup.
&lt;/h2&gt;

&lt;p&gt;The staple part of several microservices at our disposal heavily relies upon S3 event notifications. So what happened. &lt;br&gt;
A developer screwed up and invoked Lambda from within the same Lambda for the same file in S3, which initially triggered Lambda. These invocations created other S3 files, which started different lambdas... You got the idea. &lt;/p&gt;

&lt;p&gt;Dev wasn't fired or sanctioned in any way. Because it's an architectural problem, anyone can make a silly mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  How much we've lost? Tenths of thousands.
&lt;/h2&gt;

&lt;p&gt;We filled the ticket afterward and got compensated 5k only because we spent this much before the alarm came through.&lt;/p&gt;

&lt;h2&gt;
  
  
  Precautions we implemented to prevent future incidents.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;We set budget notifications and created alarms to email, slack channel, and mobile phone of key tech company figures. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most of the Lambdas must have reserved concurrency parameters set.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most of the Lambdas must be invoked via SQS only.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We also implemented AWS Config rule to check all our Lambdas for reserved concurrency.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With reserved concurrency, we avoid calling functions more than we should. This way, essentially throttle it. &lt;/p&gt;

&lt;p&gt;And SQS helps us to prevent data loss. In case of facing concurrency limit, Lambda will wait before obtaining the following message from the queue. &lt;/p&gt;

&lt;h2&gt;
  
  
  Questions to think about.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Why is there no option to kill all AWS activities after reaching some usage threshold? &lt;/li&gt;
&lt;li&gt;Is it this complicated to create an intelligent tool to help AWS customers catch this situation and avoid money loss?&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>cloud</category>
      <category>terraform</category>
    </item>
  </channel>
</rss>
