<?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: Harshana vivekanandhan</title>
    <description>The latest articles on DEV Community by Harshana vivekanandhan (@harshana_vivekanandhan_88).</description>
    <link>https://dev.to/harshana_vivekanandhan_88</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%2F1692482%2F817d5670-d0ad-4960-be25-b44b72d49bfc.jpg</url>
      <title>DEV Community: Harshana vivekanandhan</title>
      <link>https://dev.to/harshana_vivekanandhan_88</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harshana_vivekanandhan_88"/>
    <language>en</language>
    <item>
      <title>Architecting a Secure and Scalable Network with AWS VPCs and Subnets</title>
      <dc:creator>Harshana vivekanandhan</dc:creator>
      <pubDate>Mon, 08 Jul 2024 17:22:18 +0000</pubDate>
      <link>https://dev.to/harshana_vivekanandhan_88/architecting-a-secure-and-scalable-network-with-aws-vpcs-and-subnets-3kcc</link>
      <guid>https://dev.to/harshana_vivekanandhan_88/architecting-a-secure-and-scalable-network-with-aws-vpcs-and-subnets-3kcc</guid>
      <description>&lt;p&gt;Building a secure and scalable network in the cloud is critical for any organization that leverages cloud services. AWS Virtual Private Cloud (VPC) and its associated subnets provide the foundational infrastructure to achieve these goals. This blog post will guide you through the process of architecting a secure and scalable network using AWS VPCs and subnets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An AWS account that is free-tier eligible because we don’t want to spend money on this project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic knowledge of VPCs, subnets, Network ACLs, routing and security groups.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My Architecture Diagram
&lt;/h2&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%2Fuploads%2Farticles%2Fhceh13299whb0yt1a9tw.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%2Fuploads%2Farticles%2Fhceh13299whb0yt1a9tw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a custom VPC and Subnets
&lt;/h2&gt;

&lt;p&gt;I will launch all the resources I use in this project in the North Virginia region. If you want to follow along to the last detail, make sure you are also launching your resources in the North Virginia region.&lt;/p&gt;

&lt;p&gt;Now let’s create our VPC. Creating a VPC has been made easier as you can create your VPC and subnets, and define route tables and other VPC resources in one go.&lt;br&gt;
Here change the IPv4 CIDR block and the zones and subnets to 1 gateways and endpoints to None&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%2Fuploads%2Farticles%2Fkyfxovzg2x1b56kh1dt8.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%2Fuploads%2Farticles%2Fkyfxovzg2x1b56kh1dt8.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2F0an8i77n3lzl6exk1ww0.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%2Fuploads%2Farticles%2F0an8i77n3lzl6exk1ww0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring Security Groups
&lt;/h2&gt;

&lt;p&gt;To locate the security group console, we have to search and navigate to the EC2 management console window. Once in the EC2 dashboard navigate to the security groups tab and create a security group as shown in the image below.&lt;a href="https://dev.tourl"&gt;&lt;/a&gt;{&lt;a href="https://whatismyipaddress.com/ip/110.224.90.87" rel="noopener noreferrer"&gt;https://whatismyipaddress.com/ip/110.224.90.87&lt;/a&gt;} to find the IP address&lt;br&gt;
Here Allow SSH from local computer to bastion host launched in public subnet.&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%2Fuploads%2Farticles%2Fworymqkv7heaqtyqqyrr.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%2Fuploads%2Farticles%2Fworymqkv7heaqtyqqyrr.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2F0tfqy9pg4irjoichm4vk.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%2Fuploads%2Farticles%2F0tfqy9pg4irjoichm4vk.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2F3yup5wm248g5s2taq3y1.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%2Fuploads%2Farticles%2F3yup5wm248g5s2taq3y1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up a Bastion Host
&lt;/h3&gt;

&lt;p&gt;The next step in the project is to launch a bastion host in the public subnet via which we are going to connect to an EC2 instance launched in the private subnet. So let’s get that done. Within your management console, navigate to the EC2 window. To make sure we don’t accrue any cost, we are going to use an AMI that is free-tier eligible.&lt;br&gt;
While launching the EC2 instance, be sure to select the security group we created earlier as its security group. After having filled in all the details, clicking on the Launch instance button launches our bastion host EC2 instance.&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%2Fuploads%2Farticles%2F4adoqdj4vc9cvaqo6q4j.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%2Fuploads%2Farticles%2F4adoqdj4vc9cvaqo6q4j.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2Fwph8px6cp59gaqppwjte.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%2Fuploads%2Farticles%2Fwph8px6cp59gaqppwjte.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2Fsq7vlfij8ruzc4t0cpk0.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%2Fuploads%2Farticles%2Fsq7vlfij8ruzc4t0cpk0.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2F141ff5u67b6h332cc7ql.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%2Fuploads%2Farticles%2F141ff5u67b6h332cc7ql.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Launch Private EC2 Instance
&lt;/h2&gt;

&lt;p&gt;We need another EC2 instance in our private subnet which we are going to access it using SSH via the bastion host. This instance is going to use the same key pair and security group as the bastion host in the public subnet.&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%2Fuploads%2Farticles%2F9re5aenj596fosax5imw.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%2Fuploads%2Farticles%2F9re5aenj596fosax5imw.png" alt="Image description"&gt;&lt;/a&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%2Fuploads%2Farticles%2Fcbbzeoowbwzuu0et9xu1.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%2Fuploads%2Farticles%2Fcbbzeoowbwzuu0et9xu1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SSH to Bastion Host
&lt;/h2&gt;

&lt;p&gt;The time to start testing our work has come. We are going to access our bastion host from our computer. So open a terminal window and run the following commands.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

chmod 400 /path/to/private/key.pem



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This command will secure the key pair file that was downloaded when we created our key pair. After that, the next command to be run is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ssh -i path/to/key.pem ec2-user@bastion-public-ip


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Make sure you edit the command as needed before running it. With that, we will be connected to our bastion host and we can now connect to the private instance via SSH from the bastion host. To do that, run the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ssh ec2-user@private-instance-private-ip


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That’s all that there is to it. Now close the connection to your EC2 instances by running the edit command&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

**exit**


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;command.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>aws</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Creating a Scalable Serverless Chat Application on AWS</title>
      <dc:creator>Harshana vivekanandhan</dc:creator>
      <pubDate>Mon, 08 Jul 2024 09:59:53 +0000</pubDate>
      <link>https://dev.to/harshana_vivekanandhan_88/creating-a-scalable-serverless-chat-application-on-aws-1h7d</link>
      <guid>https://dev.to/harshana_vivekanandhan_88/creating-a-scalable-serverless-chat-application-on-aws-1h7d</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.tourl"&gt;&lt;/a&gt;Today I had used a  AWS serverless services like AWS Lambda and API Gateway to build a chat application in the AWS cloud that can effortlessly scale to meet high demand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;-An AWS account with an IAM user that has administrative permissions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A basic understanding of a high-level programming language such as Python is recommended but not required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic understanding of databases and APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grit and persistence.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My Architecture Diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnc3wflw925uzmod33zgm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnc3wflw925uzmod33zgm.png" alt="Image description" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create A Lambda Function
&lt;/h2&gt;

&lt;p&gt;Sign in to the AWS Management Console: Go to the AWS Management Console.&lt;/p&gt;

&lt;p&gt;Open the Lambda console: From the AWS Management Console, open the AWS Lambda console by searching for "Lambda" in the services search bar.&lt;/p&gt;

&lt;p&gt;Create three function:&lt;br&gt;
Function:1&lt;br&gt;
Click on the "Create function" button.&lt;br&gt;
Choose "Author from scratch".&lt;br&gt;
Configure the following settings:&lt;br&gt;
Function name: Send Message&lt;br&gt;
Runtime: Python 3.x (choose the latest available version)&lt;br&gt;
Role: Choose "Create a new role with basic Lambda permissions"&lt;br&gt;
Click "Create function" to create your Lambda function.&lt;/p&gt;

&lt;p&gt;Function:2&lt;br&gt;
Click on the "Create function" button.&lt;br&gt;
Choose "Author from scratch".&lt;br&gt;
Configure the following settings:&lt;br&gt;
Function name: Connect&lt;br&gt;
Runtime: Python 3.x (choose the latest available version)&lt;br&gt;
Role: Choose "Create a new role with basic Lambda permissions"&lt;br&gt;
Click "Create function" to create your Lambda function.&lt;/p&gt;

&lt;p&gt;Function:3&lt;br&gt;
Click on the "Create function" button.&lt;br&gt;
Choose "Author from scratch".&lt;br&gt;
Configure the following settings:&lt;br&gt;
Function name: Disconnect&lt;br&gt;
Runtime: Python 3.x (choose the latest available version)&lt;br&gt;
Role: Choose "Create a new role with basic Lambda permissions"&lt;br&gt;
Click "Create function" to create your Lambda function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4olr2ysbxf33gv8bdhyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4olr2ysbxf33gv8bdhyt.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create an API
&lt;/h2&gt;

&lt;p&gt;creating an API using API Gateway which is a managed service that makes it fun and easy for developers to create, publish, maintain, monitor, and secure APIs to back-end systems running on EC2, AWS Lambda or any publicly addressable web service&lt;/p&gt;

&lt;p&gt;In the API Gateway console, click on the Build button under WebSocket APIs as shown below&lt;br&gt;
You can create a route selection expression like $request.body.action to route messages based on their "action" attribute as we have done in our case. Then, you'd define route actions for different "action" values, such as:&lt;/p&gt;

&lt;p&gt;Route Key: sendMessage&lt;br&gt;
Integration: Lambda function to handle the messages&lt;br&gt;
This way, incoming messages will be routed to the appropriate backend Lambda functions based on their “action” attribute. Now let’s go to add routes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8cnjunjkjkyned4psi4k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8cnjunjkjkyned4psi4k.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyienqjhyuf7qx8lyvow4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyienqjhyuf7qx8lyvow4.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxn63mtgrgysr64r0pnew.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxn63mtgrgysr64r0pnew.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Add Code to the Lambda Function
&lt;/h2&gt;

&lt;p&gt;Edit the function code:&lt;/p&gt;

&lt;p&gt;Scroll down to the "Function code" section.&lt;br&gt;
In the inline code editor, you will see a file named lambda_function.py. This file contains the handler code for your Lambda function.&lt;br&gt;
Write your code: Replace the default code with the following code:&lt;br&gt;
for Send Message&lt;/p&gt;

&lt;p&gt;python&lt;br&gt;
Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json
import urllib3
import boto3
client = boto3.client('apigatewaymanagementapi', endpoint_url="xxxxxxxxxx.com/production")

def lambda_handler(event, context):
    print(event)
    #Extract connectionId from incoming event
    connectionId = event["requestContext"]["connectionId"]
    #Do something interesting... 
    responseMessage = "I am fine"
    #Form response and post back to connectionId
    response = client.post_to_connection(ConnectionId=connectionId, Data=json.dumps(responseMessage).encode('utf-8'))
    return { "statusCode": 200  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for connect and disconnect&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json

def lambda_handler(event, context):
    print(event)
    print("****")
    print(context)
    return { "statusCode": 200 }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyww7rvw488p66gkuj8k5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyww7rvw488p66gkuj8k5.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing our Send Message Route
&lt;/h2&gt;

&lt;p&gt;To make sure our Lambda function is working as integration for our API and a client can send messages, we are going to test our send message route. So go back to &lt;a href="https://dev.tourl"&gt;&lt;/a&gt;[]{&lt;a href="https://piehost.com/websocket-tester" rel="noopener noreferrer"&gt;https://piehost.com/websocket-tester&lt;/a&gt;} with the WebSocket connection still open and try sending a message in the format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "action": "sendMessage",
  "message": "Hello, how are you?"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctqrks1ptrksic1y97r7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctqrks1ptrksic1y97r7.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxabshwzp7mlgocg3q91o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxabshwzp7mlgocg3q91o.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>cloudcomputing</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Serverless Application using AWS Lambda ,Api Gateway,AWS Amplify</title>
      <dc:creator>Harshana vivekanandhan</dc:creator>
      <pubDate>Fri, 05 Jul 2024 16:20:11 +0000</pubDate>
      <link>https://dev.to/harshana_vivekanandhan_88/serverless-application-using-aws-lambda-api-gatewayaws-amplify-36hc</link>
      <guid>https://dev.to/harshana_vivekanandhan_88/serverless-application-using-aws-lambda-api-gatewayaws-amplify-36hc</guid>
      <description>&lt;p&gt;Creating a serverless application using AWS Lambda, API Gateway, and AWS Amplify involves a series of steps to set up and integrate these services. Here's a high-level overview of the process:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Set Up AWS Lambda Function&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;AWS Lambda is a compute service that lets you run code without provisioning or managing servers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a Lambda Function&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to AWS Lambda.&lt;/li&gt;
&lt;li&gt;Click on "Create function."&lt;/li&gt;
&lt;li&gt;Choose a blueprint or start from scratch.&lt;/li&gt;
&lt;li&gt;Configure the function (name, runtime, permissions, etc.).&lt;/li&gt;
&lt;li&gt;Write your function code or upload a zip file.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Configure the Lambda Function&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up environment variables if needed.&lt;/li&gt;
&lt;li&gt;Configure the function's execution role to allow necessary permissions.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Create an API with Amazon API Gateway&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Amazon API Gateway allows you to create and publish RESTful APIs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create an API&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to API Gateway.&lt;/li&gt;
&lt;li&gt;Click on "Create API" and choose REST API.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Define Resources and Methods&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create resources (e.g., &lt;code&gt;/items&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Add methods (e.g., GET, POST) to the resources.&lt;/li&gt;
&lt;li&gt;Integrate these methods with your Lambda functions by specifying the Lambda ARN.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Deploy the API&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new stage (e.g., &lt;code&gt;dev&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Deploy the API to this stage.&lt;/li&gt;
&lt;li&gt;Note the invoke URL provided by API Gateway for later use.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Set Up AWS Amplify&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;AWS Amplify is a set of tools and services to help front-end web and mobile developers build scalable full-stack applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Initialize a New Amplify Project&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Amplify CLI: &lt;code&gt;npm install -g @aws-amplify/cli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Configure the CLI: &lt;code&gt;amplify configure&lt;/code&gt; (follow the prompts to set up your AWS profile).&lt;/li&gt;
&lt;li&gt;Initialize your Amplify project: &lt;code&gt;amplify init&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Add API to Your Amplify Project&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add an API: &lt;code&gt;amplify add api&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Choose REST when prompted and provide the necessary details (e.g., path, Lambda integration).&lt;/li&gt;
&lt;li&gt;Push the changes to the cloud: &lt;code&gt;amplify push&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Build and Deploy Your Frontend with Amplify&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create Your Frontend Application&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can use frameworks like React, Angular, or Vue.js.&lt;/li&gt;
&lt;li&gt;Amplify supports hosting for static websites.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Host Your Application with Amplify&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the AWS Amplify Console.&lt;/li&gt;
&lt;li&gt;Connect your repository (e.g., GitHub, GitLab).&lt;/li&gt;
&lt;li&gt;Configure build settings and deploy.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Testing and Iteration&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Test your application end-to-end.&lt;/li&gt;
&lt;li&gt;Make necessary adjustments to the Lambda functions, API Gateway configurations, or frontend code.&lt;/li&gt;
&lt;li&gt;Utilize Amplify's CI/CD capabilities for automatic deployment on code changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: Simple Serverless To-Do Application
&lt;/h3&gt;

&lt;p&gt;Here’s a basic example of a serverless To-Do application using AWS Lambda, API Gateway, and AWS Amplify:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lambda Function&lt;/strong&gt;: A simple Lambda function to handle CRUD operations on to-do items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Gateway&lt;/strong&gt;: Configure a REST API with paths like &lt;code&gt;/todos&lt;/code&gt; and methods like GET, POST, DELETE.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amplify Frontend&lt;/strong&gt;: A React application integrated with the API.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>aws</category>
      <category>html</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Hosting a Static Website Using S3 in AWS with Terraform</title>
      <dc:creator>Harshana vivekanandhan</dc:creator>
      <pubDate>Thu, 27 Jun 2024 18:06:28 +0000</pubDate>
      <link>https://dev.to/harshana_vivekanandhan_88/hosting-a-static-website-using-s3-in-aws-with-terraform-3b69</link>
      <guid>https://dev.to/harshana_vivekanandhan_88/hosting-a-static-website-using-s3-in-aws-with-terraform-3b69</guid>
      <description>&lt;p&gt;Introduction&lt;br&gt;
Hi there! I've been investigating Terraforms and AWS's capabilities as part of my internship. I recently worked on Hosting a Static Website Using S3 in AWS with Terraform&lt;br&gt;
Hosting a static website on Amazon S3 is a cost-effective and scalable solution that can be easily managed using Terraform. This tutorial will guide you through the steps to set up and deploy a static website using S3 with Terraform.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before you begin, ensure you have the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account&lt;/strong&gt;: If you don’t have one, create it &lt;a href="https://aws.amazon.com/"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terraform Installed&lt;/strong&gt;: Download and install Terraform from the &lt;a href="https://www.terraform.io/downloads"&gt;official site&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI Configured&lt;/strong&gt;: Install and configure the AWS CLI. Follow the instructions &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step-by-Step Guide
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Set Up Your Terraform Project
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Directory&lt;/strong&gt;: Start by creating a directory for your Terraform project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create the &lt;code&gt;main.tf&lt;/code&gt; File&lt;/strong&gt;: This file will contain the Terraform configuration for your S3 static website.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  2. Initialize Terraform
&lt;/h4&gt;

&lt;p&gt;Run the following command to initialize your Terraform project:&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Plan the Deployment
&lt;/h4&gt;

&lt;p&gt;Run the &lt;code&gt;terraform plan&lt;/code&gt; command to see what Terraform will do:&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Apply the Configuration
&lt;/h4&gt;

&lt;p&gt;Apply the configuration to create the S3 bucket and upload the website files:&lt;br&gt;
Terraform will prompt for confirmation. Type &lt;code&gt;yes&lt;/code&gt; to proceed.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Verify the Deployment
&lt;/h4&gt;

&lt;p&gt;Once the apply command completes, Terraform will output the website URL. You can access your static website using this URL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Using Terraform to host a static website on Amazon S3 simplifies the deployment and management process. With infrastructure as code, you can version, reproduce, and maintain your static websites more efficiently. This guide provides a foundational setup, which you can expand upon by adding more resources and configurations as needed.By leveraging Terraform and AWS S3, you can quickly deploy scalable and reliable static websites, making your web hosting process smoother and more efficient.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating, Modifying, and Destroying an EC2 Instance in AWS with Terraform</title>
      <dc:creator>Harshana vivekanandhan</dc:creator>
      <pubDate>Thu, 27 Jun 2024 16:58:01 +0000</pubDate>
      <link>https://dev.to/harshana_vivekanandhan_88/creating-modifying-and-destroying-an-ec2-instance-in-aws-with-terraform-29a1</link>
      <guid>https://dev.to/harshana_vivekanandhan_88/creating-modifying-and-destroying-an-ec2-instance-in-aws-with-terraform-29a1</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hi there! I've been investigating Terraforms and AWS's capabilities as part of my internship. I recently worked on using Terraform to create, modify, and terminate an EC2 instance. This blog will go over the procedures I took, the difficulties I ran across, and the fixes I discovered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we dive in, ensure you have the following:&lt;/p&gt;

&lt;p&gt;✔️AWS Account: If you don't have one, you can create it here.&lt;br&gt;
✔️Terraform Installed: Download and install Terraform from the official site.&lt;br&gt;
✔️AWS CLI Configured: Install and configure the AWS CLI. Follow the instructions here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Your Terraform Project
&lt;/h2&gt;

&lt;p&gt;✨Create a Directory: Start by creating a directory for your Terraform project.&lt;br&gt;
✨Initialize Terraform: Create a new file named main.tf where we'll define our Terraform configuration.&lt;br&gt;
✨Initialize Terraform: Initialize the Terraform working directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an EC2 Instance
&lt;/h2&gt;

&lt;p&gt;1.Plan the Execution: Run terraform plan to see what Terraform will do.&lt;br&gt;
2.Apply the Configuration: Apply the configuration to create the EC2 instance.&lt;br&gt;
3.Terraform will prompt for confirmation. Type yes to proceed. After a few moments, your EC2 instance will be created.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modifying the EC2 Instance
&lt;/h2&gt;

&lt;p&gt;Suppose you want to change the instance type. Edit the main.tf file.&lt;br&gt;
1.Plan the Changes: Run terraform plan to see the changes.&lt;br&gt;
2.Apply the Changes: Apply the configuration to update the EC2 instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Destroying the EC2 Instance
&lt;/h2&gt;

&lt;p&gt;When you no longer need the EC2 instance, you can destroy it using Terraform.&lt;br&gt;
1.Destroy the Resource: Run the terraform destroy command. Terraform will prompt for confirmation. Type yes to proceed. Terraform will then destroy the EC2 instance and clean up the resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using Terraform to manage AWS resources simplifies infrastructure management by allowing you to define your infrastructure as code. In this blog post, we covered the basics of creating, modifying, and destroying an EC2 instance with Terraform. This process can be extended to manage more complex infrastructures by leveraging Terraforms extensive provider and resource support. By adopting Terraform, you can ensure your infrastructure is versioned, reproducible, and maintainable, paving the way for more efficient and reliable cloud resource management.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
