<?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: Peter Tao</title>
    <description>The latest articles on DEV Community by Peter Tao (@petersenpai).</description>
    <link>https://dev.to/petersenpai</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%2F516634%2Fa4b098f1-9f02-489c-91cc-486e2f25d282.png</url>
      <title>DEV Community: Peter Tao</title>
      <link>https://dev.to/petersenpai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/petersenpai"/>
    <language>en</language>
    <item>
      <title>Create your first serverless function using AWS Lambda and ExpressJs</title>
      <dc:creator>Peter Tao</dc:creator>
      <pubDate>Sat, 21 Nov 2020 10:15:08 +0000</pubDate>
      <link>https://dev.to/petersenpai/create-your-first-serverless-function-using-aws-lambda-and-expressjs-2820</link>
      <guid>https://dev.to/petersenpai/create-your-first-serverless-function-using-aws-lambda-and-expressjs-2820</guid>
      <description>&lt;p&gt;Converting your current backend to serverless functions might require tons of work but if you are using ExpressJs, there might be an easy way to do so.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In this article, I will walk you through the steps of converting your app to a lambda function in detail. &lt;/p&gt;

&lt;p&gt;Say you have an Express app that simply returns a quote of Kanye West from the &lt;code&gt;/data&lt;/code&gt; route.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
This is how your &lt;code&gt;app.js&lt;/code&gt; would look like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4tpqj7dw609juc4kyur7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4tpqj7dw609juc4kyur7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step One:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Install a useful &lt;a href="https://www.npmjs.com/package/aws-serverless-express" rel="noopener noreferrer"&gt;package&lt;/a&gt;. This is the only magic you need for your app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz7b05h1970nal4a11o4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz7b05h1970nal4a11o4c.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Two:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Modify your &lt;code&gt;app.js&lt;/code&gt; like this to use the middleware to get the event object that Lambda receives from the API Gateway.&lt;br&gt;
And do remember to export your app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F40w6t7yztheyqfscbnef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F40w6t7yztheyqfscbnef.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Three:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a new file called &lt;code&gt;lambda.js&lt;/code&gt; to wrap your express server as a lambda handler. This will configure a simple proxy API using Amazon API Gateway and integrate it with your Lambda function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy6gheeqe6zlfiv5qozwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy6gheeqe6zlfiv5qozwk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Four - Compress the files:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Compress all the files and folders (including &lt;code&gt;node_modules&lt;/code&gt;) in the root directory into a &lt;code&gt;.zip&lt;/code&gt; file (&lt;code&gt;myfunction.zip&lt;/code&gt; in this demo).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1w0kdokjbuyih6gxjzbn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1w0kdokjbuyih6gxjzbn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Five - Create your function:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Login to AWS and go to the Lambda page.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmppflnzxku45ej4flxvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmppflnzxku45ej4flxvy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Top right area, create a new function.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmop3b4zrju07r1834flu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmop3b4zrju07r1834flu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Fill out the basic info. Here I name the function as &lt;code&gt;myfunction&lt;/code&gt; and pick &lt;code&gt;Node.js&lt;/code&gt; as the runtime for obvious reasons.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F248vxa1k51ho4jyhl50n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F248vxa1k51ho4jyhl50n.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Create the function. This should redirect you to the function page.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx1j8ju3ywfjc5t7orde7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx1j8ju3ywfjc5t7orde7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Six - Configure your function:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Once you get into the function page, you can now setup your function.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
In the &lt;code&gt;Function Code&lt;/code&gt; section, upload your &lt;code&gt;.zip&lt;/code&gt; file. You may or may not see the actual code in the online editor as it depends on how big is your application.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgwrqfodjsrbyta5rz4df.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgwrqfodjsrbyta5rz4df.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Edit your &lt;code&gt;Runtime setting&lt;/code&gt; section. Change the handler/entry point to &lt;code&gt;lambda.lambdaHandler&lt;/code&gt;. The format should be: &lt;em&gt;[name of the file that has your handler].[name of your handler]&lt;/em&gt;.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs7msqqgnx5iv0kpg2vt5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs7msqqgnx5iv0kpg2vt5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Now you have your lambda function set up. However, you can not directly invoke it just yet. You need to configure your API Gateway to action like a middle man between your function and the public internet.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Seven - Create API GateWay:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Navigate to the API Gateway page.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgywxad51skte6niu03xe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgywxad51skte6niu03xe.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Start building a REST API.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw8kvtetjvdovhm7o6hz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw8kvtetjvdovhm7o6hz0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Fill out the info.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0rdx3f1oh0mdaxyayv1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0rdx3f1oh0mdaxyayv1k.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Eight - Create API GateWay Resource:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Click action to create a resource/route.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F68p0viqx6lsvezmeaxlw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F68p0viqx6lsvezmeaxlw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Name the resource/route the same as your express routes.&lt;br&gt;
Enable CORS.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr7lehprjmt7t8q8ssnzz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr7lehprjmt7t8q8ssnzz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Nine- Create Method for Resource:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Select the resource we just created and hit the action button to create a method for it.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Choose &lt;code&gt;GET&lt;/code&gt; method. It should be the same as your &lt;code&gt;/data&lt;/code&gt; route.&lt;br&gt;
And of course, you can create multiple methods under the same resource.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsekindgwb51f9ay64p07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsekindgwb51f9ay64p07.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Configure the method to connect to your lambda function.&lt;br&gt;
Put the right name and region of your Lambda function. Remember to enable the Lambda integration.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr71bmqwrz51gvz3ytc3o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr71bmqwrz51gvz3ytc3o.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step Ten - Deploy your API:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Click deploy API under the action button.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxioywvm6qdnpdluaq4k0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxioywvm6qdnpdluaq4k0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Create a new stage and give it a name such as 'prod', 'staging' or 'v1' in this case.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuaxf7liwcpg4kir4hx9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuaxf7liwcpg4kir4hx9y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
After that, navigate to the &lt;code&gt;stage&lt;/code&gt; panel and select the route under &lt;code&gt;v1&lt;/code&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F20t3168vto9dal1ej3bf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F20t3168vto9dal1ej3bf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
On the right-hand side, you can get the invoke link for this route.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6nwlgyw9og5j1860kqcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6nwlgyw9og5j1860kqcd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Test the route. Now we have a working function.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnix8ub6v8x9l0ok539d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnix8ub6v8x9l0ok539d4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Usage:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Personally, I don't suggest putting the entire backend logic on lambda, at least not in this way. The reason is that although Lambda function is quite fast nowadays, it still takes a second or two at &lt;a href="https://dashbird.io/blog/can-we-solve-serverless-cold-starts/#:~:text=What%20is%20a%20cold%20start,running%20to%20serve%20the%20invocation." rel="noopener noreferrer"&gt;cold start&lt;/a&gt;. But for functionalities like email service, automation pipeline, or image and video manipulation, it would be reasonable to separate them as serverless functions to mitigate the cost.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Of course, compressing and uploading the file every time you make a code change is silly. However, these just are some baby steps for people who want to try out lambda but have zero patience to deal with AWS (docs or UI). For a better development experience, you might want to use CloudFormation and SAM-cli which will be discussed in the next article.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>lambda</category>
      <category>express</category>
      <category>node</category>
    </item>
  </channel>
</rss>
