<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amos Shahar on Medium]]></title>
        <description><![CDATA[Stories by Amos Shahar on Medium]]></description>
        <link>https://medium.com/@amos.shahar?source=rss-617f1a037d01------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JktXCWEFCe9U9uOY4RTUkg.png</url>
            <title>Stories by Amos Shahar on Medium</title>
            <link>https://medium.com/@amos.shahar?source=rss-617f1a037d01------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:44:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amos.shahar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Data Lakes to Oceans]]></title>
            <link>https://medium.com/hackernoon/from-data-lakes-to-oceans-b813e5e6bd04?source=rss-617f1a037d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/b813e5e6bd04</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data-lake]]></category>
            <category><![CDATA[federated]]></category>
            <dc:creator><![CDATA[Amos Shahar]]></dc:creator>
            <pubDate>Mon, 11 Nov 2019 08:03:04 GMT</pubDate>
            <atom:updated>2019-11-11T08:20:21.429Z</atom:updated>
            <content:encoded><![CDATA[<p>Aggregating into data lakes is the solution of today — but are Federated Sources the solution of tomorrow?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QR2WvAouLnSdTIjo7FfmfQ.png" /><figcaption>Data Lakes → Data Oceans</figcaption></figure><h3>TL;DR</h3><p><strong>Data lakes</strong> are considered to be a popular solution for uniting insights from ALL the organization’s data sources.</p><p>An emerging alternative is the <strong>federated data sources </strong>approach, which generates the same output<strong> </strong>with a fraction of the effort and cost — without the data duplication. In this post, we’ll explore the advantages and disadvantages of both options and where it may make sense for your team.</p><h3>A perfect database. What If?</h3><p>Imagine the perfect database. The best aspects of all databases types, combined into one — without limitations:</p><p>Unlimited data storage and processing you get with Hadoop, the fast query execution enjoyed with Redis or DynamoDB; lightning-fast CRUD (create, read, update delete); RDBMS capabilities like Joins, Unions and aggregation; support for structured <em>and</em> unstructured data; querying as if you’re using a data warehouse; with permissions configurable per table, column and row.</p><p>I’m not sure that even if such a super computing database existed, all of these capabilities could logically reside in one database. Anyway, it’ll be awhile before we get there. Until then, organizations are using multiple databases with different capabilities for different use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*GolAVNUUQg01boPDwjbIjA.jpeg" /><figcaption>Pictured: Why we need to get information from all data sources.</figcaption></figure><p>But that comes with it’s own issues.</p><h3>The problem</h3><p>Two main issues arise from juggling data in multiple databases and database types:</p><ol><li>Because each database uses a different API/language, having different database types requires having experts at hand for each DB: IT/admin, DevOps, Application Developers. Backups and maintenance are different for each DB as well.</li><li>More importantly is that the main resource of the organization — <strong>data</strong> — is distributed, duplicated, and cannot be aggregated for global insights in a clean, unified manner.</li></ol><h3>The data lake solution</h3><p>The first solution, which has become a common buzzword over the past few years, is to build a <strong>data lake</strong>. The rationale for having a data lake is to bring all data into one place, where it can be queried using a single query engine.</p><p>However, the process to <em>get it into</em> the lake requires many ETL (Extract, Transform and Load) processes using tools like Airflow, AWS Glue, Google Cloud Dataflow, among others. During this process, data is often duplicated and not updated as frequently as needed. Every organization has its data graveyards — huge stores of data that no one knows about or doesn’t have the courage to delete. With data lakes, the graveyard’s size will multiply.</p><p>Lastly, ETL processes can raise security and regulation concerns, they have high maintenance and costs associated with them, and current lake solutions are provider-locked, allowing you access to data for <strong><em>some</em></strong> of their <em>own</em> services only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j37PihriIww_k4JI_OwF2Q.png" /><figcaption>AWS Data Lake solution</figcaption></figure><h3>The Federation solution</h3><p><strong>Federated Sources </strong>brings a new approach to the table. Each database processes and storing its own data as they were meant to. Data is not transferred out. Instead, there is one engine that can query multiple types of databases and seamlessly merge the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*dGxjzXg4xuCbqllaephpLQ.jpeg" /><figcaption>Data lakes vs. Federated Data Sources</figcaption></figure><p>What are the important features of an engine capable of querying federated sources?</p><p>This engine must have three important characteristics:</p><ol><li>One common API or language to query the database (SQL?)</li><li>A mechanism that can unify all the data from disparate sources so it can be queried and aggregated.</li><li>The security, governance, and auditing controls one has with a data lake solution.</li></ol><p>Two important notes about federation:</p><ul><li>Performance isn’t the main benefit of this approach. If your output requires specific capabilities, load the data into the relevant data engine (BigQuery, DynamoDB, etc.) and use it there. But if you need to get business logic from multiple database types, federation will do the job for you.</li><li>Business logic output will always be relatively small. For example, the DWH will do what it does best and respond with the aggregated output to this new engine, which will be able to join/merge/union the results with other database outputs in order to help with important business insights.</li></ul><p>This federation engine will also have to have integrations to each database which implements each API, translate data formats so they can be merged/joined with other results, and expose one common (SQL) syntax to query all these databases.</p><h3>Who is investing in federated solutions?</h3><p><strong>Google</strong> <strong>BigQuery</strong> is investing some effort in the direction of federated sources, with a caveat — Google-only services (and only three, as of now). They sometimes refer to it as <strong>federation,</strong> and sometimes “external data sources”. In their case, <strong>BigQuery</strong> acts as the federation engine and SQL is the common syntax used. You can query external resources: <strong>Cloud BigTable</strong>, <strong>Cloud Storage, </strong>and <strong>Google Drive. </strong>The data sources can be <strong>MySQL tables </strong>or file types like <strong>ORC</strong> and <strong>Parquet.</strong></p><p><strong>Amazon AWS</strong> also invests in the federation approach with a new project called <strong>“</strong><a href="https://aws.amazon.com/blogs/opensource/announcing-partiql-one-query-language-for-all-your-data/"><strong>PartiQL</strong></a>”. It enables unified query access across multiple data stores and data formats by separating the syntax and semantics of a query from the underlying format of the data or the data store that is being accessed — and it is open source.</p><h3>Wrapping up</h3><p>While federated querying has its obvious advantages over data lakes, the solutions out there today aren’t complete.</p><p>Once we can use SQL syntax to query <em>any </em>data source while being able to Join, Union, and aggregate the outputs in a single command line, <em>then</em> we’ll have a complete solution.</p><p>It’ll look something like this:</p><pre><em>select * from</em></pre><pre><strong><em>bigquery</em></strong><em>Table as bqt join</em></pre><pre><strong>dynamo</strong>Table as dt join</pre><pre><strong>facebookApi</strong> as fbt join</pre><pre><strong>logfiles</strong> as lt</pre><pre>where ….</pre><pre>group by …</pre><p>At <a href="http://superquery.io/"><strong>superQuery</strong></a>, we believe that this “complete” engine is possible, and are building for it — we call it “<strong>Data Alloy</strong>”.</p><p>Please “clap” if you enjoyed reading this article, and stay tuned for more updates on this front.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b813e5e6bd04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/from-data-lakes-to-oceans-b813e5e6bd04">From Data Lakes to Oceans</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect dynamoDB using mysql client, and join tables across regions.]]></title>
            <link>https://medium.com/hackernoon/connect-dynamodb-using-mysql-client-and-join-tables-across-regions-e1cb827e6340?source=rss-617f1a037d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1cb827e6340</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <dc:creator><![CDATA[Amos Shahar]]></dc:creator>
            <pubDate>Sun, 18 Aug 2019 18:06:32 GMT</pubDate>
            <atom:updated>2019-08-19T10:55:42.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>Query DynamoDB using your MySQL client</h3><h4>Join tables across regions and CRUD using standard SQL syntax.</h4><p>In this article I will show how to connect to DynamoDB using MySQL client, and standard MySQL syntax</p><p>But first, why query AWS DynamoDB tables with MySQL instead of via the DynamoDB API/CLI?</p><p>Using MySQL syntax, you can:</p><ul><li>Query by any field — regardless if you know the primary key / sort key / indexes.</li><li>JOIN/UNION DynamoDB tables even across regions</li><li>Use SQL aggregation functions like AVG, COUNT, MAX …</li><li>Delete/update multiple items by any filter (or truncate the whole table)</li><li>Add multiple rows / copy table in one command</li></ul><p>Now, let’s see how to set this up in just three steps.</p><h4><strong>Prerequisite Requirements</strong>:</h4><ol><li>AWS account with sufficient DynamoDB permissions</li><li>MySQL client (Workbench, Toad, Mac Terminal, etc.)</li><li>Google account for logging-in to superQuery</li></ol><p>For this demo I created two DynamoDB tables in each of these two regions:</p><p><strong>eu-west-1</strong>, <strong>eu-central-1</strong>. the tables are <strong>usersDetails</strong> and <strong>usersSessions</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*mVoEp9IX9OldkjNxO1ykxA.jpeg" /></figure><h3><strong>Step 1: Connect your DynamoDB to superQuery</strong></h3><p>1.1 <a href="http://www.superquery.io/">Connect to superQuery</a> (all you need is a Gmail or Gsuite account)</p><p>1.2 Go to <strong>Integrations → Available Integrations</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cg25mddlihZAFNdg" /></figure><p>1.3 Select “DynamoDB”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D3opQAbOvjVH5cwVDAeJRw.png" /></figure><p>1.4 Set your Dynamo DB credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*8SkJRaDr22T_O9ON8YGnRA.png" /></figure><h3><strong>Step 2: Get your MySQL credentials for connecting your MySQL client to DynamoDB</strong></h3><ol><li>Go to “<strong>Connections and BI</strong>” <strong>→</strong> <strong>MySQL</strong>, and copy the user and password</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*o8h_5X6dom2gOUirkVvPCQ.jpeg" /></figure><h3><strong>Step 3: Connect your MySQL client to DynamoDB</strong></h3><p>2.1 Open your MySQL client and connect using the username &amp; password from the previous step (The host is <strong>proxy.superquery.io</strong>) using this command:</p><p><strong>mysql -hproxy.superquery.io -u${user} -p${pass} -A</strong></p><p>2.2 Run “<strong>show databases</strong>” to view all of your AWS regions</p><p>2.3 Select your database with the “<strong>use</strong>” command</p><p>2.4 Use “<strong>show tables</strong>” to view the tables in the database you selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/0*eumPzlK0vYJmgiGC" /></figure><p>2.5 Query your table — a simple “WHERE” clause will suffice for this first run. superQuery’s engine will decide whether a “<strong>Scan</strong>” or “<strong>Query</strong>” is optimal.</p><p>Queries can be performed on any field, key, sort, index, or regular field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*5Btvk93YLER4PeOv" /></figure><p>2.6 Try a more advanced query with an <strong>aggregation</strong> function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/0*83TBvnYchHup-wnm" /></figure><p>2.7 <strong>JOIN</strong> tables, just like MySQL or any relational DB!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*QwBIuEBlyYEF2W6z" /></figure><p>2.8 <strong>UNION</strong> across regions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/0*BXoom0Jf-waaVADR" /></figure><h4>Finally, what about security?</h4><ul><li>You can limit the MySQL connection to a specific IP range, or disable access to certain users.</li><li>superQuery uses the highest security standards to secure your connection and data.</li><li>For the AWS credentials, set only the required permissions for reading and/or writing from DynamoDB.</li></ul><h3>Summary</h3><p>The benefits of using MySQL client for DynamoDB are:</p><ul><li>Using the widely-known <strong>MySQL syntax</strong></li><li>Unlike the AWS APIs, you can query and sort by any field and get an answer. superQuery’s engine will decide if <strong>Query</strong> or <strong>Scan </strong>is needed</li><li>You can have sophisticated relational DB functionality such as <strong>JOIN</strong> tables across regions.</li><li>UPDATE, DELETE , INSERT <strong>multiple rows</strong> in a single standard SQL query.</li></ul><p>Stay tuned — In my next posts, I’ll show you how to JOIN DynamoDB tables with tables from MySQL Google BigQuery, AWS Athena, and more… all with standard SQL syntax!</p><p>If you enjoyed this read, please leave some claps 👏.</p><p><em>Amos is Head of DevOps at </em><a href="http://web.superquery.io/"><em>superQuery</em></a><em>, which empowers data teams to leverage Google BigQuery at peak efficiency. Utilizing an IDE built specifically for BigQuery along with a query optimization engine, analysts &amp; data scientists increase productivity, stay organized, and improve query performance while reducing costs.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dZtF7fTaLYZG-6lFxGX_OA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1cb827e6340" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/connect-dynamodb-using-mysql-client-and-join-tables-across-regions-e1cb827e6340">Connect dynamoDB using mysql client, and join tables across regions.</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to solve the API-GW “30 seconds limitation” using ALB]]></title>
            <link>https://medium.com/hackernoon/how-to-solve-the-api-gw-30-seconds-limitation-using-alb-700bf3b1bd0e?source=rss-617f1a037d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/700bf3b1bd0e</guid>
            <category><![CDATA[api-gw]]></category>
            <category><![CDATA[30-second-limitation]]></category>
            <category><![CDATA[api-gw-alb]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Amos Shahar]]></dc:creator>
            <pubDate>Fri, 31 May 2019 20:01:44 GMT</pubDate>
            <atom:updated>2019-05-31T21:26:52.654Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EDs-d96ntD5san7u5dkiog.png" /></figure><p>You have a serveless solution using multiple AWS lambdas and API-GW for the APIs. all is working great but then you have this one (or more) lambda function that runs for more than 30 seconds — and you get <strong>timeout error</strong>. It is frustrating as lambda can run up to 15 minutes. Usually AWS provides you the option to decide how your solution will look like but here they decide for us that API must take less than 30 seconds.</p><p>In my case, I am using an API that runs SQL queries and in many cases it just takes more than 30 seconds to be completed. there are many more similar scenarios.</p><p>So we need an API service that can last more than 30 seconds, but still wants to stay in a <strong>serverless architecture.</strong></p><p>The solution I’ll demonstrate here is to use <strong>AWS ALB </strong>(Application Load Balancer)</p><p>Those are the steps I’ll cover:</p><ol><li>Create a lambda and API-GW. show that API request that runs more than 30 sec is failing when using the API-GW.</li><li>Create ALB that invokes the same lambda — verify it works for 40 sec.</li><li>Create a second lambda, and show how to route between the Lambdas using the URL parameters.</li></ol><h3>Step 1: Create Lambda and API GW</h3><ul><li>The new lambda called <strong>lambda1. </strong>This is a very basic lambda that gets one parameter called <strong>waitSec -</strong> that will help us to control the lambda duration. This is<strong> </strong>the <strong>nodeJs</strong> code:</li></ul><pre><strong><em>exports</em></strong>.handler = <strong>async </strong>(<strong><em>event</em></strong>) =&gt; {</pre><pre>    let start = <strong>new <em>Date</em></strong>();                // start time<br>    let waitSec  = <strong><em>event</em></strong>.<strong>queryStringParameters</strong>.waitSec;//wait param<br>    await <em>wait</em>(waitSec);                   // wait!       <br>    let end = <strong>new <em>Date</em></strong>();                  // end time<br>    <strong>const </strong>response = {<br>        <strong>statusCode</strong>: 200,<br>        <strong>headers</strong>: {<br>            <strong>&quot;content-type&quot;</strong>: <strong>&quot;application/json&quot;</strong>,<br>        },<br>        <strong>body</strong>: <strong><em>JSON</em></strong>.stringify(<strong>`Hello from Lambda * 1 *, wait:</strong>${<strong><em>event</em></strong>.<strong>queryStringParameters</strong>.waitSec}<strong> ***start: </strong>${start}<strong> ***end: </strong>${end}<strong>`</strong>),<br>    };<br>    <strong>return </strong>response;<br>};</pre><pre>// wait function (sleep)<br><strong>async function </strong><em>wait</em>(timeSec){<br>    <strong>return new </strong><em>Promise</em>(<strong>resolved </strong>=&gt; {<br>        setTimeout(() =&gt; {<br>        resolved()<br>    }, timeSec * 1000)<br>})<br>}</pre><p>Change the lambda timeout to 5 minutes (or any time &gt; 30 sec that you need) — and deploy the lambda.</p><ul><li>Create a new API-GW that invoke <strong>lambda1</strong>, I called it <strong>lambda1Api:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmz9FsgnE2f1hivFxT8sow.png" /></figure><p>Create a method “<strong>ANY “ </strong>that will invoke<strong> lambda1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nqpK4ycF8s37R3JZAuAdww.png" /></figure><p>Deploy the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXMC2t0JShul9uJdTWNEtQ.png" /></figure><ul><li>In order to test, we need to get the API-GW URL from:</li></ul><p><strong>stages-&gt;stage1 -&gt; Invoke URL (in the title)</strong></p><p>Don’t forget to add our <strong>waitSec</strong> parameter! this is what I got:</p><p><a href="https://w4bnn2g6ce.execute-api.eu-central-1.amazonaws.com/stage1?waitSec=3">https://w4bnn2g6ce.execute-api.eu-central-1.amazonaws.com/stage1?<strong>waitSec=3</strong></a></p><p>working with 3 seconds:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XluB2u9OR5rHDWFkbteoaw.png" /></figure><p>but <strong>NOT</strong> working with 40 seconds:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuWM_3LOYPTFUepRrkjW4A.png" /></figure><h3>Step 2: create ALB</h3><p>From the EC2 service console -&gt; target groups, create a new target</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ym5d4bfdvdfFRfi7aiFUQ.png" /></figure><p>and from the <strong>“Load Balancers”</strong> menu, create a new ELB -&gt; “application load balancer”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DMGvd8JC7HF2RERIFm21lw.png" /></figure><p>Make sure port 80 is open in security group for our browsing.</p><p>In the routing step, we will direct, by default, all the requests to our <strong>lambda1TargetGroup.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHpEOL14X5OF2lkXBiqGMA.png" /></figure><p>When done, Get the ALB DNS name from the “<strong>description</strong>” tab. add the <strong>waitSec </strong>param to the URL, and test:</p><p><a href="http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=3">http://lambdaALB-641303138.eu-central-1.elb.amazonaws.com?waitSec=</a>40</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJoX5nMn4wX8lhweMCJFyQ.png" /></figure><p>40 Seconds and <strong>WORKING!!</strong></p><h3>Step 3: Route between Lambdas using URL parameters</h3><p>if you have multiple lambdas that need be invoked using API through the ALB, you can route using the URL parameters, for example:</p><p><a href="http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=2&amp;lambda=lambda2">http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=2<strong>&amp;lambda=lambda2</strong></a></p><ol><li>Create one more lambda called <strong>lambda2, </strong>using the instructions in step 1. The only change is that the text returned is “<strong>lambda 2”</strong> so we could identify which lambda we used.</li></ol><p>2. in the ALB -&gt; ceate one more target group for <strong>lambda2</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNlAY68KwKdY9o6nfOl9eQ.png" /></figure><p>3. Edit the routing rules, and add route for <strong>lambda2</strong>: we will route the API to the right lambda using the URL query parameter called <strong>lambda.</strong></p><p><strong>lambda=lambda1</strong> or <strong>lambda=lambda2</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*48VtRwEhqA2dsht7K1DvwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSNz91jGYCGZAcENMN39BQ.png" /></figure><p>Now, let’s test and make sure that the correct lambda is running by the <strong>lambda</strong> parameter:</p><p><a href="http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=2&amp;lambda=lambda2">http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=2<strong>&amp;lambda=lambda</strong></a><strong>1</strong></p><p>return :<strong>”Hello from Lambda * 1 *,</strong></p><p><a href="http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=2&amp;lambda=lambda2">http://lambdaalb-641303138.eu-central-1.elb.amazonaws.com/?waitSec=2<strong>&amp;lambda=lambda2</strong></a></p><p>return :<strong>”Hello from Lambda * 2*</strong></p><h3><strong>Conclusion</strong></h3><p>ALB is a good serverless alternative for API-GW if your lambda takes more than 30 seconds.</p><p>enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=700bf3b1bd0e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-to-solve-the-api-gw-30-seconds-limitation-using-alb-700bf3b1bd0e">How to solve the API-GW “30 seconds limitation” using ALB</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DynamoDB: Query vs Scan, SQL syntax and JOIN tables — Part 1]]></title>
            <link>https://medium.com/hackernoon/dynamodb-query-vs-scan-sql-syntax-and-join-tables-part-1-371288a7cb8f?source=rss-617f1a037d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/371288a7cb8f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[join]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Amos Shahar]]></dc:creator>
            <pubDate>Fri, 24 May 2019 20:31:13 GMT</pubDate>
            <atom:updated>2019-05-24T20:53:21.267Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>DynamoDB</strong>: Query vs Scan, <strong>SQL syntax</strong> and <strong>JOIN</strong> tables — Part 1</h3><p>So, you need a robust solution, quick response to thousands of requests per second, you decide of no-SQL DB and the AWS DynamoDB is prince charming: great performance, unlimited scale and fully managed.</p><p>But then, as time pass by, you have more and more DynamoDB tables, you have multiple regions, the primary Key (e.g. userId) is duplicated to multiple tables and the application suddenly needed to query data using fields you hadn’t anticipated…</p><p>T<em>he</em> business starts to ask complicated questions about the data. You need to count, sum, filter, group data and join tables. The app developers start to query too many tables and do calculations and joins within the code or maybe export the data to excel to provide the answers???</p><p>mmm… prince charming is not that shining now :-\</p><p>In this, three-parts article, I will demonstrate how you can solve these three key issues:</p><p><strong>1</strong>. Querying DynamoDB using AWS <strong>Javascript</strong> SDK, Knowing Keys and Indexes, and <strong>Query</strong> vs. <strong>Scan</strong></p><p><strong>2</strong>. How to use simple <strong>SQL syntax</strong> to query DynamoDB, and how to connect to it using a standard <strong>MySQL client</strong>.</p><p><strong>3</strong>. How to query your DynamoDB as if it was a real relational database (RDBMS):</p><ul><li>Use <strong>Aggregation</strong> functions (<strong>count</strong>, <strong>min</strong>, <strong>max</strong>…) using <strong>group by</strong></li><li><strong>JOIN</strong> and <strong>UNION</strong> DynamoDB tables</li><li><strong>Cross-region</strong> queries</li></ul><h3>Part 1 — <strong>Querying DynamoDB using AWS Javascript SDK, Knowing Keys and Indexes, and Query vs. Scan</strong></h3><p>Before choosing which DynamoDB API to use, you should be well aware of the keys of your table:</p><p>◦ What is the primary key and its sort key?</p><p>◦ What are the indexes? What is the sort key of each index?</p><p>After answering these questions, we need to decide which API to use: <strong>Scan</strong> or a <strong>Query</strong>:</p><p>Ideally, we would like to use <strong>Query</strong> as our first option: It is the quickest way to <strong>query</strong> dynamo and get the results in a fraction of a second. If this isn’t possible, we will use <strong>Scan</strong> which may take several seconds or even more, depends on the table size.</p><p><strong>Scan</strong> filtering is simple, you can use any column (key, sort, index, index sort or simple column) and have multiple filters in the same API.</p><p>To <strong>query</strong>, as mentioned above, you need to consider the table keys structure.</p><p>Here are the three rules of thumb:</p><p>◦ Query can have one or two fields to filter (but not more!)</p><p>◦ One of the filter fields must be the <strong>primary key</strong> or the <strong>index key</strong></p><p>◦ The second filter field must be the <strong>related</strong> <strong>sort key</strong></p><p>Here an example of a table called testTable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zy8N4MXdp8wujrtHYa3rIw.png" /></figure><p>It has a primary key (<strong>id1</strong>), with an associated sort key (<strong>sort1</strong>),</p><p>and two indexes with their own associated sort keys: <strong>id2</strong> with <strong>sort2</strong> and <strong>id3</strong> with <strong>sort3</strong>. <strong>Id4</strong> is a regular field.</p><p>you can see the primary key and it sort key in the “overview” tab in the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hxA-PnCYdSma_ZiX-z4EA.png" /></figure><p>The indexes and their work keys can be seen in the indexes tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0jNkj8UE97Wkqzr0kHFoA.png" /><figcaption>testTable Indexes</figcaption></figure><p>or you can get this information using the dynamoDB SDK’s <strong>describeTable </strong>API:</p><pre><strong><em>it</em></strong>(<strong>&quot;describe dynamo table&quot;</strong>, <strong>async </strong>() =&gt; {<br>    <strong>let </strong>table = <strong>&quot;testTable&quot;</strong>;<br>    <strong>let </strong>params = {<br>        <strong>TableName</strong>: table<br>    };<br>    <strong>let </strong>[err,tableInfo] = <strong>await new </strong><em>Promise</em>((resolved) =&gt; {<br>        <strong>let </strong>dynamodb = <strong>new </strong>AWS.DynamoDB({<strong>region</strong>: <strong>&quot;us-west-1&quot;</strong>});<br>        dynamodb.describeTable(params, <strong>function </strong>(err, data) {<br>            <strong>if </strong>(err) {<br>                <strong><em>console</em></strong>.log(<strong>`ERROR: </strong>${err}<strong>`</strong>);<br>            }<br>            resolved([err, data]);<br>        });<br>    });<br>    <strong><em>console</em></strong>.log(tableInfo)<br>});</pre><p>This is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LBjfxo4GYZjUa4IshSMDiQ.png" /></figure><p>Let’s see which <strong>query</strong> filters we can execute on this table:</p><ul><li>Key (id1)</li><li>Key (id1) AND sortKey (sort1)</li><li>Index1 (id2)</li><li>Index1 (id2) AND index1sort (sort2)</li><li>Index2 (id3) AND index2sort2 (sort3)</li></ul><p>But we can <strong>NOT</strong> query by:</p><ul><li>SortKey (sort1) -&gt; no key</li><li>Index1sort (sort2) -&gt; sort without the index key</li><li>Key AND index (id1,id2) -&gt; can be by key or index not both</li><li>Key AND index1sort (id1, sort2) -&gt; key can only be with its related sort</li><li>Index1 AND index2sort (id2, sort3) -&gt; mixed index and sort</li><li>Key1 AND sortKey AND index (id1,sort1,id2) -&gt; more than 2 filters</li></ul><p>Now, that we chose the right API for our use case, let’s see the implementation using the AWS SDK for JavaScript:</p><ol><li>query with key and sort:</li></ol><pre><em>// select id1, sort1, id2 from testTable where id1=&#39;a&#39; and sort1=&#39;a&#39;<br>// using dynamoDB query , key filter<br></em><strong><em>it</em></strong>(<strong>&quot;dynamo basic query - key&quot;</strong>, <strong>async </strong>() =&gt; {<br>    <strong>this</strong>.<strong>AWS </strong>= <strong><em>require</em></strong>(<strong>&#39;aws-sdk&#39;</strong>);<br>    <strong>this</strong>.<strong>AWS</strong>.<strong>config</strong>.<strong>region </strong>= <strong>&#39;us-west-1&#39;</strong>;<br>    <strong>let </strong>dynamoDB = <strong>new </strong>AWS.DynamoDB();<br><br>    <strong>let </strong>table = <strong>&quot;testTable&quot;</strong>;<br>    <strong>let </strong>totalRowsCount = 0;<br>    <strong>let </strong>totalRows = [];<br>    <strong>let </strong>[rows, keepWork] = [<strong>null</strong>,<strong>true</strong>];<br>    <strong>let </strong>limit = 1000;<br><br>    <em>// for fields list<br>    </em><strong>let </strong>fields = <strong>&quot;id1, sort1, id2&quot;</strong>;<br><br>    <em>// for the query filter &quot;where&quot;<br>    </em><strong>let </strong>filterValues = {<em><br>        </em><strong>&#39;:v1&#39;</strong>: {<strong>S</strong>: <strong>&#39;a&#39;</strong>},<br>        <strong>&#39;:v2&#39;</strong>: {<strong>S</strong>: <strong>&#39;a&#39;</strong>},<br>    }</pre><pre><em>    // key filter(id1) is mandatory, sort1 is optional<br></em>    <strong>let </strong>KeyFilterExpression = <strong>&#39;id1 = :v1 and sort1 = :v2&#39; </strong><em><br>    </em><strong>var </strong>params = {<br>        <strong>TableName</strong>: table,<br>        <strong>Limit</strong>: limit,<br>        <strong>ProjectionExpression</strong>: fields,        <em><br>        </em><strong>ExpressionAttributeValues</strong>: filterValues,  <em><br>        </em><strong>KeyConditionExpression</strong>: KeyFilterExpression   <em><br>    </em>}<br><br>    <strong>while </strong>(keepWork) {   <em>//loop to get all results (paging)<br>        </em>[rows, keepWork] =  <strong>await new </strong><em>Promise</em>((resolved) =&gt; {<br>            dynamoDB.query(params, (err, data) =&gt; {<br>                <strong>if </strong>(err) {<br>                    <strong><em>console</em></strong>.error(err);<br>                    <strong>throw </strong>err;<br>                }<br>                <strong><em>Array</em></strong>.prototype.push.apply(totalRows, data.Items)<br>                keepWork = data.LastEvaluatedKey;<br>                <strong>if </strong>(keepWork){<br>                  params.<strong>ExclusiveStartKey </strong>=   data.LastEvaluatedKey<br>                }<br>                resolved([data,keepWork])<br>            });<br>        })<br>        totalRowsCount+= rows.<strong>Items</strong>.<strong>length<br>    </strong>}<br>    <strong><em>console</em></strong>.log(totalRows)<br>})</pre><p>2. query with index and sort:</p><pre><em>// select id1, sort1, id2 from testTable where id1=&#39;a&#39; and sort1=&#39;a&#39;<br>// using dyamoDB query, index filter<br></em><strong><em>it</em></strong>(<strong>&quot;dynamo basic query - index&quot;</strong>, <strong>async </strong>() =&gt; {<br>    <strong>this</strong>.<strong>AWS </strong>= <strong><em>require</em></strong>(<strong>&#39;aws-sdk&#39;</strong>);<br>    <strong>this</strong>.<strong>AWS</strong>.<strong>config</strong>.<strong>region </strong>= <strong>&#39;us-west-1&#39;</strong>;<br>    <strong>let </strong>dynamoDB = <strong>new </strong>AWS.DynamoDB();<br><br>    <strong>let </strong>table = <strong>&quot;testTable&quot;</strong>;<br>    <strong>let </strong>totalRowsCount = 0;<br>    <strong>let </strong>totalRows = [];<br>    <strong>let </strong>[rows, keepWork] = [<strong>null</strong>,<strong>true</strong>];<br>    <strong>let </strong>limit = 1000;<br><br>    <em>// for fields list<br>    </em><strong>let </strong>fields = <strong>&quot;id1, sort1, id2&quot;</strong>;<br><br>    <em>// for the query filter &quot;where&quot;<br>    </em><strong>let </strong>filterValues = {                             <em><br>        </em><strong>&#39;:v1&#39;</strong>: {<strong>S</strong>: <strong>&#39;a&#39;</strong>},<br>        <strong>&#39;:v2&#39;</strong>: {<strong>S</strong>: <strong>&#39;a&#39;</strong>},<br>    }</pre><pre><em>// index key filter(id2) is mandatory, sort2 is optional</em>    <strong>let </strong>IndexFilterExpression = <strong>&#39;id2 = :v1 and sort2 = :v2&#39; </strong><em><br>    </em><strong>var </strong>params = {<br>        <strong>TableName</strong>: table,<br>        <strong>Limit</strong>: limit,<br>        <strong>IndexName</strong>: <strong>&#39;id2-sort2-index&#39;</strong>,               <em><br>        </em><strong>ProjectionExpression</strong>: fields,                <em><br>        </em><strong>ExpressionAttributeValues</strong>: filterValues,    <em><br>        </em><strong>KeyConditionExpression</strong>: IndexFilterExpression <em><br>    </em>}<br><br>    <strong>while </strong>(keepWork) {     <em>//loop to get all results (paging)<br>        </em>[rows, keepWork] =  <strong>await new </strong><em>Promise</em>((resolved) =&gt; {<br>            dynamoDB.query(params, (err, data) =&gt; {<br>                <strong>if </strong>(err) {<br>                    <strong><em>console</em></strong>.error(err);<br>                    <strong>throw </strong>err;<br>                }<br>                <strong><em>Array</em></strong>.prototype.push.apply(totalRows, data.Items)<br>                keepWork = data.LastEvaluatedKey;<br>                <strong>if </strong>(keepWork){<br>                  params.<strong>ExclusiveStartKey </strong>=   data.LastEvaluatedKey<br>                }<br>                resolved([data,keepWork])<br>            });<br>        })<br>        totalRowsCount+= rows.<strong>Items</strong>.<strong>length<br>    </strong>}<br>    <strong><em>console</em></strong>.log(totalRows)<br>})</pre><p>3. scan:</p><pre><em>// select id1, sort1, id2 from testTable where id1=&#39;a&#39; and sort1=&#39;a&#39;<br>// using dynamoDB scan API<br></em><strong><em>it</em></strong>(<strong>&quot;dynamo basic scan&quot;</strong>, <strong>async </strong>() =&gt; {<br>    <strong>this</strong>.<strong>AWS </strong>= <strong><em>require</em></strong>(<strong>&#39;aws-sdk&#39;</strong>);<br>    <strong>this</strong>.<strong>AWS</strong>.<strong>config</strong>.<strong>region </strong>= <strong>&#39;us-west-1&#39;</strong>;<br>    <strong>let </strong>dynamoDB = <strong>new </strong>AWS.DynamoDB();<br><br>    <strong>let </strong>table = <strong>&quot;testTable&quot;</strong>;<br>    <strong>let </strong>totalRowsCount = 0;<br>    <strong>let </strong>totalRows = [];<br>    <strong>let </strong>[rows, keepWork] = [<strong>null</strong>,<strong>true</strong>];<br>    <strong>let </strong>limit = 1000;<br><br>    <em>// for fields list<br>    </em><strong>let </strong>fields = <strong>&quot;id1, sort1, id2&quot;</strong>;<br><br>    <em>// for the query filter &quot;where&quot;<br><br>    </em><strong>let </strong>filterValues = {      <em><br>        </em><strong>&#39;:v1&#39;</strong>: {<strong>S</strong>: <strong>&#39;a&#39;</strong>},<br>        <strong>&#39;:v2&#39;</strong>: {<strong>S</strong>: <strong>&#39;a&#39;</strong>},<br>    }<br>    <strong>let </strong>FilterExpression = <strong>&#39;id1 = :v1 and sort1 = :v2&#39;<br><br>    var </strong>params = {<br>        <strong>TableName</strong>: table,<br>        <strong>Limit</strong>: limit,<br>        <strong>ProjectionExpression</strong>: fields,        <em><br>        </em><strong>ExpressionAttributeValues</strong>: filterValues,  <em><br>        </em><strong>FilterExpression</strong>: FilterExpression     <em><br>    </em>}<br><br>    <strong>while </strong>(keepWork) {       <em>//loop to get all results (paging)<br>        </em>[rows, keepWork] =  <strong>await new </strong><em>Promise</em>((resolved) =&gt; {<br>            dynamoDB.scan(params, (err, data) =&gt; {<br>                <strong>if </strong>(err) {<br>                    <strong><em>console</em></strong>.error(err);<br>                    <strong>throw </strong>err;<br>                }<br>                <strong><em>Array</em></strong>.prototype.push.apply(totalRows, data.Items)<br>                keepWork = data.LastEvaluatedKey;<br>                <strong>if </strong>(keepWork){<br>                  params.<strong>ExclusiveStartKey </strong>=   data.LastEvaluatedKey<br>                }<br>                resolved([data,keepWork])<br>            });<br>        })<br>        totalRowsCount+= rows.<strong>Items</strong>.<strong>length<br>    </strong>}<br>    <strong><em>console</em></strong>.log(totalRows)<br>})</pre><p>The three long functions shown above are DynamoDB’s cumbersome way of executing the following three simple SQL queries:</p><ul><li><em>select id1, sort1, id2 from testTable where </em><strong><em>id1 </em></strong><em>= ‘a’ and </em><strong><em>sort1 </em></strong><em>= ‘a’</em></li><li><em>select id1, sort1, id2 from testTable where </em><strong><em>id2 </em></strong><em>= ‘a’ and </em><strong><em>sort2</em></strong><em> = ‘a’</em></li><li><em>select id1, sort1, id2 from testTable where </em><strong><em>id4 </em></strong><em>= ‘a’ and </em><strong><em>sort1</em></strong><em> = ‘a’</em></li></ul><h3>Conclusion:</h3><p>Dynamo is great noSQL solution but it’s keys/indexes logic wouldn’t be as trivial if you could use SQL. The APIs are too long and complicated as well.</p><p>My wish list from DynamoDB is the following:</p><p>1. Simplify the APIs using <strong>SQL syntax</strong></p><p>2. Do the best effort (behind the scene!!) to use<strong> Query</strong> and if there are no other options, return the results using <strong>Scan</strong>. Automatically do all the keys, indexes, and sort logic for me as well.</p><p>3. Allow all relational DB functionalities:</p><p><strong>a</strong>. Aggregation functions like <strong>count</strong>, <strong>min</strong>, <strong>max</strong>…, <strong>group by </strong>and <strong>order by…</strong></p><p><strong>b</strong>. Allow <strong>JOIN</strong> two different DynamoDB tables within and across regions.</p><p><strong>c</strong>. Allow <strong>UNION </strong>of query results from different DynamoDB tables<strong> </strong>and regions</p><p><strong>d</strong>. Connect to a DynamoDB using a standard <strong>MySQL client</strong></p><p>Believe it or not, <strong>all of this is</strong> <strong>possible!</strong> But this is for Part II and III of this series .</p><p>Can’t wait? Want a hint? <a href="http://bit.ly/2Jw385X"><strong>superQuery</strong></a> is doing this magic!</p><p>Stay tuned!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*RSB2zY80W6ET6SOM16bebA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=371288a7cb8f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/dynamodb-query-vs-scan-sql-syntax-and-join-tables-part-1-371288a7cb8f">DynamoDB: Query vs Scan, SQL syntax and JOIN tables — Part 1</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to control asynchronous invocations of your AWS Lambda functions]]></title>
            <link>https://medium.com/hackernoon/how-to-control-asynchronous-invocations-of-your-aws-lambda-functions-ad2def033222?source=rss-617f1a037d01------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad2def033222</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[asynchronous-invocation]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws-lambda-functions]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Amos Shahar]]></dc:creator>
            <pubDate>Mon, 09 Jul 2018 08:07:02 GMT</pubDate>
            <atom:updated>2019-05-15T06:15:40.731Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*roedigbmFjRYkZobdZWuKg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/8OyKWQgBsKQ?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/search/photos/coding?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>The Problem</h3><p>I have a serverless process that runs in a row — one Lambda runs and before it ends, it invokes another Lambda. Due to rate limits and other errors, I needed to know if the invocation was successful, but I didn’t want to wait until the new Lambda ended. This was challenging.</p><p>The other annoying thing was that the number of running Lambdas was increasing out of control, even though I should have one Lambda alive at a time (maybe two, because I start a new Lambda and only then close the current one — an overlap of few milliseconds).</p><h3>The Solution</h3><p>There are two types of lambda invocations: Sync (“RequestResponse”) and Async (“Event”).</p><p>Initially, I started with the <a href="https://hackernoon.com/tagged/async">Async</a> option as I didn’t want to wait for the new Lambda to end. It turns out that <a href="https://hackernoon.com/tagged/aws">AWS</a> adds this invocation request to a queue and you have no idea whether it was invoked successfully. Furthermore, if the invocation failed then AWS may re-run it again..</p><p>My next attempt was with the Sync invocation. In order to know if the Lambda invocation succeeded, I needed to wait for the new Lambda to end. So I used a little trick:</p><ol><li>Invoke Sync Lambda</li><li>Wait for a second</li><li>After one second, of three things happened:</li><li>I got a successful invocation from AWS within a second (meaning that the new lambda ran for less than a second — not likely to happen)</li><li>I got an error from AWS</li><li>A timeout occurred, so I assume that invocation was successful. The new Lambda is running, but I no longer wait for it.</li></ol><h3>Important notes from my experience:</h3><ol><li>If a timeout occurred, I assumed that invoke was successful and continued with my code <strong>BUT</strong> at some point in time the new function will end and reply with a real success or failure response. You must prepare your code to handle it. You may get two flows instead of one — watch out!</li><li>Same scenario as the previous, but this time the first Lambda is over before the invoked one replies with an answer — AWS will consider the invocation as failed and re-run the Lambda!</li><li>Lambda socket timeout: If Lambda A invokes a new Lambda B in a synchronous way (<strong>“RequestResponse”</strong>), it will wait for it to end according to the Lambda socket timeout <strong>(lambda.Config.httpOptions = {timeout: 1500};)</strong> — even if your code is over and you replied with 200 or 500 response!</li><li>You can force Lambda to end and not wait for the socket timeout with:<strong> “context</strong>.<strong>callbackWaitsForEmptyEventLoop </strong>= <strong>false</strong>;” — note that you will get an error message when the invoked lambda ends (B) and it will re-invoke in this case too.</li></ol><h3>Conclusion</h3><ul><li>I wanted to know whether Lambda invoked successfully, but I could not find a straightforward solution. You need to use a Sync invocation and “hack” the system.</li><li>Be aware of additional invocations when AWS considers your Lambda as failed just because you didn’t wait for its response.</li><li>Your Lambda function will be invoked multiple times — your code should be idempotent — code logic should know how to handle multiple invocation with the same input (event).</li></ul><p><strong>Other solutions that not discussed in this post:</strong></p><ul><li>Lambda Dead Letter Queue — where a failed lambda is inserted to a queue that needs to be managed, the retry invocation on error is still happening in this case.</li><li>Use an external DB to manage your invocation. For example, increment a dynamo counter when Lambda starts and decrease it when it ends.</li></ul><p><a href="https://www.linkedin.com/in/amos-shahar-483b182/"><em>Amos Shahar</em></a><em> is Director of DevOps &amp; IT at </em><a href="https://chrome.google.com/webstore/detail/superquery-bigquery-optim/lfckfngaeoheoppemkocjjebloiamfdc/reviews?hl=en"><strong><em>superQuery</em></strong></a><em>. Via our SQL IDE for Google BigQuery, superQuery uses AI and smart caching to enable data teams to run the most efficient and cost-effective queries on Google BigQuery.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad2def033222" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-to-control-asynchronous-invocations-of-your-aws-lambda-functions-ad2def033222">How to control asynchronous invocations of your AWS Lambda functions</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>