<?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: Rashmitha v</title>
    <description>The latest articles on DEV Community by Rashmitha v (@rashmitha_v_d0cfc20ba7152).</description>
    <link>https://dev.to/rashmitha_v_d0cfc20ba7152</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%2F1706011%2F35db1a2a-a040-41d7-9ea6-beccc8e77936.jpg</url>
      <title>DEV Community: Rashmitha v</title>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rashmitha_v_d0cfc20ba7152"/>
    <language>en</language>
    <item>
      <title>Resize image with Node.js and AWS Lambda</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Thu, 25 Jul 2024 17:57:27 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/resize-image-with-nodejs-and-aws-lambda-3ala</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/resize-image-with-nodejs-and-aws-lambda-3ala</guid>
      <description>&lt;p&gt;&lt;strong&gt;Working&lt;/strong&gt;&lt;br&gt;
user upload file to s3 bucket. The bucket will notify the lambda that a new image was uploaded and it passes a key. The lambda will take this key and fetch the original image from the bucket then resize it and do any extra processing that it has to and then store it to a new bucket which will only store the resized images of the original image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&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%2Fsupzrpiif05i9z7jj6dg.jpg" 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%2Fsupzrpiif05i9z7jj6dg.jpg" alt="Image description" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Automate text Message(SMS) notification using SNS and AWS lambda</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Sat, 13 Jul 2024 20:23:05 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/automate-text-messagesms-notification-using-sns-and-aws-lambda-26hg</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/automate-text-messagesms-notification-using-sns-and-aws-lambda-26hg</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;br&gt;
Automating SMS notifications using AWS Lambda and SNS (Simple Notification Service) is a powerful way to keep users informed about important events or updates in your application. AWS Lambda allows you to run code without provisioning or managing servers, while SNS enables you to send messages to a large number of recipients simultaneously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;working:&lt;/strong&gt;&lt;br&gt;
It is a source where the file is uploaded, this s3 bucket is configurated to trigger AWS lambda. lambda contains a python code which which perform event reading mechanism and publish the fully framed messages to SNS topic.To the SNS topic we will make phone and become a subscriber to the SNS topic and msg is publishes that text will receive about the event.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture&lt;/strong&gt; &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%2Fjm119qs4bpcfx9vcqzfj.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%2Fjm119qs4bpcfx9vcqzfj.png" alt="Image description" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;AWS Amazon S3:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;provide the name to the bucket.&lt;/li&gt;
&lt;li&gt;create a bucket.&lt;/li&gt;
&lt;/ul&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%2F2vp4nrt3uvyz9objac5v.jpg" 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%2F2vp4nrt3uvyz9objac5v.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;create a lambda function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;provide the function name.&lt;/li&gt;
&lt;li&gt;use the runtime as python 3.9&lt;/li&gt;
&lt;li&gt;use the existing role&lt;/li&gt;
&lt;/ul&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%2Fk1no6s30ya9blk1aj41s.jpg" 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%2Fk1no6s30ya9blk1aj41s.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;to change the setting click the configurations &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;change the memory size&lt;/li&gt;
&lt;li&gt;change the timeout to reduce the cost&lt;/li&gt;
&lt;li&gt;click save&lt;/li&gt;
&lt;/ul&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%2F72ak6717bdhhu04yuibl.jpg" 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%2F72ak6717bdhhu04yuibl.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click trigger&lt;/li&gt;
&lt;li&gt;add trigger select 's3 bucket' &lt;/li&gt;
&lt;li&gt;click event types and select "all object create events".&lt;/li&gt;
&lt;li&gt;click add&lt;/li&gt;
&lt;/ul&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%2Fz2bk9hfhdtin01hb5af4.jpg" 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%2Fz2bk9hfhdtin01hb5af4.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;paste the lambda code in the code source.&lt;br&gt;
&lt;/p&gt;

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

topic_arn = ""
def send_sns(message, subject):
    try:
        client = boto3.client("sns")
        result = client.publish(TopicArn=topic_arn, Message=message, Subject=subject)
        if result['ResponseMetadata']['HTTPStatusCode'] == 200:
            print(result)
            print("Notification send successfully..!!!")
            return True
    except Exception as e:
        print("Error occured while publish notifications and error is : ", e)
        return True

def lambda_handler(event, context):
    print("event collected is {}".format(event))
    for record in event['Records'] :
        s3_bucket = record['s3']['bucket']['name']
        print("Bucket name is {}".format(s3_bucket))
        s3_key = record['s3']['object']['key']
        print("Bucket key name is {}".format(s3_key))
        from_path = "s3://{}/{}".format(s3_bucket, s3_key)
        print("from path {}".format(from_path))
        message = "The file is uploaded at S3 bucket path {}".format(from_path)
        subject = "Processes completion Notification"
        SNSResult = send_sns(message, subject)
        if SNSResult :
            print("Notification Sent..") 
            return SNSResult
        else:
            return False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;deploy the code and test the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.&lt;strong&gt;create the SNS topic&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click the standard SNS topic. &lt;/li&gt;
&lt;li&gt;provide a name to the SNS topic.&lt;/li&gt;
&lt;li&gt;create a topic&lt;/li&gt;
&lt;/ul&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%2Fk9jsjkrijrgqlxiei6k1.jpg" 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%2Fk9jsjkrijrgqlxiei6k1.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;arn code is generated this code is pasted in the lambda function before deploying and testing the code.&lt;/p&gt;

&lt;p&gt;4.&lt;strong&gt;create subscribers:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;provide the ARN&lt;/li&gt;
&lt;li&gt;select the protocol(SMS)&lt;/li&gt;
&lt;li&gt;SNS endpoint - phone number&lt;/li&gt;
&lt;li&gt;click on text messages(SMS)&lt;/li&gt;
&lt;/ul&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%2Fx30m6rfzg9640qgst94g.jpg" 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%2Fx30m6rfzg9640qgst94g.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click add phone number in - 'sandbox destination phone number'&lt;/li&gt;
&lt;li&gt;add phone no. , select the country and verify.&lt;/li&gt;
&lt;/ul&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%2Fxjmo6jseoyfothc1gux0.jpg" 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%2Fxjmo6jseoyfothc1gux0.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the phone is number is verified.&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%2Fpj90pw78zgwnvvv9660d.jpg" 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%2Fpj90pw78zgwnvvv9660d.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Subscribe Phone Numbers:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;create subscription&lt;/li&gt;
&lt;/ul&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%2F133c0wagg1r731m78vsc.jpg" 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%2F133c0wagg1r731m78vsc.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;choose topic.&lt;/li&gt;
&lt;li&gt;select sms phone number appears after verification.&lt;/li&gt;
&lt;/ul&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%2F5wkmrllxtzxbev94aw35.jpg" 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%2F5wkmrllxtzxbev94aw35.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;upload a dummy file to the trigger point i.e S3 and notification pops as a text message sent to phone.&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%2Fy1vfqwe6i4u7mp3xni88.jpg" 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%2Fy1vfqwe6i4u7mp3xni88.jpg" alt="Image description" width="705" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Build a ChatGPT on AWS</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Sat, 13 Jul 2024 14:02:03 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/build-a-chatgpt-on-aws-ll4</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/build-a-chatgpt-on-aws-ll4</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Introduction&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
ChatGPT is based on OpenAI's GPT (Generative Pre-trained Transformer) architecture. It leverages deep learning to understand and generate human-like text based on the input it receives. Building a ChatGPT involves setting up a similar environment where your model can learn from data and interact with users in a conversational manner.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Service used:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;API Gateway&lt;br&gt;
lambda function&lt;br&gt;
Bedrock&lt;br&gt;
IAM Role&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Create a bedrock:&lt;/strong&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It provides a foundation models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;base models&lt;/li&gt;
&lt;li&gt;custom models&lt;/li&gt;
&lt;li&gt;imported models
the request access should be provided before using.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;click on base model&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no access to any model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;br&gt;
To providing access click on 'enable all models'&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;br&gt;
 uncheck the Anthropic models.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;&lt;em&gt;create an IAM role&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click roles&lt;/li&gt;
&lt;li&gt;choose lambda function as service.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add permissions (bedrockFullAccess)(cloudwatchlogFullAccess)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;provide role name.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.&lt;em&gt;&lt;strong&gt;create a lambda function:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a function name.&lt;/li&gt;
&lt;li&gt;set the run time&lt;/li&gt;
&lt;li&gt;choose existing role.
function is created and click configuration to increase the timeout.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this is our request body the AI model &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%2F6lzoyscxlqzyay8ohrq2.jpg" 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%2F6lzoyscxlqzyay8ohrq2.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;create a lambda code and paste it on the lambda_function.&lt;/p&gt;

&lt;p&gt;4.&lt;strong&gt;&lt;em&gt;create a API Gateway:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
-create a API gateway to create a endpoints&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click on restAPI&lt;/li&gt;
&lt;li&gt;provide a name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;click regional and create a resource.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a method.&lt;/li&gt;
&lt;li&gt;choose method type "POST"&lt;/li&gt;
&lt;li&gt;check the lambda proxy &lt;/li&gt;
&lt;li&gt;choose the lambda function.&lt;/li&gt;
&lt;li&gt;click create the method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Deploy the APT&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deploy the API to a new stage
the API endpoint is create!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this API endpoint will call the lambda function to generate the response.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;copy the lambda endpoint and paste it in the POSTMAN tool.&lt;/li&gt;
&lt;li&gt;select the method as post.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Deploying a serverless web application on S3, API gateway, lambda, DynamoDB</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Mon, 08 Jul 2024 21:11:26 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/deploying-a-serverless-web-application-on-s3-api-gateway-lambda-dynamodb-56dd</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/deploying-a-serverless-web-application-on-s3-api-gateway-lambda-dynamodb-56dd</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Introduction:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Deploying a serverless web application using AWS services such as S3, API Gateway, Lambda, and DynamoDB is a streamlined and cost-effective approach for building scalable applications without managing traditional server infrastructure. This setup leverages cloud-native services that handle scaling, security, and availability automatically, allowing developers to focus on application logic rather than infrastructure maintenance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Serverless Architecture&lt;/em&gt;&lt;/strong&gt;&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%2Fsub6md746f7ul6ijol76.jpg" 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%2Fsub6md746f7ul6ijol76.jpg" alt="Image description" width="800" height="334"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Components of the Serverless Architecture&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pre requisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS account&lt;/li&gt;
&lt;li&gt;IAM role to lambda: Access dynamoDB&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Creating AWS DynamoDB Table:&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Fully managed NoSQL database service to store and retrieve data at scale.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a DynamoDB table by providing a name. (e.g., studentData).&lt;/li&gt;
&lt;/ul&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%2F3xhe7t0bea1s7zw3jrq2.jpg" 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%2F3xhe7t0bea1s7zw3jrq2.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Define Partition key which is used to retrieve or store the data(e.g., studentid)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sort key is define as secondary key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;create table&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%2Fqtiltmsu01yehlc78lhi.jpg" 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%2Fqtiltmsu01yehlc78lhi.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.&lt;em&gt;Creating a Lambda function:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Write Lambda functions to handle CRUD operations (GET, PUT, POST, DELETE) on DynamoDB data&lt;br&gt;
&lt;em&gt;create a function&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;define the function name(getstudent)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;change the runtime to python 3.12&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;define role -use existing role.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fzrbb0mxnm4e6yi5bwx15.jpg" 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%2Fzrbb0mxnm4e6yi5bwx15.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&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%2Faxro2vzzvnydye7to19z.jpg" 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%2Faxro2vzzvnydye7to19z.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;write code&lt;/em&gt;&lt;br&gt;
Lambda function (Python) for handling GET requests.&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 boto3

def lambda_handler(event, context):
    # Initialize a DynamoDB resource object for the specified region
    dynamodb = boto3.resource('dynamodb', region_name='us-east-2')

    # Select the DynamoDB table named 'studentData'
    table = dynamodb.Table('studentData')

    # Scan the table to retrieve all items
    response = table.scan()
    data = response['Items']

    # If there are more items to scan, continue scanning until all items are retrieved
    while 'LastEvaluatedKey' in response:
        response = table.scan(ExclusiveStartKey=response['LastEvaluatedKey'])
        data.extend(response['Items'])

    # Return the retrieved data
    return data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Deploy the above mentioned code&lt;/li&gt;
&lt;/ul&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%2Fttu7gi0fst10g4815lpx.jpg" 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%2Fttu7gi0fst10g4815lpx.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test the code to invoke the lambda function i.e., lambda function will go to dynamo DB table and retrieve the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Lambda function (Python) for POSTING DATA&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a function(E.g., insertStudentData)&lt;/li&gt;
&lt;li&gt;select python 3.12 provide the roles.&lt;/li&gt;
&lt;li&gt;create a function.&lt;/li&gt;
&lt;/ul&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%2F9d1oreizav99vuk1z1k8.jpg" 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%2F9d1oreizav99vuk1z1k8.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create a DynamoDB object using the AWS SDK
dynamodb = boto3.resource('dynamodb')
# Use the DynamoDB object to select our table
table = dynamodb.Table('studentData')

# Define the handler function that the Lambda service will use as an entry point
def lambda_handler(event, context):
    # Extract values from the event object we got from the Lambda service and store in variables
    student_id = event['studentid']
    name = event['name']
    student_class = event['class']
    age = event['age']

    # Write student data to the DynamoDB table and save the response in a variable
    response = table.put_item(
        Item={
            'studentid': student_id,
            'name': name,
            'class': student_class,
            'age': age
        }
    )

    # Return a properly formatted JSON object
    return {
        'statusCode': 200,
        'body': json.dumps('Student data saved successfully!')
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Deploy the code&lt;/li&gt;
&lt;li&gt;test the code&lt;/li&gt;
&lt;/ul&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%2Fwb4gm4hjzdjxnh9q3qd4.jpg" 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%2Fwb4gm4hjzdjxnh9q3qd4.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;student data will be stores in dynamo DB table &lt;/li&gt;
&lt;/ul&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%2Fsw89rq9z9hms4yo4kzub.jpg" 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%2Fsw89rq9z9hms4yo4kzub.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create API gateway&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Create RESTful APIs to trigger Lambda functions to store or retrieve the datas in Dynamo DB table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create API endpoints (GET, POST, PUT, DELETE) in API Gateway that trigger your Lambda functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;provide the API name student&lt;br&gt;
-click API endpoint type - use (edge optimized) as it allow all the user. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fcwox5skto0gjkdmto9ro.jpg" 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%2Fcwox5skto0gjkdmto9ro.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&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%2Fcx7ob7trnp1v7les82o6.jpg" 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%2Fcx7ob7trnp1v7les82o6.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Create methods - get and post methods&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GET method&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click on create method&lt;/li&gt;
&lt;li&gt;method type - GET&lt;/li&gt;
&lt;li&gt;integration type choose - lambda function&lt;/li&gt;
&lt;li&gt;select lambda function - getStudent&lt;/li&gt;
&lt;li&gt;method GET will be created.&lt;/li&gt;
&lt;/ul&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%2F7m0ko483ktxwrbipsayi.jpg" 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%2F7m0ko483ktxwrbipsayi.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POST method&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;method type - POST&lt;/li&gt;
&lt;li&gt;select lambda function - insertStudentData&lt;/li&gt;
&lt;li&gt;click create method&lt;/li&gt;
&lt;/ul&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%2F3hp1gom7d3z6qe37n6hv.jpg" 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%2F3hp1gom7d3z6qe37n6hv.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Deploy API&lt;/em&gt;&lt;br&gt;
Deploy your API to a stage (e.g., prod) and note down the Invoke URL provided by API Gateway.&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%2F5fkg7poytkg4r22ogp8d.jpg" 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%2F5fkg7poytkg4r22ogp8d.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste the URL in API ENDPOINT code.&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%2Farw6pfaontvttanjz5m9.jpg" 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%2Farw6pfaontvttanjz5m9.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/ Add your API endpoint here
var API_ENDPOINT = "API_ENDPOINT_PASTE_HERE";

// AJAX POST request to save student data
document.getElementById("savestudent").onclick = function(){
    var inputData = {
        "studentid": $('#studentid').val(),
        "name": $('#name').val(),
        "class": $('#class').val(),
        "age": $('#age').val()
    };
    $.ajax({
        url: API_ENDPOINT,
        type: 'POST',
        data:  JSON.stringify(inputData),
        contentType: 'application/json; charset=utf-8',
        success: function (response) {
            document.getElementById("studentSaved").innerHTML = "Student Data Saved!";
        },
        error: function () {
            alert("Error saving student data.");
        }
    });
}

// AJAX GET request to retrieve all students
document.getElementById("getstudents").onclick = function(){  
    $.ajax({
        url: API_ENDPOINT,
        type: 'GET',
        contentType: 'application/json; charset=utf-8',
        success: function (response) {
            $('#studentTable tr').slice(1).remove();
            jQuery.each(response, function(i, data) {          
                $("#studentTable").append("&amp;lt;tr&amp;gt; \
                    &amp;lt;td&amp;gt;" + data['studentid'] + "&amp;lt;/td&amp;gt; \
                    &amp;lt;td&amp;gt;" + data['name'] + "&amp;lt;/td&amp;gt; \
                    &amp;lt;td&amp;gt;" + data['class'] + "&amp;lt;/td&amp;gt; \
                    &amp;lt;td&amp;gt;" + data['age'] + "&amp;lt;/td&amp;gt; \
                    &amp;lt;/tr&amp;gt;");
            });
        },
        error: function () {
            alert("Error retrieving student data.");
        }
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If click on get-student data it will invoke the URL and lambda function will be triggered and it will retrieve data from dynamo DB table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click resources &lt;/li&gt;
&lt;li&gt;enable CORS
-Select GET and POST and  click save&lt;/li&gt;
&lt;/ul&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%2Fvl53b371s06vl2etlk54.jpg" 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%2Fvl53b371s06vl2etlk54.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Setting Up AWS S3&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create an S3 Bucket:&lt;/p&gt;

&lt;p&gt;Go to the AWS Management Console and navigate to S3.&lt;br&gt;
Click on "Create bucket" and follow the wizard to create a bucket (e.g., your-bucket-name).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Upload Static Web Content:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Upload your web application files (index.html,script.js) to the S3 bucket.&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%2Fgwns7iy9jtguxb15l72u.jpg" 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%2Fgwns7iy9jtguxb15l72u.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the uploaded files and make them public by setting the permissions to allow public read access.&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%2Fphvzlxm2y4znly813sha.jpg" 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%2Fphvzlxm2y4znly813sha.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Enable Static Website Hosting:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the bucket properties, navigate to "Static website hosting".&lt;br&gt;
Select "Use this bucket to host a website" and enter index.html as the Index document.&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%2F1okryesdjj4ctsf4ab3p.jpg" 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%2F1okryesdjj4ctsf4ab3p.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our application is deployed in dynamo DB table!&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%2F7wltzg1rf3pge89zpf9c.jpg" 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%2F7wltzg1rf3pge89zpf9c.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&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%2F3viku6ynoi10yaqwq9ho.jpg" 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%2F3viku6ynoi10yaqwq9ho.jpg" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Conclusion&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Deploying a serverless web application using S3, API Gateway, Lambda, and DynamoDB offers scalability, cost-efficiency, and ease of maintenance. By leveraging these AWS services, developers can focus more on building application logic and less on managing infrastructure. This architecture is ideal for modern web applications that require flexibility, scalability, and seamless integration with backend services like DynamoDB&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a DynamoDB Table and Setting Up IAM Access Control</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Mon, 08 Jul 2024 18:33:40 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/creating-a-dynamodb-table-and-setting-up-iam-access-control-4f1k</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/creating-a-dynamodb-table-and-setting-up-iam-access-control-4f1k</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Introduction to DynamoDB Tables&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Amazon DynamoDB is a fully managed NoSQL database service provided by AWS (Amazon Web Services). It offers high performance, seamless scalability, and low latency for applications needing consistent, single-digit millisecond response times. DynamoDB is particularly well-suited for applications requiring fast and predictable performance with seamless scalability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Architecture:&lt;/em&gt;&lt;/strong&gt;&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%2Ft0a9pu1g6rrn1hhbs67o.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%2Ft0a9pu1g6rrn1hhbs67o.png" alt="Image description" width="800" height="697"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;_Step 1:Create a DynamoDB table for student details _&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the DynamoDB dashboard and click “Create table”, as show below. &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%2Fml1qk453hs4a9ap0vpun.jpg" 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%2Fml1qk453hs4a9ap0vpun.jpg" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When creating your DynamoDB table, you need to choose a name for the table and specify a Partition key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Partition key determines the partition in which the data is stored, while the Sort key helps in sorting the data within the partition based on its value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once you have named your table and assigned a partition key, navigate to the “Table settings” section.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;simply click the “Create table” button in orange to initiate the table creation process&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step2 :Add items to DynamoDB table&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choose your recently created table from the list. In the left panel, click on “Explore items” and then select “Create item” to begin creating a new item within the table.&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%2F6uhu912vp4u4hyqaqg75.jpg" 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%2F6uhu912vp4u4hyqaqg75.jpg" alt="Image description" width="800" height="337"&gt;&lt;/a&gt;&lt;br&gt;
We are adding 6 student detail to the table.&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%2F2cp7gyw50kn9gy5ja181.jpg" 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%2F2cp7gyw50kn9gy5ja181.jpg" alt="Image description" width="800" height="337"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Step 3: Launch EC2 with IAM role to scan DynamoDB table&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Launching an EC2 instance with an IAM role that allows it to scan a DynamoDB table involves several steps, including creating an IAM role with appropriate permissions, launching the EC2 instance with that IAM role, and writing code on the EC2 instance to interact with DynamoDB. &lt;/p&gt;

&lt;p&gt;In the next screen, give your role a name and click “Create role.”&lt;br&gt;
&lt;strong&gt;&lt;em&gt;step 4: Attach Policy&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the permissions tab, click "Attach policies directly".&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%2Fcqjpj6ymnbcpl2nsr74h.jpg" 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%2Fcqjpj6ymnbcpl2nsr74h.jpg" alt="Image description" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search for and attach the AmazonDynamoDBReadOnlyAccess policy (or create a custom policy with specific dynamodb:Scan permissions).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 5: Use the AWS CLI in the EC2 instance to scan the DynamoDB table&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Navigate to the EC2 dashboard, then select your EC2 Instance.Then connect into your EC2 Instance by selection one of these ways:&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%2F2lov845s0sa5sx29pqnh.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%2F2lov845s0sa5sx29pqnh.png" alt="Image description" width="720" height="524"&gt;&lt;/a&gt;&lt;br&gt;
I selected EC2 Instance Connect. We are now connected to our instance and ready to scan the table using the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws dynamodb scan --table-name &amp;lt;table_name&amp;gt; --region &amp;lt;region_name&amp;gt;

&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%2Fl3eg3moutslf9cqes730.jpg" 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%2Fl3eg3moutslf9cqes730.jpg" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Benefits:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Scalability&lt;/em&gt;: DynamoDB scales automatically to handle any amount of traffic and storage.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Performance&lt;/em&gt;: Provides single-digit millisecond latency for read and write operations.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Security&lt;/em&gt;: IAM enables granular access control to DynamoDB resources, enhancing security posture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Conclusion:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Setting up a DynamoDB table and configuring IAM access control ensures your application’s data storage is scalable, performant, and secure. By following best practices in defining table schemas, creating IAM policies, and integrating services, you establish a robust foundation for building cloud-native applications on AWS. This architecture supports modern application requirements with flexibility and resilience in data management.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Transforming Cloud Infrastructure with Terraform: Build, Change, Deploy</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Sun, 30 Jun 2024 12:17:32 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/transforming-cloud-infrastructure-with-terraform-build-change-deploy-4o4g</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/transforming-cloud-infrastructure-with-terraform-build-change-deploy-4o4g</guid>
      <description>&lt;p&gt;In today's cloud-centric landscape, managing infrastructure efficiently is key to scalability and reliability. Enter Terraform, an Infrastructure as Code (IaaC) tool that revolutionizes how we provision, manage, and evolve cloud resources across platforms like AWS, Azure, and Google Cloud. With Terraform, you define your infrastructure in declarative configuration files, ensuring consistency and repeatability. This process allows for swift deployment and seamless updates through its plan-apply cycle, enabling rapid iteration and ensuring infrastructure changes are predictable and reliable. Whether you're automating the setup of a new environment or orchestrating complex multi-cloud architectures, Terraform power lies in its ability to codify infrastructure as easily as software, unlocking agility and scalability while reducing operational overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Building the infrastructure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Terraform Configuration&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Each Terraform configuration must be in its own working directory. Create a directory for your configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir terraform-learning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change into the directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd terraform-learning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a file to define your infrastructure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code main.tf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open main.tf in your text editor, give the configuration below, and save the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~&amp;gt; 4.16"
    }
  }

  required_version = "&amp;gt;= 1.2.0"
}

provider "aws" {
  region  = "us-west-2"
}

resource "aws_instance" "My_app_server" {
  ami           = "ami-830c94e3"
  instance_type = "t2.micro"

  tags = {
    Name = "ExampleInstance"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;em&gt;Initialize the Terraform&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;3. Create the infrastructure&lt;/em&gt;&lt;br&gt;
Apply the configuration now with the terraform apply command.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Changing the infrastructure&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;1: Configuration of new AMI&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_instance" "My_app_server" {
-  ami           = "ami-830c94e3"
+  ami           = "ami-08d70e59c07c61a3a"
   instance_type = "t2.micro"
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;2: Apply the changes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After changing the configuration, run terraform apply again to see how Terraform will apply this change to the existing resources.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Destroy the infrastructure&lt;/em&gt;&lt;br&gt;
Once you no longer need infrastructure, you may want to destroy it to reduce your security exposure and costs.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The terraform destroy command terminates resources managed by your Terraform project.&lt;br&gt;
&lt;strong&gt;Defining the Input Variable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1: Set the instance name with variable&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Create a new file called variables.tf with a block defining a new instance_name variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable "instance_name" {
  description = "Value of the Name tag for the EC2 instance"
  type        = string
  default     = "ExampleInstance"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;2: Update main.tf&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In main.tf, update the aws_instance resource block to use the new variable. The instance_name variable block will default to its default value ("ExampleInstance") unless you declare a different value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_instance" "My_app_server" {
   ami           = "ami-08d70e59c07c61a3a"
   instance_type = "t2.micro"

   tags = {
-    Name = "ExampleInstance"
+    Name = var.instance_name
   }
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;3: Apply Configuration&lt;/em&gt;_&lt;br&gt;
Apply the configuration. Enter yes to confirm the cofiguration.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;4: Passing the variable&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now apply the configuration again, this time overriding the default instance name by passing in a variable using the -var flag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform apply -var "instance_name=SecondNameForInstance"

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Query the Data&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;1: Output EC2 instance configuration&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Create a file called outputs.tf in your learn-terraform-aws-instance directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code output.tf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;2: Inspect output values&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Apply the configuration and enter yes to confirm it.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;3: Query Output value&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Query the outputs with the terraform output command.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;In conclusion, Terraform stands as a transformative tool in the realm of cloud infrastructure management. By leveraging Infrastructure as Code principles, Terraform enables organizations to streamline the deployment and management of cloud resources across various providers. Its declarative configuration approach ensures consistency and reliability, facilitating rapid iteration and scalability. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating and Managing IAM users from Your EC2 instance</title>
      <dc:creator>Rashmitha v</dc:creator>
      <pubDate>Sun, 30 Jun 2024 10:27:11 +0000</pubDate>
      <link>https://dev.to/rashmitha_v_d0cfc20ba7152/creating-and-managing-iam-users-from-your-ec2-instance-4a6l</link>
      <guid>https://dev.to/rashmitha_v_d0cfc20ba7152/creating-and-managing-iam-users-from-your-ec2-instance-4a6l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
Creating and managing IAM users from an EC2 instance involves a few steps to ensure proper security and access control. Here’s a general guide on how to accomplish this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br&gt;
Create a EC2 instance.&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%2F53ynxokgyaq5xh8uoo4k.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%2F53ynxokgyaq5xh8uoo4k.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;step 2:&lt;/strong&gt;&lt;br&gt;
Connect to your EC2 instance using SSH.&lt;br&gt;
open your terminal and run the following command &lt;br&gt;
&lt;code&gt;ssh -i path_to_your_key.pem ec2-user@your_ec2_public_dns&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;step 3:&lt;/strong&gt;&lt;br&gt;
create a new user&lt;br&gt;
once connected to your EC2 instance, you can create a new user.&lt;br&gt;
Use this command,replace new_username with the desired username:&lt;br&gt;
&lt;code&gt;sudo adduser new_username&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;br&gt;
set a password for the new user.&lt;br&gt;
use the following code:&lt;br&gt;
&lt;code&gt;sudo passwd new_username&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;step 5:&lt;/strong&gt;&lt;br&gt;
verify the new user.&lt;br&gt;
To verify that the user has been created successfully, use this command:&lt;br&gt;
&lt;code&gt;cat /etc/passwd&lt;/code&gt;&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%2Fhogwqdrixrf5gbqc9aef.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%2Fhogwqdrixrf5gbqc9aef.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, managing IAM users from your EC2 instance involves leveraging the AWS CLI and adhering to best practices for security and access control.&lt;/p&gt;

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