<?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 Hirudinee Liyanage on Medium]]></title>
        <description><![CDATA[Stories by Hirudinee Liyanage on Medium]]></description>
        <link>https://medium.com/@hirudineel?source=rss-e00d5d7eae6f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*EdDt2BL5hBYi05BNg1kQFg.jpeg</url>
            <title>Stories by Hirudinee Liyanage on Medium</title>
            <link>https://medium.com/@hirudineel?source=rss-e00d5d7eae6f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:25:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hirudineel/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[Try out a Serverless Framework example on your browser.]]></title>
            <link>https://medium.com/@hirudineel/try-out-a-serverless-framework-example-on-your-browser-1361f934b789?source=rss-e00d5d7eae6f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1361f934b789</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[serverless-framework]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[sigma-ide]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Hirudinee Liyanage]]></dc:creator>
            <pubDate>Thu, 29 Aug 2019 10:36:06 GMT</pubDate>
            <atom:updated>2019-09-06T08:40:40.762Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*duiAdFFsBeLdI5mNiwbzJg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jruscello?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jessica Ruscello</a> on <a href="https://unsplash.com/search/photos/frames?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Have you ever wanted to try out a serverless project, without any installations or configurations, so you can just get a taste of what serverless is. Well, I have! For a beginner, creating a serverless project from a scratch maybe a little too much. Let me tell you the good news. There is a browser-based cloud IDE (✨ <a href="https://slappforge.com/sigma#utm_source=hirudineeliyanage-medium&amp;utm_medium=blog&amp;utm_campaign=serverless-on-your-browser">Sigma IDE</a> ✨) which has the capability of importing an AWS based Serverless Framework project and deploying it to the cloud. No terminal commands, no installations, and no bad news!!</p><h3>Let’s get started.</h3><p>First things first. You need to have a</p><ul><li>Sigma IDE account (Log in or create one <a href="https://sigma.slappforge.com/#/signin&amp;utm_source=hirudineeliyanage-medium&amp;utm_medium=blog&amp;utm_campaign=serverless-on-your-browser">here</a>)</li><li>GitHub / BitBucket account and,</li><li>AWS credentials (duh obviously) (If you don’t have an AWS account, create one <a href="https://aws.amazon.com/console/">here</a>)</li></ul><p>Serverless Framework example we are going to try out is <a href="https://github.com/serverless/examples/tree/master/aws-node-github-webhook-listener"><strong>aws-node-github-webhook-listener</strong></a>.</p><h3>Step 1: Import Serverless Framework project.</h3><p>Importing a serverless framework project is as simple as 1 2 3!</p><ol><li>Login to your Sigma Account and go to the project creation page.</li><li>Copy and paste the Serverless project link. We are using <strong>aws-node-github-webhook-listener </strong>sample ( <a href="https://github.com/serverless/examples/tree/master/aws-node-github-webhook-listener">https://github.com/serverless/examples/tree/master/aws-node-github-webhook-listener</a> )</li><li>Click on the little thunderbolt ⚡.</li></ol><p>That’s it!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qZxC_hllf6pHam-r" /></figure><h3>Step 2: What is this Sample?</h3><p>In this sample, a given GitHub activity (in my case when there is an update relates to repo issues ) will trigger a GitHub webhook, and send a POST request to an API Gateway endpoint. That API endpoint will act as a trigger to your lambda function. Here is the image I took from the sample</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZlRJ8YyYcIe499yh" /></figure><h3>Step 3: Click on the Deploy icon.</h3><p>Yes! Go ahead and click on the <strong>Deploy</strong> icon on sigma. This will create the API Gateway endpoint and deploy the lambda to your AWS account. If all went right, you will get a URL of your API endpoint. Copy it, we need it for our next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1APYYsP6qhuFIDVA" /></figure><h3>Step 4: Creating GitHub webhook</h3><p>Now we have done the AWS part, what left is to create the GitHub webhook. Log in to your GitHub account. Go to the repository. I am using the repository I created for this sample. Click on Settings → Webhooks → Add Webhook.</p><p>Remember the API Gateway output URL you copied? Ah, now paste it to the<strong> Payload URL.</strong> I changed the content type to <strong>application/JSON</strong> and gave a <strong>Secret</strong>. Under the individual events, I ticked <strong>Issues </strong>and <strong>Issue comments</strong> and unmarked <strong>Pushes</strong>. Then I clicked on the<strong> Add Webhook </strong>icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H8vvTV30adbL3kRL" /></figure><p>Yaay!! Our webhook is ready. And we deployed the Lambda. Everything should work fine now, right??</p><p>Okay. Let’s see what will happen if the webhook is triggered. When you clicked on the <strong>Add Webhook</strong> icon, a test request has already been sent to the <strong>Payload URL</strong>. To check that click on the <strong>Edit</strong> icon of the webhook and check <strong>Recent Deliveries.</strong></p><p>I’ve got something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gBGY_HZ2e---FaZN" /></figure><p>What went wrong??</p><h3>Step 5: Editing Sample configuration.</h3><p>The error message says X-Hub-Signature incorrect. Github webhook token doesn&#39;t match</p><p>Hmmm… Remember, we did not edit anything in the initial sample when we deployed the project.</p><p>So go back to the Sigma console. We have to update the GitHub webhook secret here. Click on <strong>Environment Variable</strong> icon and update the secret you gave when you were creating the GitHub webhook. You don’t want to persist your secret to the GitHub, so remember to click on the toggle icon next to the variable name before you save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UEOR2VAmeKXn3xzg" /></figure><p>And redeploy the project.</p><p>Now go back to <strong>Recent Deliveries</strong> of your created webhook and click on the <strong>Redeliver</strong> icon.</p><p>Woah!! You’ll get a nice green color 200 response just like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yOroISwMACavMq-v" /></figure><p>Now let’s check the <strong>SigmaTrail</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_-YJixbpd5T3kbAr" /></figure><p>As you can see, console logs and errors( if there are any), will be printed on the <strong>SigmaTrail</strong>, real-time. There you can find the logs relates to the recent lambda execution.</p><h3>Explore more…</h3><p>Now If you want, you can change the code on Sigma and try out a use case for this. Or add an actual issue to the repository and check what will be on the console log. You must have already noticed that the ‘action’ is printed as undefined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TWSbtQZjOaWWlg5y" /></figure><p>See what you can do about it!! Try out more and explore more, so you can learn more! 😊</p><h3>Final thoughts.</h3><p>You have just tried out a serverless project. How incredible it is that you can get this experience using a cloud IDE with a few simple steps. There are many projects and samples based on the Serverless Framework for you to try out on Sigma. While Sigma IDE supports most of them, there are some projects which Sigma does not support yet. But no worries, they will be supported soon and in the meantime, you have plenty to try out.. Keep an eye on the newest <a href="https://slappforge.com/product-updates#utm_source=hirudineeliyanage-medium&amp;utm_medium=blog&amp;utm_campaign=serverless-on-your-browser">Sigma IDE</a> features, <a href="https://slappforge.com/#utm_source=hirudineeliyanage-medium&amp;utm_medium=blog&amp;utm_campaign=serverless-on-your-browser">SLAppForge</a> team is working on Enhancements and Updates for you to give the best serverless experience possible.</p><p><em>Originally published at </em><a href="https://hirudineeliyanage.wordpress.com/2019/08/29/try-out-a-serverless-framework-example-on-your-browser/"><em>http://hirudineeliyanage.wordpress.com</em></a><em> on August 29, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1361f934b789" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starting my Python journey with a Serverless application]]></title>
            <link>https://medium.com/@hirudineel/starting-my-python-journey-with-a-serverless-application-bfd77e4da47e?source=rss-e00d5d7eae6f------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfd77e4da47e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[sigma-ide]]></category>
            <category><![CDATA[slappforge]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Hirudinee Liyanage]]></dc:creator>
            <pubDate>Wed, 24 Jul 2019 12:12:46 GMT</pubDate>
            <atom:updated>2019-07-30T03:41:48.962Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rb4ZseCb4wRnAkLZiWMv0A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ralics?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Christopher Rusev</a> on <a href="https://unsplash.com/search/photos/python-journey?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I have never written a single line of code in Python. But I managed to write my AWS lambda function in Python, and deploy my AWS serverless application in no time!!</p><h4>To follow the rest of the blog:</h4><p>You should have:</p><ul><li>AWS account keys (You can create one <a href="https://aws.amazon.com/">here</a>)</li><li>GitHub or BitBucket account (You can create a free account. <a href="https://github.com/join?source=header-home">GitHub </a>or <a href="https://bitbucket.org/account/signup/">BitBucket</a>)</li><li>Sigma IDE account (The coolest web-based IDE for serverless application development. Create one <a href="https://sigma.slappforge.com/#/signup">here</a>; it’s totally free!)<br>and…</li><li>zero Python knowledge</li></ul><p>You should know:</p><ul><li>your way around AWS serverless development.</li></ul><h4>Background</h4><p>About a month ago, I started my work on Sigma after a year-long break. <a href="https://sigma.slappforge.com/">Sigma IDE</a> — as I knew it — has changed a lot. From new resources and triggers to a cool new dashboard, SLAppForge team has done some awesome upgrades to it. Support for Python was one of those major upgrades, and I was so excited to try it out.</p><p>Well, there was one issue though, I have never tried Python before!!! Python has had a <a href="https://stackoverflow.blog/2017/09/06/incredible-growth-Python/">significantly high growth </a>during the last decade compared to other mainstream programming languages. Python covers a <a href="https://www.python.org/about/apps/">large area of application domains </a>from simple web development to scientific and numeric computing. So what better time for me to dive into the world of Python than now!!</p><h4>Creating my first Python lambda function</h4><p>If you have the tiniest interest in serverless application development, Sigma IDE is something you should try out today. Lucky for me, I already have an account in Sigma IDE (you can create one ) and I have logged in to the IDE.</p><p>This is your Sigma editor’s view on the startup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*U25aq3lHD_QM6fgs" /></figure><p>The default Sigma project creates a lambda function file in NodeJS. But for this blog, we want the function file in Python. So I navigated to <strong>Project</strong> tab on the left-hand side, clicked on the plus icon next to the project folder and clicked <strong>New Python Function File</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*LWXLmYvimd5g6LC_" /></figure><p>I gave a name to my function ( MyfirstPython ) , then had to select a Python version for my function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*3jxK27uOWWayFDz3" /></figure><h4>Why two different versions of Python??</h4><p>Before even creating my Python function file, I ran into my first question. Remember, this is me taking a deep dive into Python with zero prior knowledge. So I just googled “Python 2.7 and 3.6” and read some interesting articles (like <a href="https://wiki.python.org/moin/Python2orPython3">Python2orPython3 </a>and <a href="https://learntocodewith.me/programming/Python/Python-2-vs-Python-3/">Python 2 vs Python 3 </a>)</p><blockquote><em>“ </em>Python 2.x is legacy, Python 3.x is the present and future of the language <em>“</em></blockquote><blockquote><a href="https://wiki.python.org/moin/Python2orPython3"><em>wiki.Python.org</em></a></blockquote><p>I decided to go with Python 3.6. But there may be scenarios where the user needs to create Python functions in 2.7. If so, the user can easily select version 2.7 instead of 3.6.</p><h4>Wait, what is __int__.py?</h4><p>Okay, now I have created my function file, and it is under the project folder. But wait a minute, there is another Python file, __int__.py. What is that!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*v3uMibLjcPR_3JhG" /></figure><p>I did not add anything like that!!</p><p>So again, here comes the google search. As usual, Stack Overflow for the rescue! According to this <a href="https://stackoverflow.com/questions/448271/what-is-init-py-for">answer</a> it used to be a required part of a regular package, but newer <em>namespaced packages</em> don’t need it anymore. So I kept the __int__.py file as it is, and moved on to the important Python file, MyfirstPython.py.</p><h4>What’s on the Python function file</h4><p>Python function file is created with the following initial code snippet.</p><pre>def handler(event, context):<br>   return {&quot;message&quot;: &quot;Successfully executed&quot;}</pre><p>I read <a href="https://docs.aws.amazon.com/lambda/latest/dg/Python-programming-model-handler-types.html">AWS documents </a>for the lambda function handler in Python. Since I already have the above code snippet, I quickly edited it, so when the lambda is called, it returns and from the event as a message.</p><pre>def handler(event, context):<br>    message = &#39;Hello {} {}!&#39;.format(event[&#39;first_name&#39;],<br>                                    event[&#39;last_name&#39;])  <br>    return {<br>        &#39;message&#39; : message<br>    }</pre><h4>My first Python keywords</h4><p>I did a quick lookup for the two keywords that were already in the created function file. In Python, a function is defined using the def keyword. The return keyword is to exit a function and return a value (<a href="https://www.w3schools.com/Python/Python_ref_keywords.asp">W3schools</a>)</p><h4>Creating a Lambda trigger</h4><p>Now I am ready to create our serverless application. My scenario is when a user makes an API call, He gets a response with the current time.</p><p>First things first, I need to create the API trigger. Navigate to the <strong>Resources</strong> pane on the left-hand side. First resource on the AWS resource list is <strong>API Gateway</strong>. All you have to do is: drag and drop the API resource on to theevent parameter of the handler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*o3e0Fw4Xz8E-isGm" /></figure><p>Let’s create a new API. Give a name to your API ( Pythontest ). Give a resource path (/test/currenttime) and select the POST method. I enabled CORS, gave Test as the deployment stage, and Inject the trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*xWp2ly-v3KyVBkEB" /></figure><p>That’s it. With Sigma IDE you don’t have to log in to AWS console to create the trigger or add it to the lambda function. Once you have configured the API on the IDE, the rest will be taken care of by Sigma when you deploy the project to AWS. You can click on the little icon next to the def keyword (trigger config icon) if you want to change or update the trigger you have added.</p><h4>Returning the current time</h4><p>I have already edited the function to return and first_name last_name from the event. I did a little change to the code so the function returns the current time when the user calls the API. Needless to say, had to take a look around the internet and below is my final handler code.</p><pre>import datetime<br><br>def handler(event, context):<br>   current_time = datetime.datetime.now().time()<br>   message = &#39;Hello {} {}! The time is &#39;.format(event[&#39;first_name&#39;],<br>                                   event[&#39;last_name&#39;])<br>   return {<br>       &#39;message&#39; : message + str(current_time)<br>   }</pre><p>Side Note: I was not able to get my code to work the first time around. (duh, obviously!!) So I had to test the function a couple of times before I could finally get the function to return the message I wanted. Inside Sigma IDE I wrote and ran tests in just a few clicks, which saved me a lot of trouble. Sigma gives you rich Testing and Debugging functionality for your serverless application. I will come back to that in another post.</p><h4>I am ready to deploy!</h4><p>Well, I have created our trigger and lambda function. All left to do is deploy the function to AWS. Navigate to the toolbar and click on the <strong>Deploy Project</strong> Icon. Sigma IDE saves your Sigma project to GitHub or BitBucket, then build the project and finally deploy it to AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*m0KWSo_n9_MqBbL-" /></figure><p>If everything went okay, after the deployment you should get a Changes summary like the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*KkxlK1gZbOtukADI" /></figure><p>Copy the output URL (You can find it at the end of Changes summary pop-up or by clicking on <strong>Project Info</strong> icon on the toolbar) and, using an HTTP client (I used the inbuilt HTTP client, inside the Sigma IDE ), send a POST request to the API endpoint. Below is the request body you should send.</p><pre>{<br>   &quot;first_name&quot;: &quot;Johnny&quot;,<br>   &quot;last_name&quot;: &quot;Depp&quot;<br>}</pre><p>And I got a nice response like this, with a greeting and the time.</p><pre>{ &quot;message&quot;: &quot;Hello Johnny Depp! The time is 07:34:30.905913&quot; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*8gwvxMKecR9Q1bYI" /></figure><h4>Final Thoughts</h4><p>Yeah!! I managed to deploy a lambda written in Python and execute it successfully, without any Python knowledge. Since I now have a taste of the language, I am more excited to learn and try out Python in a proper way. Below are some of the resources/ tutorials I found useful.</p><p><a href="https://www.python.org/about/gettingstarted/">https://www.python.org/about/gettingstarted/</a> <a href="https://developers.google.com/edu/Python/">https://developers.google.com/edu/Python/</a> <a href="https://www.codecademy.com/learn/learn-Python-3">https://www.codecademy.com/learn/learn-Python-3</a></p><p><em>Originally published at </em><a href="https://thesunnysidestories.wordpress.com/2019/07/24/starting-my-python-journey-with-a-serverless-application/"><em>http://thesunnysidestories.wordpress.com</em></a><em> on July 24, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfd77e4da47e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>