<?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 Manilka Shalinda on Medium]]></title>
        <description><![CDATA[Stories by Manilka Shalinda on Medium]]></description>
        <link>https://medium.com/@manilkar?source=rss-7379153f8029------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6xFBnYqzCcHlZZLVTlwA7w.jpeg</url>
            <title>Stories by Manilka Shalinda on Medium</title>
            <link>https://medium.com/@manilkar?source=rss-7379153f8029------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:58:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@manilkar/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[Automating AWS EC2 Start/Stop Using Lambda and EventBridge Scheduler (Step-by-Step Guide)]]></title>
            <link>https://medium.com/@manilkar/automating-aws-ec2-start-stop-using-lambda-and-eventbridge-scheduler-step-by-step-guide-with-78bff2aed323?source=rss-7379153f8029------2</link>
            <guid isPermaLink="false">https://medium.com/p/78bff2aed323</guid>
            <dc:creator><![CDATA[Manilka Shalinda]]></dc:creator>
            <pubDate>Fri, 20 Mar 2026 08:16:46 GMT</pubDate>
            <atom:updated>2026-03-20T08:17:17.138Z</atom:updated>
            <content:encoded><![CDATA[<h3>🚀 Introduction</h3><p>In many AWS environments, EC2 instances do not need to run 24/7.<br>We can reduce cost by automatically stopping and starting instances using a schedule.</p><p>In this tutorial, we will automate EC2 start and stop using:</p><ul><li>AWS Lambda</li><li>Amazon EventBridge Scheduler</li><li>IAM Role</li><li>Cron schedule</li></ul><p>This method is commonly used in real production environments.</p><p>Example requirement:</p><ul><li>Stop EC2 at 11:30 PM</li><li>Start EC2 at 07:30 AM</li><li>Run every day automatically</li></ul><h3>🏗 Architecture</h3><p>EventBridge Scheduler → Lambda → EC2 API → Instance Start / Stop</p><p>Explanation:</p><ol><li>EventBridge runs on schedule</li><li>EventBridge calls Lambda</li><li>Lambda calls EC2 API</li><li>EC2 instance starts or stops</li></ol><h3>📌 Step 1 — Create IAM Role for Lambda</h3><p>Go to:</p><p>AWS Console → IAM → Roles → Create role</p><p>Select:</p><p>Trusted entity → AWS service<br>Use case → Lambda</p><p>Click Next</p><p>Add permission:</p><p>AmazonEC2FullAccess</p><p>Click Next</p><p>Role name:</p><p>LambdaEC2ControlRole</p><p>Click Create role</p><h3>📌 Step 2 — Create Lambda Function</h3><p>Go to:</p><p>AWS Console → Lambda → Create function</p><p>Select:</p><p>Author from scratch</p><p>Function name:</p><p>EC2StartStopFunction</p><p>Runtime:</p><p>Python 3.12</p><p>Execution role:</p><p>Use existing role → LambdaEC2ControlRole</p><p>Click Create function</p><h3>📌 Step 3 — Add Lambda Code</h3><p>Paste this code:</p><pre>import boto3<br><br>ec2 = boto3.client(&#39;ec2&#39;)<br>INSTANCE_ID = &quot;i-xxxxxxxx&quot;<br>def lambda_handler(event, context):<br>    print(&quot;Event:&quot;, event)<br>    action = event.get(&quot;action&quot;)<br>    if action == &quot;start&quot;:<br>        ec2.start_instances(<br>            InstanceIds=[INSTANCE_ID]<br>        )<br>        print(&quot;Instance started&quot;)<br>    elif action == &quot;stop&quot;:<br>        ec2.stop_instances(<br>            InstanceIds=[INSTANCE_ID]<br>        )<br>        print(&quot;Instance stopped&quot;)<br>    else:<br>        print(&quot;No action provided&quot;)</pre><p>Replace instance ID with your EC2 ID.</p><p>Click Deploy.</p><h3>📌 Step 4 — Test Lambda</h3><p>Click Test</p><p>Start test:</p><pre>{<br>  &quot;action&quot;: &quot;start&quot;<br>}</pre><p>Stop test:</p><pre>{<br>  &quot;action&quot;: &quot;stop&quot;<br>}</pre><p>Check EC2 state changes.</p><h3>📌 Step 5 — Create Stop Schedule</h3><p>Go to:</p><p>EventBridge → Scheduler → Create schedule</p><p>Name:</p><p>StopAppServer</p><p>Schedule type:</p><p>Recurring</p><p>Timezone:</p><p>Asia/Colombo</p><p>Schedule type:</p><p>Cron-based schedule</p><p>Cron:</p><pre>30 23* * ? *</pre><p>Meaning:</p><p>Every day at 11:30 PM</p><p>Target:</p><p>Lambda → EC2StartStopFunction</p><p>Payload:</p><pre>{<br>  &quot;action&quot;: &quot;stop&quot;<br>}</pre><p>Create schedule.</p><h3>📌 Step 6 — Create Start Schedule</h3><p>Create another schedule.</p><p>Name:</p><p>StartAppServer</p><p>Cron:</p><pre>30 07* * ? *</pre><p>Meaning:</p><p>Every day at 7:30 AM</p><p>Payload:</p><pre>{<br>  &quot;action&quot;: &quot;start&quot;<br>}</pre><p>Create schedule.</p><h3>📌 Step 7 — Verify</h3><p>Go to:</p><p>EC2 → Instances</p><p>You should see:</p><p>Running → Stopped → Running</p><p>according to schedule.</p><h3>📌 Cron Format Explained</h3><p>Cron format:</p><p>Minutes Hours Day Month DayOfWeek Year</p><p>Examples:</p><p>30 23 * * ? * → 11:30 PM every day<br>30 07 * * ? * → 7:30 PM every day<br>0 9 * * ? * → 9:00 AM every day<br>0 18 * * ? * → 6:00 PM every day</p><h3>📌 Real Production Use Cases</h3><p>This method is used for:</p><ul><li>Dev servers</li><li>Test environments</li><li>Office hours servers</li><li>Cost optimization</li><li>Scheduled maintenance</li><li>Batch workloads</li></ul><h3>📌 Conclusion</h3><p>We automated EC2 start and stop using:</p><ul><li>Lambda</li><li>EventBridge Scheduler</li><li>IAM role</li><li>Cron expressions</li></ul><p>This is a common automation used in real AWS production environments.</p><p>Using this method helps reduce cost and improve automation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78bff2aed323" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Gave a Private EC2 Instance Internet Access (Without Making It Public)]]></title>
            <link>https://medium.com/@manilkar/how-i-gave-a-private-ec2-instance-internet-access-without-making-it-public-ac64be3ec633?source=rss-7379153f8029------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac64be3ec633</guid>
            <dc:creator><![CDATA[Manilka Shalinda]]></dc:creator>
            <pubDate>Sun, 01 Feb 2026 10:23:28 GMT</pubDate>
            <atom:updated>2026-02-01T10:23:28.805Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started learning AWS networking, one concept kept showing up everywhere <strong>NAT</strong>.<br> I understood it in theory, but it didn’t <em>click</em> until I actually built it.</p><p>So in this KodeKloud lab, I decided to do exactly that:<br><strong>give a private EC2 instance access to the internet — without assigning it a public IP.</strong></p><p>Here’s how it played out.</p><h3>Designing the Network (Before Touching Anything)</h3><p>Before launching instances, I focused on the foundation — the <strong>VPC</strong>.</p><p>I created a custom VPC with a /16 CIDR block and split it into two subnets:</p><ul><li>A <strong>public subnet</strong> for internet-facing components</li><li>A <strong>private subnet</strong> for internal workloads</li></ul><p>This separation immediately made the architecture feel more “real-world”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AB8bpsUd4SVmxT_5y52shA.png" /><figcaption><em>Visual overview of the VPC with public and private subnets</em></figcaption></figure><h3>Making the Public Subnet Actually Public</h3><p>A public subnet is only “public” if it has a route to the internet.</p><p>So I attached an <strong>Internet Gateway</strong> to the VPC and updated the <strong>public route table</strong>:</p><ul><li>0.0.0.0/0 → Internet Gateway</li><li>Local traffic stays inside the VPC</li></ul><p>At this point, anything launched in the public subnet could reach the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oy5skbjnb5lu3Qo8k4m3GQ.png" /><figcaption><em>Public route table sending internet-bound traffic to the IGW</em></figcaption></figure><h3>The Key Piece: Enabling Internet for the Private Subnet</h3><p>Now came the interesting part.</p><p>My private subnet <strong>must not</strong> talk to the Internet Gateway directly.<br> Instead, it needed a middleman — a <strong>NAT instance</strong>.</p><p>I launched an EC2 instance in the public subnet and configured it to act as the NAT device.</p><p>Then I updated the <strong>private route table</strong>:</p><ul><li>0.0.0.0/0 → NAT instance network interface</li><li>Local traffic remains untouched</li></ul><p>This single route changed everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORB4wrrzARW8gl0jXP3ORQ.png" /><figcaption><em>Private subnet routing outbound traffic via the NAT instance</em></figcaption></figure><h3>Locking It Down with Security Groups</h3><p>Security was non-negotiable.</p><p>For the NAT instance, I configured the security group to allow:</p><ul><li>SSH access for management</li><li>All traffic from within the VPC CIDR</li><li>Outbound traffic to anywhere</li></ul><p>This ensured:</p><ul><li>Private instances could communicate outward</li><li>No unnecessary exposure existed</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1K7ffZTIX36sN3iYUTEndw.png" /><figcaption><em>Security group rules allowing NAT traffic forwarding</em></figcaption></figure><h3>Turning an EC2 Instance into a NAT (The Part That Actually Makes It Work)</h3><p>Launching a NAT instance alone isn’t enough.</p><p>By default, an EC2 instance <strong>does not forward traffic</strong>.<br> To make it behave like a router, I had to configure <strong>IP forwarding and NAT rules</strong> manually.</p><p>This is the step where everything either works — or completely breaks.</p><h3>Step 1: Enable IP Forwarding</h3><p>First, I enabled IPv4 packet forwarding so the instance could pass traffic between interfaces:</p><pre>sudo sysctl -w net.ipv4.ip_forward=1</pre><p>To make sure this setting survives reboots, I made it persistent:</p><pre>echo &quot;net.ipv4.ip_forward = 1&quot; | sudo tee -a /etc/sysctl.conf</pre><p>Without this, the instance would receive traffic — but never forward it.</p><h3>Step 2: Configure NAT Using iptables</h3><p>Next, I configured <strong>Network Address Translation (NAT)</strong> using iptables.</p><p>This allows private instances to share the NAT instance’s public IP when accessing the internet.</p><pre>sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</pre><p>This rule tells Linux:</p><blockquote><em>“Any outbound traffic leaving through </em><em>eth0, rewrite the source IP.”</em></blockquote><p>Exactly what a NAT device should do.</p><h3>Step 3: Persist iptables Rules</h3><p>iptables rules don’t survive reboots unless explicitly saved.</p><p>So I installed the iptables service and persisted the rules:</p><pre>sudo yum install -y iptables-services<br>sudo service iptables save<br>sudo systemctl enable iptables<br>sudo systemctl start iptables<br>sudo systemctl status iptables</pre><p>At this point, the NAT instance was fully functional — and reboot-safe.</p><h3>Step 4: NAT Instance AMI Selection</h3><p>For the NAT instance, I selected <strong>Amazon Linux 2</strong> from the <strong>AWS Marketplace</strong>.</p><p>This choice made sense because:</p><ul><li>It’s lightweight and AWS-optimized</li><li>iptables support is built-in</li><li>Easy to maintain and widely used in production</li></ul><p>Sometimes boring defaults are the best engineering decisions.</p><h3>Why This Step Matters</h3><p>This configuration is <strong>what separates a real NAT instance from a normal EC2</strong>.</p><p>Without:</p><ul><li>IP forwarding</li><li>iptables masquerading</li><li>Persistent rules</li></ul><p>The private subnet would never reach the internet — even with correct route tables.</p><p>This was the moment where the architecture truly came alive.</p><h3>The Moment of Truth: Testing from the Private EC2</h3><p>With everything wired together, I logged into the <strong>private EC2 instance</strong>.</p><p>No public IP.<br>No internet gateway.<br>Only the NAT path.</p><p>I ran a simple AWS CLI command:</p><pre>aws s3 ls s3://devops-nat-24903</pre><p>And there it was.</p><p>The S3 bucket contents appeared instantly.</p><p>That was the moment it clicked — <strong>the traffic was flowing exactly as designed</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cp25I08PZzbwg_VkpEBOzg.png" /></figure><p><em>Caption: Accessing an S3 bucket from a private EC2 via NAT</em></p><h3>What This Lab Taught Me</h3><p>This wasn’t just about NAT.</p><p>It taught me:</p><ul><li>Private infrastructure can still be fully functional</li><li>Routing tables control <em>everything</em></li><li>Security groups are as important as subnets</li><li>Real cloud architecture is about <strong>intentional access</strong></li></ul><p>Most importantly, it helped me think like a <strong>cloud engineer</strong>, not just someone clicking through the console.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac64be3ec633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step-by-Step Guide: How to Create an AWS Account for B]]></title>
            <link>https://medium.com/@manilkar/step-by-step-guide-how-to-create-an-aws-account-for-b-47c1edebeced?source=rss-7379153f8029------2</link>
            <guid isPermaLink="false">https://medium.com/p/47c1edebeced</guid>
            <dc:creator><![CDATA[Manilka Shalinda]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 14:15:32 GMT</pubDate>
            <atom:updated>2024-08-13T14:18:01.022Z</atom:updated>
            <content:encoded><![CDATA[<h3>Step-by-Step Guide: How to Create an AWS Account for Beginners</h3><p>Creating an AWS (Amazon Web Services) account is the first step to using Amazon’s cloud services. Whether you’re a developer, IT professional, or just starting out, having an AWS account lets you access a wide range of tools and services. With an AWS account, you can build, store, and manage applications, websites, data, and more all in the cloud. This guide will show you how to set up your account, step by step, so you can get started with AWS quickly and easily.</p><p><strong>Step 1: Visit the AWS Website</strong></p><p>To get started, go to the AWS website by clicking on the following link: <a href="https://aws.amazon.com/free/?gclid=EAIaIQobChMIkcTLsdDxhwMVuqtmAh2osQFDEAAYASAAEgJZCPD_BwE&amp;trk=14a4002d-4936-4343-8211-b5a150ca592b&amp;sc_channel=ps&amp;ef_id=EAIaIQobChMIkcTLsdDxhwMVuqtmAh2osQFDEAAYASAAEgJZCPD_BwE:G:s&amp;s_kwcid=AL!4422!3!453325184782!e!!g!!aws!10712784856!111477279771&amp;all-free-tier.sort-by=item.additionalFields.SortRank&amp;all-free-tier.sort-order=asc&amp;awsf.Free%20Tier%20Types=*all&amp;awsf.Free%20Tier%20Categories=*all">AWS Website</a>. This will take you to the AWS homepage, where you can begin the account creation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YO9wIxVzdwsLBwS3I7_jcQ.png" /></figure><p><strong>Step 2: Click the Button to Start Creating Your Account</strong></p><p>By clicking the red boxed button in the image above, you’ll be taken to a new interface, as shown in the image below. This is where you’ll start entering your account details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y66F3YbkJUC8oigQnDFYLg.jpeg" /></figure><p>In the interface shown above, enter your email address and a name in the respective fields. Once you’ve filled in the details, click on the “Verify Email Address” button, highlighted as number 3 in the image. After verifying your email, proceed to the next step.</p><p><strong>Step 3: Verify your email address</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOIkwdra_pTCqAPHPljI2A.jpeg" /></figure><p>After receiving the verification code in your email, enter the code in the designated field and press the “Verify” button. Once you’ve successfully verified your email, you will be automatically navigated to the next step in the account creation process.</p><p><strong>Step 4: Set Up Your Password</strong></p><p>Next, you will be prompted to create a password for your AWS account. Enter a strong password in the provided field and confirm it. This password will be used to securely log in to your account in the future. Once you’ve entered your password, proceed to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iMjbZ3EKaJ_i4uJgu6zpUA.jpeg" /></figure><p><strong>Step 5: Enter Your Contact Details</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smgrAqZjqgqj48tWMSrYvg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*maguo9VVQz_JZR2sVebkzQ.jpeg" /></figure><p>In this step, you’ll need to provide your contact information. Fill in your <strong>Full Name</strong>, <strong>Phone Number</strong>, <strong>Country or Region</strong>, <strong>Address</strong>, <strong>City</strong>, <strong>State</strong>, and <strong>Postal Code</strong> in the respective fields. Once all the details are entered, press the “Continue” button to move on to the next step.</p><p><strong>Step 6: Enter Your Billing Details</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dd2JIZAFqs9X1r8VXg-bCw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*gpA3DlAYvlpgpAyBSTEj-w.jpeg" /></figure><p>Now, you’ll be asked to provide your billing information. Enter your payment details as requested. After filling in the billing information, click the “Verify and Continue” button. This will take you to the next step in the account creation process.</p><p><strong>Step 7: Confirm Your Identity</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*kYjq8UVzgeab-qXlDi7HNg.jpeg" /></figure><p>In this step, you’ll be asked to confirm your identity. Enter your mobile number in the provided field. Then, complete the security check to verify that you are not a robot. Once you’ve done this, press the “Send SMS” button. After receiving the SMS and confirming your identity, you will be navigated to the next step.</p><p><strong>Step 8: Enter and Verify the Code</strong></p><p>After pressing the “Send SMS” button, you will receive a verification code on your mobile phone. Enter this code in the field provided and click the “Verify” button. Once the code is verified, you can proceed to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*r38RbaLpLyE9kSt1_ZIE-g.jpeg" /></figure><p><strong>Step 9: Select a Support Plan and Complete Sign-Up</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*qvdJOozHh6HhKrp-b-fGGA.jpeg" /></figure><p>Next, you’ll need to choose a support plan that suits your needs. Select the appropriate option from the available plans. After making your selection, press the “Complete Sign Up” button to finish the account creation process.</p><p><strong>Step 10: Account Creation Confirmation</strong></p><p>If your account has been created successfully, you will see the following interface. This confirms that your AWS account is now set up and ready to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*d-0AjTBcMevmaBjIrIMwBw.jpeg" /></figure><p><strong>Step 11: Access the AWS Management Console</strong></p><p>After pressing the “Go to the AWS Management Console” button, you will be navigated to the following interface. This is where you can start exploring and using the various AWS services available to you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-M5BL8ravYEutX64TEl3w.jpeg" /></figure><p>Congratulations! You’ve successfully created your AWS account and accessed the AWS Management Console. You’re now ready to explore the wide range of cloud services and tools that AWS offers. Whether you’re planning to deploy applications, store data, or analyze information, your new AWS account will provide the resources you need. If you have any questions or need further assistance, AWS offers extensive documentation and support to help you get the most out of their services. Happy cloud computing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47c1edebeced" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>