<?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 Gökhan Olgun on Medium]]></title>
        <description><![CDATA[Stories by Gökhan Olgun on Medium]]></description>
        <link>https://medium.com/@gkhno?source=rss-684c8cf88a5f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7EJQ-poMevXQOv36QOgo2w.jpeg</url>
            <title>Stories by Gökhan Olgun on Medium</title>
            <link>https://medium.com/@gkhno?source=rss-684c8cf88a5f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:55:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gkhno/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[Serverless application development with Node.js on AWS platform using Serverless framework]]></title>
            <link>https://itnext.io/serverless-application-development-with-node-js-on-aws-platform-using-serverless-framework-63e79fcf9409?source=rss-684c8cf88a5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/63e79fcf9409</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Gökhan Olgun]]></dc:creator>
            <pubDate>Fri, 13 Dec 2019 13:45:46 GMT</pubDate>
            <atom:updated>2019-12-13T13:45:46.577Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we will <strong>create and deploy a serverless Node.js application</strong> on the <strong>AWS</strong> platform using various <strong>AWS services </strong>such as <strong>Lambda</strong>, <strong>Layers</strong>, <strong>DynamoDB</strong>, <strong>API Gateway</strong> using the <a href="https://serverless.com/"><strong>Serverless framework</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FE3KE3VOqec44eXbmWFBzw.png" /><figcaption>source: <a href="https://serverless.com/">http://serverless.com</a></figcaption></figure><p>Let’s install the Serverless framework first.</p><pre>sudo npm install -g serverless</pre><p>After installation is complete, <strong>you need to configure your AWS credentials</strong>. You can find the needed information below:</p><p><a href="https://serverless.com/framework/docs/providers/aws/guide/credentials/">Serverless Framework - AWS Lambda Guide - Credentials</a></p><p>I’ll go with the aws configure option to keep things simple for now but I <strong>strongly recommend you to use <em>IAM roles</em></strong> instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*gI3Zqq2bQnT4lP7Wwum9Ww.png" /><figcaption>AWS SDK configuration</figcaption></figure><p>After completing the configuration you can test the Serverless framework with the following commands.</p><p>Create a new service using aws-nodejs template:</p><pre>sls create --template aws-nodejs --path myService</pre><p>Serverless CLI will create an empty hello world service for you with a serverless.yml and handler.js which <a href="https://serverless.com/framework/docs/providers/aws/examples/hello-world/node/">you can test</a> your serverless configuration.</p><p>What we’re going to do is creating a serverless application from scratch and deploying it to the AWS platform.</p><p>First, create serverless.yml file in the root of your project directory.</p><p>Let’s start configuring our serverless application.</p><p>In this part of serverless.yml file, we define our service and provider resources we’re going to use. The provider is AWS in our case.</p><p>Add the following lines to serverless.yml file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf02d9afea835c903752b53fa856600d/href">https://medium.com/media/cf02d9afea835c903752b53fa856600d/href</a></iframe><p>We configured our service on dev stage and <strong>assigned the required permissions</strong> to access messages DynamoDB table; hence, we need to create messages table.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47d9debdb3228d2898c2393a5ce49a51/href">https://medium.com/media/47d9debdb3228d2898c2393a5ce49a51/href</a></iframe><p>Now it’s time to <strong>create our Lambda functions</strong>.</p><p>Create a functions directory in the root of your project directory and put the following JavaScript files in it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c65f694d8996f42f908d5de5c95853d/href">https://medium.com/media/4c65f694d8996f42f908d5de5c95853d/href</a></iframe><p>getMessages Lambda function will let us <strong>retrieve messages from our DynamoDB table.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c4dfec176f61c3ff340227f2649bdea/href">https://medium.com/media/1c4dfec176f61c3ff340227f2649bdea/href</a></iframe><p>putMessage Lambda function will let us <strong>put messages to our DynamoDB table.</strong></p><p>Now, we’re ready to configure our Lambda functions in serverless.yml file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/202571cb3a6dd394e9d2ef37ef0eb2fe/href">https://medium.com/media/202571cb3a6dd394e9d2ef37ef0eb2fe/href</a></iframe><p>We configured our function handlers and <strong>connected them to HTTP end-points using API Gateway.</strong></p><p>You probably noticed that we put a reference to our Layers within our application.</p><blockquote><strong>From AWS documentation:</strong></blockquote><blockquote>A <strong>layer</strong> is a ZIP archive that contains libraries, a <a href="https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html">custom runtime</a>, or other dependencies. <strong>With layers, you can use libraries in your function without needing to include them in your deployment package.</strong></blockquote><blockquote><strong>Important note about Layers:</strong></blockquote><blockquote>Your function can access the content of the layer <strong>during execution in the </strong><strong>/opt directory</strong>. Layers are applied in the order that&#39;s specified, merging any folders with the same name. If the same file appears in multiple layers, the version in the last applied layer is used.</blockquote><blockquote><a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html</a></blockquote><p>Now it’s time to configure our Layers.</p><p>Create layers/reverser directory in the root of your project directory and put the following JavaScript file in it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8bdc87c6764a6f79d7b5fb0332bb734/href">https://medium.com/media/a8bdc87c6764a6f79d7b5fb0332bb734/href</a></iframe><p>This is just a <strong>simple JavaScript module to reverse the input string</strong> that we’re going to use to test our Layers implementation.</p><p>Now, let’s add the following lines to serverless.yml file to configure Reverser Layer that we’ve just created.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f3bf3b88acd7fd6867aee7e34174d10/href">https://medium.com/media/5f3bf3b88acd7fd6867aee7e34174d10/href</a></iframe><blockquote><strong>Important note from AWS documentation:</strong></blockquote><blockquote>A function can <strong>use up to 5 layers at a time</strong>. The total unzipped size of the function and all layers <strong>can’t exceed</strong> the unzipped deployment package size <strong>limit of 250 MB</strong>. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">AWS Lambda Limits</a>.</blockquote><blockquote><a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html</a></blockquote><p>Finally, <strong>we’re ready to deploy our serverless application</strong> to the AWS platform by executing the following command in our terminal.</p><pre>sls deploy</pre><p>As a result of this execution, you should see a screen similar to the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*zfGfcHO9_Kjr5Ki2FV3GxA.png" /></figure><p>To test your application you can use endpoints stated in the output of <strong>your</strong> sls deploy or you can <strong>invoke your Lambda functions</strong> with sls CLI in the root directory of your project.</p><p>Let’s try with sls CLI.</p><pre>sls invoke -f putMessage --data &#39;{&quot;message&quot;:&quot;test message&quot;}&#39;</pre><p>And the result should be as following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*fW3K1-TaA-IIxLUzyzbOGg.png" /></figure><p>Now, let’s try to get the messages we put to messages table.</p><pre>sls invoke -f getMessage</pre><p>And the result should be as following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*GZiIG3tu6DrpUVVV_Bm12g.png" /></figure><p>Also, you can see your messages <strong>in your DynamoDB table</strong> on your <strong>AWS Console</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuM7K-6YmHdc8YWa2umlsA.png" /></figure><p>String reverse module worked well and the message in the table seems reversed.</p><p>You can find the project containing files used in this tutorial in the <a href="https://github.com/gkhn/ServerlessAppWithLayers">Github repository</a> below.</p><p><a href="https://github.com/gkhn/ServerlessAppWithLayers">gkhn/ServerlessAppWithLayers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63e79fcf9409" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/serverless-application-development-with-node-js-on-aws-platform-using-serverless-framework-63e79fcf9409">Serverless application development with Node.js on AWS platform using Serverless framework</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>