<?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 Sunil Udhayakumar on Medium]]></title>
        <description><![CDATA[Stories by Sunil Udhayakumar on Medium]]></description>
        <link>https://medium.com/@sunil.udhayakumar?source=rss-5e664db4071d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k9uQIuP7rP9FVmzP9ngnpQ.png</url>
            <title>Stories by Sunil Udhayakumar on Medium</title>
            <link>https://medium.com/@sunil.udhayakumar?source=rss-5e664db4071d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:22:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sunil.udhayakumar/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[Working with AWS Local Stack]]></title>
            <link>https://medium.com/@sunil.udhayakumar/working-with-aws-local-stack-c665f1224836?source=rss-5e664db4071d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c665f1224836</guid>
            <category><![CDATA[localstack]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sunil Udhayakumar]]></dc:creator>
            <pubDate>Sat, 11 May 2019 13:19:53 GMT</pubDate>
            <atom:updated>2019-07-11T14:38:10.580Z</atom:updated>
            <content:encoded><![CDATA[<h3>Local Stack and Two Smoking Barrels</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*KSdKEJwiubNwGe9IvwMdhw.png" /></figure><p>Local Stack is a useful tool, which allows for local development using the AWS cloud stack. In other words, it is a Mock AWS Stack with support for many of the infrastructure commonly coded against. Available services include S3, SQS, SNS, KINESIS, DYNAMODB, LAMBDA and API-GATEWAY.</p><h3>Pre-Requisite :</h3><ol><li>Docker</li><li>AWS CLI</li></ol><h3>Steps to set up :</h3><ol><li>Create a directory named <strong>local-stack</strong></li><li>Create a <strong>docker-compose.yml</strong> file inside the directory and paste the following code in the file</li></ol><pre>version: &#39;3&#39;</pre><pre>services:</pre><pre>localstack:</pre><pre>image: localstack/localstack</pre><pre>ports:</pre><pre>- &quot;4567-4584:4567-4584&quot;</pre><pre>- &quot;${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}&quot;</pre><pre>environment:</pre><pre>- SERVICES=${SERVICES- }</pre><pre>- DEBUG=${DEBUG- }</pre><pre>- DATA_DIR=${DATA_DIR- }</pre><pre>- PORT_WEB_UI=${PORT_WEB_UI- }</pre><pre>- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }</pre><pre>- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }</pre><pre>- DOCKER_HOST=unix:///var/run/docker.sock</pre><pre>volumes:</pre><pre>- &quot;/tmp/localstack:/tmp/localstack&quot;</pre><pre>- &quot;/var/run/docker.sock:/var/run/docker.sock&quot;</pre><p>3. Create a temp directory in your mac with the following convention : <em>/tmp/localstack</em></p><p>Navigate into the local-stack directory and run command : `<em>docker-compose up` .<br></em>You should see the following logs:</p><pre>KLS-00021:local-stack sunil.udhayakumar$ docker-compose up</pre><pre>Creating network &quot;local-stack_default&quot; with the default driver</pre><pre>Creating local-stack_localstack_1 ... done</pre><pre>Attaching to local-stack_localstack_1</pre><pre>localstack_1  | 2019-01-21 20:18:01,654 CRIT Supervisor running as root (no user in config file)</pre><pre>localstack_1  | 2019-01-21 20:18:01,658 INFO supervisord started with pid 1</pre><pre>localstack_1  | 2019-01-21 20:18:02,667 INFO spawned: &#39;dashboard&#39; with pid 8</pre><pre>localstack_1  | 2019-01-21 20:18:02,671 INFO spawned: &#39;infra&#39; with pid 9</pre><pre>localstack_1  | (. .venv/bin/activate; exec bin/localstack start)</pre><pre>localstack_1  | (. .venv/bin/activate; bin/localstack web)</pre><pre>localstack_1  | Starting local dev environment. CTRL-C to quit.</pre><pre>localstack_1  | 2019-01-21 20:18:03,779 INFO success: dashboard entered RUNNING state, process has stayed up for &gt; than 1 seconds (startsecs)</pre><pre>localstack_1  | 2019-01-21 20:18:03,780 INFO success: infra entered RUNNING state, process has stayed up for &gt; than 1 seconds (startsecs)</pre><pre>localstack_1  | 2019-01-21T20:18:03:INFO:werkzeug:  * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)</pre><pre>localstack_1  | 2019-01-21T20:18:03:INFO:werkzeug:  * Restarting with stat</pre><pre>localstack_1  | 2019-01-21T20:18:04:WARNING:werkzeug:  * Debugger is active!</pre><pre>localstack_1  | 2019-01-21T20:18:04:INFO:werkzeug:  * Debugger PIN: 960-688-885</pre><pre>localstack_1  | Starting mock API Gateway (http port 4567)...</pre><pre>localstack_1  | Starting mock DynamoDB (http port 4569)...</pre><pre>localstack_1  | Starting mock SES (http port 4579)...</pre><pre>localstack_1  | Starting mock Kinesis (http port 4568)...</pre><pre>localstack_1  | Starting mock Redshift (http port 4577)...</pre><pre>localstack_1  | Starting mock S3 (http port 4572)...</pre><pre>localstack_1  | Starting mock CloudWatch (http port 4582)...</pre><pre>localstack_1  | Starting mock CloudFormation (http port 4581)...</pre><pre>localstack_1  | Starting mock SSM (http port 4583)...</pre><pre>localstack_1  | Starting mock SQS (http port 4576)...</pre><pre>localstack_1  | Starting mock Secrets Manager (http port 4584)...</pre><pre>localstack_1  | Starting local Elasticsearch (http port 4571)...</pre><pre>localstack_1  | Starting mock SNS (http port 4575)...</pre><pre>localstack_1  | Starting mock DynamoDB Streams service (http port 4570)...</pre><pre>localstack_1  | Starting mock Firehose service (http port 4573)...</pre><pre>localstack_1  | Starting mock Route53 (http port 4580)...</pre><pre>localstack_1  | Starting mock ES service (http port 4578)...</pre><pre>localstack_1  | Starting mock Lambda service (http port 4574)...</pre><pre>localstack_1  | 2019-01-21T20:18:25:WARNING:infra.pyc: Service &quot;elasticsearch&quot; not yet available, retrying...</pre><pre>localstack_1  | 2019-01-21T20:18:29:WARNING:infra.pyc: Service &quot;elasticsearch&quot; not yet available, retrying...</pre><pre>localstack_1  | 2019-01-21T20:18:32:WARNING:infra.pyc: Service &quot;elasticsearch&quot; not yet available, retrying...</pre><pre>localstack_1  | 2019-01-21T20:18:36:WARNING:infra.pyc: Service &quot;elasticsearch&quot; not yet available, retrying...</pre><pre>localstack_1  | 2019-01-21T20:18:39:WARNING:infra.pyc: Service &quot;elasticsearch&quot; not yet available, retrying...</pre><pre>localstack_1  | 2019-01-21T20:18:42:WARNING:infra.pyc: Service &quot;elasticsearch&quot; not yet available, retrying...</pre><pre>localstack_1  | Ready.</pre><p>The console log also indicates the status of each service and their corresponding port number for access.</p><h3>Working with the Local Stack Services :</h3><p>The local stack resources can be accessed using aws cli and programatically by setting the end point url. It comes with a neat UI which lists the active resources and can be accessed using the end point : <a href="http://0.0.0.0:8080/">http://0.0.0.0:8080</a></p><h3>SQS</h3><h4>Create a queue</h4><pre>aws --endpoint-url=http://localhost:4576 sqs create-queue --queue-name dv_test_queue</pre><p><strong>Expected Output</strong></p><pre>KLS-00021:local-stack sunil.udhayakumar$ aws --endpoint-url=http://localhost:4576 sqs create-queue --queue-name dv_test_queue</pre><pre>{</pre><pre>&quot;QueueUrl&quot;: &quot;<a href="http://localhost:4576/queue/dv_test_queue%22">http://localhost:4576/queue/dv_test_queue&quot;</a></pre><pre>}</pre><p><strong>List Queues :</strong></p><pre>aws --endpoint-url=http://localhost:4576 sqs list-queues</pre><h3>S3</h3><h4>Create a bucket</h4><pre>aws --endpoint-url=http://localhost:4572 s3 mb s3://kinduct-ds-test</pre><h4>List bucket</h4><pre>aws --endpoint-url=http://localhost:4572 s3 ls</pre><p>Sync current directory data to bucket</p><pre>aws --endpoint-url=http://localhost:4572 s3 sync . s3://kinduct-ds-test</pre><h3>DYNAMODB</h3><h4>Create a table</h4><p><strong>Command</strong></p><pre>aws --endpoint-url=http://localhost:4569 dynamodb create-table --table-name foo_bar_table  --attribute-definitions AttributeName=first,AttributeType=S AttributeName=second,AttributeType=N --key-schema AttributeName=first,KeyType=HASH AttributeName=second,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5</pre><p><strong>Expected Output</strong></p><p><strong>console.log</strong></p><pre>KLS-00021:localstack sunil.udhayakumar$ aws --endpoint-url=http://localhost:4569 dynamodb create-table --table-name foo_bar_table  --attribute-definitions AttributeName=first,AttributeType=S AttributeName=second,AttributeType=N --key-schema AttributeName=first,KeyType=HASH AttributeName=second,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5</pre><pre>{</pre><pre>&quot;TableDescription&quot;: {</pre><pre>&quot;AttributeDefinitions&quot;: [</pre><pre>{</pre><pre>&quot;AttributeName&quot;: &quot;first&quot;,</pre><pre>&quot;AttributeType&quot;: &quot;S&quot;</pre><pre>},</pre><pre>{</pre><pre>&quot;AttributeName&quot;: &quot;second&quot;,</pre><pre>&quot;AttributeType&quot;: &quot;N&quot;</pre><pre>}</pre><pre>],</pre><pre>&quot;TableName&quot;: &quot;foo_bar_table&quot;,</pre><pre>&quot;KeySchema&quot;: [</pre><pre>{</pre><pre>&quot;AttributeName&quot;: &quot;first&quot;,</pre><pre>&quot;KeyType&quot;: &quot;HASH&quot;</pre><pre>},</pre><pre>{</pre><pre>&quot;AttributeName&quot;: &quot;second&quot;,</pre><pre>&quot;KeyType&quot;: &quot;RANGE&quot;</pre><pre>}</pre><pre>],</pre><pre>&quot;TableStatus&quot;: &quot;ACTIVE&quot;,</pre><pre>&quot;CreationDateTime&quot;: 1548185899.965,</pre><pre>&quot;ProvisionedThroughput&quot;: {</pre><pre>&quot;LastIncreaseDateTime&quot;: 0.0,</pre><pre>&quot;LastDecreaseDateTime&quot;: 0.0,</pre><pre>&quot;NumberOfDecreasesToday&quot;: 0,</pre><pre>&quot;ReadCapacityUnits&quot;: 5,</pre><pre>&quot;WriteCapacityUnits&quot;: 5</pre><pre>},</pre><pre>&quot;TableSizeBytes&quot;: 0,</pre><pre>&quot;ItemCount&quot;: 0,</pre><pre>&quot;TableArn&quot;: &quot;arn:aws:dynamodb:us-east-1:000000000000:table/foo_bar_table&quot;</pre><pre>}</pre><pre>}</pre><h4>List tables</h4><pre>aws --endpoint-url=http://localhost:4569 dynamodb list-tables</pre><p><strong>Scan table</strong></p><pre>aws --endpoint-url=http://localhost:4569 dynamodb scan --table-name foo_bar_table</pre><p>Local Stack is a great tool to work with AWS offerings without creating actual resources in cloud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c665f1224836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coolest way to deploy Lambda functions : Chalice]]></title>
            <link>https://medium.com/@sunil.udhayakumar/coolest-way-to-deploy-lambda-functions-chalice-ddd180af9786?source=rss-5e664db4071d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddd180af9786</guid>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[chalice]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sunil Udhayakumar]]></dc:creator>
            <pubDate>Wed, 27 Feb 2019 11:29:58 GMT</pubDate>
            <atom:updated>2019-02-27T14:41:02.766Z</atom:updated>
            <content:encoded><![CDATA[<p>Coolest way to deploy Lambda functions : Chalice</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-P0w5Fgk5Ixj_3IEmjAL7g.png" /></figure><p>So many ways to deploy lambda functions, aren&#39;t we all tired of compiling the libraries and packaging the lambda functions manually . Oh talk about uploading your lambda to s3 buckets before deployment if the size limit exceeds 25 MB ! Kidding me !!?? If you use lambda functions widely and want a unified deployment process thats CI/CD friendly, Chalice is the answer. [did I sound like a sales guy from the commercials ??]</p><p>Chalice is widely used for api development and deployment but it also provides a structure way to develop and deploy lambda functions. No more compiling your libraries in amazon-linux-ami , no more packaging your function manually and no more s3 uploads !</p><p><strong>Pre-requisites :</strong></p><ol><li>Install Chalice : <a href="https://chalice.readthedocs.io/en/latest/">https://chalice.readthedocs.io/en/latest/</a></li><li>Install and setup AWS-CLI [optional if you’re using CI/CD for deployment]</li></ol><p><strong>Kick Start Chalice</strong></p><p>Chalice helps you to initiate the project, just use the following command :</p><pre>chalice new-project project_name</pre><p>A boilerplate is created with the project’s name and looks like the following pic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*diD7cEJ_mc6xgzgKM4MBig.png" /></figure><p><strong>Creating a lambda function :</strong></p><p>Chalice creates a template for a rest api in the <em>app.py</em> file but we can get rid of all the routes . Lets create a simple hello-world lambda.</p><pre>from chalice import Chalice</pre><pre>app = Chalice(app_name=&#39;hello-world&#39;) </pre><pre>@app.lambda_function(name=&quot;lambda-test&quot;)</pre><pre>def lambda_test(event, context):</pre><pre>  return {</pre><pre>    &quot;hello&quot; : &quot;world&quot;</pre><pre>  }</pre><p>Lets move on to <em>.chalice/config.json. </em>Similar to the rest api — network configurations, resource provisioning, access controls and environmental variables can be assigned. Deployment variables for multiple stages should be done using the config.</p><p>!!! Always provide resource access to lambda functions using iam roles, never use <strong>“autogen_policy” : “true”</strong> . <em>Being a free spirit in cloud can hurt sometimes</em> !!!!!</p><p>example format for <strong>config.json</strong></p><pre>{</pre><pre>&quot;version&quot;: &quot;2.0&quot;,</pre><pre>&quot;app_name&quot;: &quot;hello-world&quot;,</pre><pre>&quot;stages&quot;: {</pre><pre>&quot;dv&quot;: {</pre><pre>&quot;autogen_policy&quot;: false,</pre><pre>&quot;manage_iam_role&quot;: false,</pre><pre>&quot;iam_role_arn&quot;:&quot;arn:aws:iam::1111111111:role/role-name&quot;,</pre><pre>&quot;lambda_memory_size&quot;: 512,</pre><pre>&quot;lambda_timeout&quot;: 300,</pre><pre>&quot;security_group_ids&quot;:&quot;********&quot;,</pre><pre>&quot;subnet_ids&quot;:[&quot;********&quot;, &quot;********&quot;],</pre><pre>&quot;environment_variables&quot;: {</pre><pre>}}}}</pre><p>All you custom packages can be stuffed in <em>chalicelib</em> directory.</p><p><strong>Deploying :</strong></p><p>Well its as easy as</p><pre>chalice deploy --stage dv</pre><p>Chalice packages your lambda and deploys it in the stage you specify.</p><p>Alright, alright, alright.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddd180af9786" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a AWS Lambda deployment package with native python packages created in Amazon Linux]]></title>
            <link>https://medium.com/@sunil.udhayakumar/creating-a-aws-lambda-deployment-package-with-native-python-packages-created-in-amazon-linux-19ab6fef7241?source=rss-5e664db4071d------2</link>
            <guid isPermaLink="false">https://medium.com/p/19ab6fef7241</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[lambda-function]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sunil Udhayakumar]]></dc:creator>
            <pubDate>Tue, 23 Oct 2018 01:50:03 GMT</pubDate>
            <atom:updated>2018-10-26T13:38:50.612Z</atom:updated>
            <content:encoded><![CDATA[<p>While working with lambda functions we frequently face issues with the python packages(especially the ones written in C like pandas) being incompatible post deployment. This issue is usually fixed by spinning up a EC2 instance and installing the required packages in a directory using pip and using it for deployment. But this is a time consuming and redundant task.</p><p>The fully automated tool is available on : <a href="https://github.com/sudhay/lambda-native-package-builder">https://github.com/sudhay/lambda-native-package-builder</a></p><p>Let’s explore automating the process using docker and shell script .</p><p><strong>Requirements :</strong></p><ol><li>OS : macOS / linux</li><li>Docker</li></ol><p><strong>Files Used:</strong></p><ol><li>Dockerfile</li><li>requirements.txt</li><li>builder.sh</li></ol><h3><strong>Steps to create the packages :</strong></h3><ol><li>Create a <strong>lamda-package-installer</strong> image with python 3.6 and pip3 using amzon-linux base image</li></ol><pre>FROM amazonlinux:latest</pre><pre>ENV PYSHORT 3.6</pre><pre>ENV PYTHONVER 3.6.1</pre><pre>ENV MD5CHECKSUM 2d0fc9f3a5940707590e07f03ecb08b9</pre><pre>RUN yum -y groupinstall &quot;Development tools&quot;</pre><pre>RUN yum -y install zlib-devel</pre><pre>RUN yum -y install bzip2-devel openssl-devel ncurses-devel</pre><pre>RUN yum -y install sqlite sqlite-devel xz-devel</pre><pre>RUN yum -y install readline-devel tk-devel gdbm-devel db4-devel</pre><pre>RUN yum -y install libpcap-devel xz-devel</pre><pre>RUN yum -y install libjpeg-devel</pre><pre>RUN yum -y install wget</pre><pre>WORKDIR /tmp</pre><pre>RUN wget --no-check-certificate https://www.python.org/ftp/python/${PYTHONVER}/Python-${PYTHONVER}.tgz</pre><pre>RUN tar -zxvf Python-${PYTHONVER}.tgz</pre><pre>WORKDIR /tmp/Python-${PYTHONVER}<br>RUN ./configure --prefix=/usr/local LDFLAGS=&quot;-Wl,-rpath /usr/local/lib&quot; --with-ensurepip=install<br>RUN make &amp;&amp; make altinstallRUN pip3.6 install virtualenv</pre><p>2. Create a requirements.txt file with the list of required python packages</p><pre>pandas</pre><p>3. Add commands to dockerfile for copying the requirements file , installing the packages and creating a compressed zip file.</p><pre>COPY /requirements.txt /requirements.txt<br>RUN pip3.6 install -r requirements.txt -t .<br>RUN zip -r deployment_package.zip . -x &quot;requirements.txt&quot;</pre><p>4. Create a builder.sh script to build docker image , run the container and copy the deployment_package to local</p><pre>#!/bin/bash</pre><pre># build the lambda_package_builder image<br>docker build -t lambda_package_builder .</pre><pre># run the container<br>CONTAINER_ID=$(docker run -t -d lambda_package_builder:latest)</pre><pre>#copy the deployment_package.zip to local<br>docker cp $CONTAINER_ID:/package/deployment_package.zip .</pre><pre>#clean the environment<br>docker stop $CONTAINER_ID<br>docker rm $CONTAINER_ID</pre><p>Voila !! Now you can use the bundled package in your lambda function deployment ! Go serverless !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19ab6fef7241" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>