<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rahul Patel on Medium]]></title>
        <description><![CDATA[Stories by Rahul Patel on Medium]]></description>
        <link>https://medium.com/@U_N_R_3_A_L?source=rss-1c276ec63bf7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*1dACTK2pJV4Bnyek</url>
            <title>Stories by Rahul Patel on Medium</title>
            <link>https://medium.com/@U_N_R_3_A_L?source=rss-1c276ec63bf7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 15:52:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@U_N_R_3_A_L/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Professional way to setup your AWS account.]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/professional-way-to-setup-your-aws-account-a3f4e925502a?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3f4e925502a</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[sso]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Sun, 12 Jan 2025 05:02:08 GMT</pubDate>
            <atom:updated>2025-01-12T05:02:08.545Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQVJjwYS9Q6Uz_HQOpwEdg.png" /></figure><p>AWS is a very powerful tool to build and deploy applications, but with great power comes great responsibility. Security in today’s world is more important than ever. Attackers can exploit the compromised AWS accounts for malicious activities and leave you paying for the consumed resources while your data is put at serious risk. Personal experience: Someone got into my AWS account once from an access key I had made public in a blog. Thank goodness, AWS warned me; I was able to remove those compromised keys within hours. I learned a great lesson about keeping access to my AWS resources tight.</p><p><strong>Traditionally, developers configured AWS access using IAM users and long-lived access keys. This setup involved creating IAM users, managing access keys, and using tools like </strong><strong>aws-vault or </strong><strong>awsume to handle credentials securely. However, this approach carries risks—especially if access keys are accidentally exposed. AWS IAM Identity Center solves many of these issues by offering secure, temporary credentials without the need for long-term access keys.</strong></p><p>In this tutorial, I am going to explain the process of getting AWS IAM Identity Center configured for a safe and professional AWS development environment.</p><h3>Benefits of Using AWS IAM Identity Center</h3><ul><li><strong>Enhanced Security:</strong> AWS IAM Identity Center eliminates the need for long-lived access keys by providing temporary credentials, reducing the risk of accidental exposure.</li><li><strong>Centralized Access Management:</strong> Manage user access to multiple AWS accounts from a single console.</li><li><strong>Seamless CLI Integration:</strong> Easily configure AWS CLI for secure access without handling access keys.</li><li><strong>Built-in Multi-Factor Authentication (MFA):</strong> <strong>AWS IAM Identity Center</strong> supports MFA for added security.</li></ul><h3>Step-by-Step Configuration</h3><h3>1. Create an AWS Account</h3><p>Use root account exclusively for managing AWS Organizations and SSO. Do not deploy resources in this account.</p><h3>2. Set Up AWS Organizations</h3><ul><li>Search for AWS Organizations and Open it, you will see something like below image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQJR-eKzzkfo2EeRzuMKrA.png" /></figure><ul><li>Create OUs for <strong>Production</strong> and <strong>Development</strong> environments. (Create as per your needs).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4VXPoBXiB6PKaVRd4n3ZCA.png" /></figure><ul><li>Now Select any OU and <strong>Click Add an AWS Account</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3ksSQfh5Bb4yHIkZZsnxg.png" /></figure><ul><li>Add details and Create AWS account and to create a new AWS account using your primary email address, you can simply add a postfix with the + symbol. For example, if your primary email is foobar@gmail.com, you can create a new account by using foobar+dev@gmail.com or any variation like foobar+project@gmail.com. Emails sent to these addresses will still be delivered to your main inbox (foobar@gmail.com), allowing you to manage multiple AWS accounts without needing separate email addresses.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*mLHt4QlWs31-SvQJeftykg.png" /></figure><ul><li>Follow the same process to add account in other OUs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*32FwSTyq0smwbadggdq46Q.png" /></figure><h3>3. Set Up IAM Identity Center</h3><ul><li>In the search bar, look for IAM Identity Cemter. The <em>IAM </em>search phrase should do. Click on the service tile to go to its dashboard.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hgqfgwll6CHvrDSTr6-Ghg.png" /></figure><ul><li>Next, we have to create permission set, It is a collection of IAM policies you will be acquiring when login through SSO into a given account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ltngK1vxi6FdH6grH8SEpA.png" /></figure><ul><li>Select the permission set type based on your need, there are some predefind permission set but you can create your own as well</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*y7EnVgte0OsGdGFY1tSvCQ.png" /></figure><ul><li>Now, we have to create a user that can sign in to an AWS IAM Identity Center portal. create a user with all the ncesseary information, Once that user is created you will see that user in User section as below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFBZPr9MwQqr8xYHoGC9yw.png" /></figure><ul><li>As SSO user is created now we are going to integrate it with permission set and an AWS account thta we created in AWS organization. Follow same step for All the account you want to integrate.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-k98nQgzpqs0pWYyB_CprQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*c_Y-Lz4s5i5zQx9fFca_3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZoDKLdJyoE3oI8eHvU63XA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9NXU_yaY9MivDeCvDIgk0Q.png" /></figure><h3>4. Testing Your Setup</h3><h4>Console Access</h4><ul><li>Copy the <strong>User Portal URL</strong> from the <strong>IAM Identity Center</strong> dashboard.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-DOPzc-i3g_VCe-qK7-Ag.png" /></figure><ul><li>Log in with the IAM Identity Center user credentials.</li><li>Select the AWS account and permission set.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ncmeDrNpM33dcryT7hHzg.png" /></figure><ul><li>AdministratorAccess will redirect you to a given AWS account management console.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fc3kWCIXHmNc7GqMqOQe4w.png" /></figure><h3>Final Thoughts</h3><p>Setting up <strong>IAM Identity Center </strong>might seem like extra work initially, but it drastically improves security and makes managing multiple AWS accounts seamless. I highly recommend bookmarking your <strong>IAM Identity Center</strong> User Portal.</p><p>Got questions or feedback? Drop a comment below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3f4e925502a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking Your Way to a Cloud Job ]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/networking-your-way-to-a-cloud-job-245c62a13ae2?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/245c62a13ae2</guid>
            <category><![CDATA[professional-development]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[jobs]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Thu, 02 Jan 2025 05:31:33 GMT</pubDate>
            <atom:updated>2025-01-02T05:31:33.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsLazcjDZFygoRyPjOL54w.jpeg" /></figure><p>Breaking into cloud engineering can feel overwhelming, but there’s a better way to land your dream job than relying on what I call “Resume Roulette.” Let’s explore why this approach doesn’t work — and how to create your own luck instead. 🌟</p><h3>🎯 Why Resume Roulette Fails</h3><p>Resume Roulette is frustrating because it’s mostly luck-based:</p><ol><li>Wait for job postings to go live.</li><li>Send out dozens or even hundreds of applications. 📨</li><li>Hope someone notices your resume. 🤞</li><li>Repeat until hired — or burnt out. 🔄</li></ol><p>While some succeed this way, many others lose motivation and quit the process. Even worse? You might land a role that doesn’t suit you at all. 😟</p><h3>👀 What Really Happens During Hiring</h3><p>When companies post jobs, here’s a typical scenario:</p><ul><li><strong>400+ resumes flood in.</strong> Some good, some bad.</li><li><strong>2 employees submit referrals</strong> for people they’ve worked with and trust.</li></ul><p>Guess who gets priority? Recruiters often pick referrals because they’re pre-vetted. Companies even offer bonuses for this! 💸 This isn’t unfair — it’s efficient. But it means your goal should be to become someone who gets referred. 🤝</p><h3>🎮 Switch to a Winning Game: Network Bets</h3><p>Unlike Resume Roulette, Network Bets is a strategy with two simple rules:</p><ol><li><strong>Own your credibility.</strong> ✅</li><li><strong>Build meaningful connections.</strong> 🌐</li></ol><h3>1️⃣ Own Your Credibility</h3><p>First, make sure your skills shine:</p><ul><li><strong>Coding:</strong> Learn Python or another backend language.</li><li><strong>Systems Knowledge:</strong> Get comfortable with Linux and basic networking.</li><li><strong>Certifications:</strong> Earn an AWS Certified Developer or similar credential.</li></ul><p>Want to really stand out? Build expertise in an emerging area. Instead of competing with experienced professionals in established tools, focus on:</p><ul><li><strong>AWS Step Functions, AWS Code Pipeline, AWS Bedrock, AWS App Runner or Azure Logic Apps</strong> (serverless workflows). 🌉</li><li><strong>Terraform or AWS CDK</strong> (Infrastructure as Code). 🛠️</li><li><strong>Managed Kubernetes</strong> like EKS, AKS, or GKE. 🐳</li></ul><p>Specializing in a niche makes you memorable and sought after. 🌟</p><h3>2️⃣ Build Connections Without the Awkwardness</h3><p>Networking doesn’t have to be scary or exhausting. Instead of cold-calling strangers, let your work speak for you. Here’s how:</p><ul><li><strong>Start Writing:</strong> Share your learning journey on platforms like Hashnode or dev.to. For example, blog about a project you’ve built or a cool feature you discovered. ✍️</li><li><strong>Engage Online:</strong> Join Slack/Discord communities and follow influencers in your niche. Respond to tweets or LinkedIn posts with genuine insights or questions. 🗨️</li><li><strong>Ask for Referrals:</strong> Once you’ve built a connection, don’t hesitate to ask for a referral. Most people are happy to help — and companies incentivize them to! 🔗</li></ul><h3>⏳ The Long Game Pays Off</h3><p>Building skills, choosing a niche, and connecting with others takes time — maybe 6 to 12 months. But this investment is worth it. Compare that to Resume Roulette, which often:</p><ul><li>Wastes months with no results. 🕰️</li><li>Leaves you demoralized. 😞</li><li>Lands you in a mismatched role. ❌</li></ul><p>By playing Network Bets, you control your career path. You’ll attract opportunities instead of chasing them. 🎉</p><h3>🚀 Start Today</h3><p>Skip the endless job applications. Instead, build your skills, share your work, and connect with others in the field. Your dream cloud job is closer than you think! 🌈</p><p><strong>Reference:</strong> This article was inspired by insights from the <em>Cloud Resume Challenge: AWS Edition Handbook.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=245c62a13ae2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Step Functions: Automating Serverless Workflows with Ease]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/aws-step-functions-automating-serverless-workflows-with-ease-63357d836140?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/63357d836140</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws-step-functions]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Sat, 07 Dec 2024 11:10:24 GMT</pubDate>
            <atom:updated>2024-12-07T11:10:24.448Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*b5FTuPCzFlukzQeseOL4Ow.jpeg" /></figure><p>In modern cloud-native applications, orchestrating workflows between multiple AWS services efficiently is essential. AWS Step Functions simplify this process by enabling you to design and implement complex workflows without needing to manage server infrastructure. With the ability to coordinate AWS Lambda functions, APIs, and other AWS services, Step Functions helps you automate tasks seamlessly and efficiently.</p><h3>What is AWS Step Functions?</h3><p>AWS Step Functions is a fully managed service that enables the orchestration of microservices and serverless applications. It lets you coordinate the components of distributed applications, making it easier to build and manage sophisticated workflows.</p><p>By using Amazon States Language (ASL), a JSON-based language, Step Functions defines the steps involved in a workflow. These steps can be Lambda functions, activity tasks, or service integrations (such as calling Amazon SNS, SQS, or DynamoDB).</p><h3>Why is AWS Step Functions Important?</h3><ul><li><strong>Simplified Workflow Management:</strong> Step Functions allow you to design workflows as a series of steps. Each step can invoke AWS Lambda functions or other AWS services, reducing the complexity of managing these tasks manually.</li><li><strong>Error Handling and Retries:</strong> It provides built-in error handling, retries, and parallel execution, ensuring robust workflows.</li><li><strong>Visual Workflow Representation:</strong> Step Functions offers a graphical interface, which makes it easy to visualize and monitor workflows, ensuring you can track each step’s progress and diagnose any issues.</li><li><strong>Scalability and Flexibility:</strong> Since Step Functions integrate with various AWS services, you can scale your application seamlessly without worrying about the underlying infrastructure.</li></ul><h3>Example Use Case: Conditional Lambda Execution</h3><p>In this example, we will demonstrate how AWS Step Functions can invoke a Lambda function based on conditions. The Lambda function will return output, and based on that, the Step Function will make decisions and proceed accordingly. Here’s the workflow definition in JSON:</p><pre>{<br>  &quot;Comment&quot;: &quot;A Hello World example of the Amazon States Language using Pass states&quot;,<br>  &quot;StartAt&quot;: &quot;Lambda Invoke&quot;,<br>  &quot;States&quot;: {<br>    &quot;Lambda Invoke&quot;: {<br>      &quot;Type&quot;: &quot;Task&quot;,<br>      &quot;Resource&quot;: &quot;arn:aws:states:::lambda:invoke&quot;,<br>      &quot;OutputPath&quot;: &quot;$.Payload&quot;,<br>      &quot;Parameters&quot;: {<br>        &quot;Payload.$&quot;: &quot;$&quot;,<br>        &quot;FunctionName&quot;: &quot;arn:aws:lambda:us-east-1:920868724606:function:HelloWorldStepFun:$LATEST&quot;<br>      },<br>      &quot;Retry&quot;: [<br>        {<br>          &quot;ErrorEquals&quot;: [<br>            &quot;Lambda.ServiceException&quot;,<br>            &quot;Lambda.AWSLambdaException&quot;,<br>            &quot;Lambda.SdkClientException&quot;,<br>            &quot;Lambda.TooManyRequestsException&quot;<br>          ],<br>          &quot;IntervalSeconds&quot;: 1,<br>          &quot;MaxAttempts&quot;: 3,<br>          &quot;BackoffRate&quot;: 2<br>        }<br>      ],<br>      &quot;Next&quot;: &quot;Is Developer?&quot;<br>    },<br>    &quot;Is Developer?&quot;: {<br>      &quot;Type&quot;: &quot;Choice&quot;,<br>      &quot;Choices&quot;: [<br>        {<br>          &quot;Variable&quot;: &quot;$&quot;,<br>          &quot;StringMatches&quot;: &quot;*Rahul*&quot;,<br>          &quot;Next&quot;: &quot;Developer&quot;<br>        }<br>      ],<br>      &quot;Default&quot;: &quot;Not Developer&quot;<br>    },<br>    &quot;Developer&quot;: {<br>      &quot;Type&quot;: &quot;Pass&quot;,<br>      &quot;Result&quot;: &quot;Woohoo!&quot;,<br>      &quot;End&quot;: true<br>    },<br>    &quot;Not Developer&quot;: {<br>      &quot;Type&quot;: &quot;Fail&quot;,<br>      &quot;Error&quot;: &quot;ErrorCode&quot;,<br>      &quot;Cause&quot;: &quot;Rahul developer wasn&#39;t found by the lambda invoke function&quot;<br>    }<br>  }<br>}</pre><h3>Explanation of the Workflow:</h3><ol><li><strong>Lambda Invoke</strong>: The workflow starts by invoking an AWS Lambda function. This Lambda function could be responsible for tasks such as fetching data, processing a request, or performing a computation. The Lambda Invoke state defines the function&#39;s ARN (Amazon Resource Name) and specifies the payload to pass to the function.</li><li><strong>Is Developer?</strong>: This state checks if the payload returned by the Lambda function matches a specific value (&quot;Rahul&quot; in this case). It uses the Choice state type to make this decision. If the condition is true, it moves to the Developer state; otherwise, it transitions to Not Developer.</li><li><strong>Developer</strong>: If the Lambda function output contains the string “Rahul,” the workflow continues to the Developer state, which is a Pass state that simply returns the result &quot;Woohoo!&quot; and ends the workflow successfully.</li><li><strong>Not Developer</strong>: If the Lambda function’s output does not match the expected condition, the Not Developer state triggers a Fail state. This helps identify when a condition is not met, making it easier to diagnose issues in the workflow.</li></ol><h3>Key Features of AWS Step Functions:</h3><ul><li><strong>State Management</strong>: Each step in the workflow can carry its state information, which can be passed along to the next step, making the workflow highly flexible.</li><li><strong>Retry Logic</strong>: As seen in the example, the Lambda Invoke state includes retry logic to handle errors. If a Lambda function fails due to service exceptions or network issues, Step Functions will automatically retry the task, ensuring resilience.</li><li><strong>Choice States</strong>: The Choice state lets you introduce conditional logic, making workflows dynamic. Depending on the Lambda function output or input data, you can determine the flow of execution.</li><li><strong>Error Handling</strong>: AWS Step Functions provide built-in error handling mechanisms. For instance, you can define fallback strategies like Retry and Catch to handle failures.</li></ul><h3>Real-World Use Case: Automating Serverless Applications</h3><p>Consider a scenario where you need to automate a user registration process. After a user submits their registration details, AWS Step Functions can coordinate multiple tasks:</p><ul><li>Invoke a Lambda function to verify the data.</li><li>Send a confirmation email using Amazon SES.</li><li>Store user data in DynamoDB.</li><li>Trigger a notification in Amazon SNS.</li></ul><p>By using Step Functions, you can ensure that each task is executed in the correct sequence, manage retries in case of failure, and handle any conditional logic that might arise based on user input or system state.</p><h3>Conclusion</h3><p>AWS Step Functions provide a powerful way to automate and orchestrate workflows in the cloud. With its ease of use, flexibility, and built-in error handling, it is an essential tool for modern serverless applications. Whether you’re managing simple tasks or complex, multi-step workflows, Step Functions enable you to create, monitor, and maintain your workflows effortlessly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63357d836140" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Resume ready project using AWS Lambda and EventBridge to Convert AWS EBS Volume type GP2 To GP3]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/aws-resume-ready-project-using-aws-lambda-and-eventbridge-to-convert-aws-ebs-volume-type-gp2-to-gp3-09d3ba8afa72?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/09d3ba8afa72</guid>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Fri, 12 Apr 2024 09:05:43 GMT</pubDate>
            <atom:updated>2024-04-12T09:05:43.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*_sit4iNsgll99EgDOZVl6Q.png" /></figure><p><strong>Objective</strong><br>Trigger a Lambda function when an Amazon Elastic Block Store (EBS) volume is created of type GP2 and convert them to type GP3.</p><p><strong>Overview</strong><br>1. Create a Lambda Function and Add code logic to convert EBS Volume type.</p><p>2. Create an EventBridge event to trigger the Lambda function.</p><p><strong>Pre-requisites</strong></p><ul><li>Basic knowledge of AWS Lambda and Python Language.</li><li>Working AWS account.</li></ul><p><strong>1. Create a Lambda Function and Add code logic to convert EBS Volume type</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U7azGLk8-2IeLLBV.png" /></figure><ul><li>Create the lambda function with the name of your choice and select the Python latest runtime, Leave the rest setting as it is.</li><li>Replace the following code in the Lambda function.</li></ul><pre>import re<br>import boto3<br><br>client = boto3.client(&#39;ec2&#39;)<br><br>def get_volume_id_from_arn(volume_arn):<br>    return re.search(r&#39;vol-[a-f0-9]+&#39;, volume_arn).group()<br><br>def lambda_handler(event, context):<br>    vol_arn = event[&#39;resources&#39;][0]<br>    vol_id = get_volume_id_from_arn(vol_arn)<br>    response = client.modify_volume(<br>        VolumeId=vol_id,<br>        VolumeType=&#39;gp3&#39;,<br>    )<br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps(&#39;Hello from Lambda!&#39;)<br>    }</pre><ul><li>get_volume_id_from_arn(volume_arn): This is a custom function defined to extract the volume ID from an Amazon Resource Name (ARN). It uses a regular expression to search for a pattern that matches the volume ID in the ARN and returns it.</li><li>vol_arn = event[&#39;resources&#39;][0]: It retrieves the ARN of the resource that triggered the Lambda function from the event parameter. The assumption here is that the Lambda function is triggered by an event related to an Amazon EC2 volume.</li><li>response = client.modify_volume(...): This line uses the Boto3 client to modify the volume identified by the volume ID extracted earlier. It changes the volume type to &#39;gp3&#39;, which is a type of General Purpose SSD (gp3) volume in Amazon EC2.</li></ul><ol><li><strong>Create an EventBridge event to trigger the Lambda function</strong></li></ol><ul><li>Open Rule in AWS Event Bridge and go to Rules and then Create Rules to Create Rule.</li><li>A rule watches for specific types of events. When a matching event occurs, the event is routed to the targets associated with the rule. A rule can be associated with one or more targets.)</li><li>In Our case, When the EBS volumes get created the EventBridge will listen to that event and route that event to Lambda function.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B4u8bV8qlo9YyAqM.png" /></figure><ul><li>Add the Name and description as per your choice and leave the default setting.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1BRb_vOvZBc7X4xS.png" /></figure><ul><li>On the next page leave the default setting and scroll down to the last section <strong>Event pattern.</strong></li><li>Select EC2 AWS Service, <strong>EBS Volume Notification</strong> in Event type, Event type specification should be Specific event(s), and select <strong>modifyVolume</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/0*EteM1pr470baUJCR.png" /></figure><ul><li>On the next page in the Target Section select AWS Lambda in AWS Service and select the Lambda function we created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OybSlpJabhGQhTEq.png" /></figure><ul><li>After Creating the Event Rule, try to create the EBS instance of Type GP2 and check whether that works.</li><li>It will throw the following error saying AWS Lambda doesn’t have access to modify EBS Volume. We will need to assign permission to the AWS Lambda Role.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7iEFmyO1Kb7faAj3.png" /></figure><ul><li>Open the role attached to AWS Lambda and Create an inline policy to modify the EBS Volume type.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mhmy1R4_iPYoSOSE.png" /></figure><ul><li>Try to create the volume of GP2 again and the EBS Volume type will change from GP2 to GP3.</li><li><strong>Conclusion</strong><br>In this guide, we’ve outlined a straightforward process to automate the conversion of Amazon Elastic Block Store (EBS) volumes from type GP2 to GP3 using AWS Lambda and EventBridge. By following the steps provided, you can set up a Lambda function to trigger when a GP2 volume is created, seamlessly converting it to GP3. This automation enhances efficiency and ensures your EBS volumes are optimized for performance. With basic knowledge of AWS Lambda and Python, you can implement this solution to streamline your AWS infrastructure management. Don’t forget to add this project in your resume.<br>I hope you learned something new today! <strong>If this post was helpful, please like this article to show your support.</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09d3ba8afa72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 4 — ACM(AWS Certificate Manager) set-up with CloudFront and Route 53]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/part-4-acm-aws-certificate-manager-set-up-with-cloudfront-and-route-53-9c750dcc0906?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c750dcc0906</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[route-53]]></category>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Sat, 06 Apr 2024 13:46:10 GMT</pubDate>
            <atom:updated>2024-04-06T13:46:10.729Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 4 — ACM(AWS Certificate Manager) set-up with CloudFront and Route 53</h3><h3>Overview</h3><ul><li>What is ACM and Why do we need it?</li><li>Create a Certificate using AWS SAM</li><li>Map Certificate with CloudFront</li></ul><h3>Objective</h3><p>Our objective for this blog is to clear the 403 error we got in the previous blog by creating the certificate in the ACM and mapping it to the CloudFront distribution.</p><h3>Pre-requisites</h3><p><a href="https://rahul-patel.hashnode.dev/part-3-configure-custom-domain-with-cloudfront-using-route-53-7236aee98558">Part 3 — Configure Custom Domain with CloudFront Using Route 53</a></p><ul><li>Follow the above link to set up Route 53 with CloudFront.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*h5uRwKlvTYIzz89l" /></figure><h3>What is ACM and Why do we need it?</h3><p>ACM in AWS stands for AWS Certificate Manager. It is a service that lets you easily provision, manage, and deploy SSL/TLS (Secure Sockets Layer/Transport Layer Security) certificates for use with AWS services and your internal connected resources.</p><p>Here’s why ACM is useful:</p><ol><li>Security: SSL/TLS certificates are crucial for securing data in transit over the internet. ACM helps you manage and deploy these certificates to ensure secure communication between clients and your AWS resources.</li><li>Ease of Use: ACM automates many of the manual processes involved in procuring, uploading, and managing SSL/TLS certificates. It integrates seamlessly with other AWS services like Elastic Load Balancer (ELB), CloudFront, API Gateway, and more.</li><li>Auto-Renewal: ACM provides automatic renewal for SSL/TLS certificates, reducing the operational burden of keeping certificates up-to-date and avoiding expiration-related issues.</li></ol><p>When you add a certificate to AWS Certificate Manager (ACM) and associate it with your CloudFront distribution, you enable secure communication between end-users and your content through HTTPS. Here’s a breakdown of why adding a certificate resolved the issue:</p><ol><li>SSL/TLS Encryption: By adding an SSL/TLS certificate to ACM and associating it with your CloudFront distribution, you’re enabling secure communication between users and CloudFront. The certificate ensures that the data transferred between the user’s browser and CloudFront is encrypted, providing confidentiality and integrity.</li><li>HTTPS Configuration: When you access a website using HTTPS, your browser expects a secure connection, and this is achieved through the SSL/TLS certificate. If your CloudFront distribution is configured to use HTTPS, but there’s no valid SSL/TLS certificate associated with it, browsers will raise security-related errors, such as the 403 error you encountered.</li><li>Access Control: The 403 error is an HTTP status code indicating that the server understood the request but refuses to authorize it. In the context of CloudFront, this could be related to the security settings, and the lack of a valid SSL/TLS certificate may have contributed to the refusal of the request.</li></ol><h3>Create a Certificate using AWS SAM</h3><pre>MyCertificate:<br>      Type: AWS::CertificateManager::Certificate<br>      Properties:<br>        DomainName: your domain name(example.com)<br>        ValidationMethod: DNS<br>        SubjectAlternativeNames:<br>          - Alternative name(api.example.com)<br>        Tags:<br>          - Key: Name<br>            Value: MyCertificate</pre><p>Note: The above code will take time to complete.</p><p>So, this template creates an ACM certificate for your domain with DNS validation and includes additional SANs. After deploying this SAM template, go to the ACM console, and you should see the certificate in a “Pending validation” state. It might take some time for the DNS changes to propagate.</p><p>AWS ACM will periodically check the DNS records to validate your ownership of the domain. Once the validation is successful, the certificate status will change to “Issued.”</p><p>Create Record in Route 53: The “Create the Record in Route 53” button in ACM, in this context, is a manual action. After deploying your AWS SAM template and initiating the certificate request, you click this button to create the required DNS records in Route 53. This typically involves navigating to the Route 53 console, finding the hosted zone for your domain, and adding the specified CNAME records.</p><h3>Map Certificate with CloudFront</h3><pre>Properties:<br>      DistributionConfig:<br>        ViewerCertificate:<br>          AcmCertificateArn: !Ref MyCertificate<br>          SslSupportMethod: sni-only<br>        Aliases:<br>          - domain of &#39;A&#39; Record we created in Part 3</pre><p>Add the above code under the Properties of CloudFront Distribution.</p><ol><li>Viewer Certificate Configuration:</li></ol><ul><li>ViewerCertificate is a sub-property that configures the SSL/TLS settings for the distribution.</li><li>AcmCertificateArn: !Ref MyCertificate: Specifies the ACM certificate to use for securing the distribution. The !Ref MyCertificate references the ACM certificate resource were created elsewhere in the template.</li><li>SslSupportMethod: sni-only: Specifies that only Server Name Indication (SNI) SSL/TLS connections are supported. This means that multiple SSL/TLS certificates can be hosted on the same IP address, which is common for modern web hosting.</li></ul><p>2. Domain Aliases (CNAMEs):</p><ul><li>Aliases is a property that allows you to specify domain aliases (CNAMEs) for the CloudFront distribution. Requests to these domain aliases will be handled by the CloudFront distribution.</li></ul><p>In summary, this code configures the CloudFront distribution to use SSL/TLS with an ACM certificate (MyCertificate) and supports SNI. Additionally, it specifies an alias for the distribution, allowing it to respond to requests for that domain. This is useful for serving content over HTTPS with a custom domain through CloudFront.</p><p>Check the Custom URL and it should be up and running without any Error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2j2sECG2JHUkiIcc" /></figure><p>Conclusion:</p><p>In this blog post, we addressed and resolved a 403 error encountered in a previous installment by leveraging AWS Certificate Manager (ACM) and AWS SAM. We explored the importance of ACM in managing SSL/TLS certificates for secure communication over the Internet.</p><p>If this post was helpful, please follow and click on the clap button</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c750dcc0906" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 3 — Configure Custom Domain with CloudFront Using Route 53]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/part-3-configure-custom-domain-with-cloudfront-using-route-53-7236aee98558?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7236aee98558</guid>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[route-53]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Mon, 25 Dec 2023 17:49:43 GMT</pubDate>
            <atom:updated>2023-12-25T17:49:43.274Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 3 — Configure Custom Domain with CloudFront Using Route 53</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*gIb5w4TzymgYonDYdpjsEA.png" /></figure><h4><strong>Overview</strong></h4><ul><li>What is Route 53?</li><li>Route 53 Configuration with CloudFront</li></ul><h3>Objective</h3><p>Our objective for this blog is to map the CloudFront URL with Route 53 so that we can access the site from the custom domain name.</p><h3>Pre-requisites</h3><p><a href="https://medium.com/@U_N_R_3_A_L/part-2-cloudfront-configuration-of-cloud-resume-challenge-3a91a56edad4">Part 2 — CloudFront Configuration of Cloud Resume Challenge</a></p><ul><li>Follow the above blog to set up CloudFront.</li><li>Domain name of your choice (I have purchased the domain name from Go Daddy)</li><li>Hosted Zone created in Route 53</li></ul><h3><strong>What is Route 53?</strong></h3><p>Amazon Route 53 is a scalable and highly available domain name system offered by AWS. Think of it as the digital address book of the internet, translating user-friendly domain names into IP addresses that computers use to identify each other. Whether launching a new website, managing domain names, or ensuring the health of your applications, Route 53 provides a suite of tools to streamline these processes.</p><h4>Key Features:</h4><ol><li>Domain Registration: Easily register and manage domain names directly through Route 53. The process is seamless, allowing you to focus on building your online presence without the hassle of dealing with multiple providers.</li><li>DNS Routing: Efficiently route end-user requests to your applications, websites, or resources, whether hosted on AWS or elsewhere. Route 53 ensures low latency and high-performance DNS responses.</li><li>Health Checking: Monitor the health of your applications and resources by setting up health checks. Route 53 can automatically redirect traffic to healthy resources if an endpoint is unhealthy, optimizing uptime and user experience.</li><li>Traffic Policies: Implement advanced traffic management strategies with traffic policies. Distribute traffic across multiple resources based on weights, latency, or geographic location, providing flexibility and control.</li></ol><h4>Use Cases:</h4><ol><li>Web Hosting: Host your websites and applications on AWS or other platforms while efficiently managing DNS records through Route 53.</li><li>Global Content Delivery: Leverage the global network of AWS edge locations to deliver content with low latency. Route 53 intelligently directs users to the nearest available resource.</li><li>Disaster Recovery: Implement failover configurations to ensure continuous availability. If one endpoint becomes unavailable, Route 53 can seamlessly redirect traffic to a healthy resource.</li></ol><h3><strong>Route 53 Configuration with CloudFront</strong></h3><p><strong>Step 1:</strong> Add the following code to your <strong>template.yaml</strong> file</p><pre>  MyRoute53Record:<br>    Type: &quot;AWS::Route53::RecordSetGroup&quot;<br>    Properties:<br>      HostedZoneId: Your Hosted Zone ID<br>      RecordSets:<br>        - Name: Your Custom Domain Name<br>          Type: A<br>          AliasTarget:<br>            HostedZoneId: Z2FDTNDATAQYW2 # only for us-east-1<br>            DNSName: !GetAtt MyDistribution.DomainName</pre><ul><li>HostedZoneId: Your Hosted Zone ID: Replace &quot;Your Hosted Zone ID&quot; with the actual ID of your Route 53 hosted zone. This is the unique identifier for the hosted zone in which you want to create the record sets.</li><li>RecordSets: This is an array of DNS record sets to be associated with the specified hosted zone.</li><li>Name: Your Custom Domain Name: Replace &quot;Your Custom Domain Name&quot; with the actual domain name for which you want to create the DNS record.</li><li>Type: A: Specifies the type of DNS record. In this case, it&#39;s an &#39;A&#39; record, which is used to map a domain or subdomain to an IPv4 address.</li><li>AliasTarget: Specifies an alias target for the DNS record. Alias records are used to map your domain to specific AWS resources.</li><li>HostedZoneId: Z2FDTNDATAQYW2: Replace this value with the appropriate Hosted Zone ID for your specific AWS region. The provided value corresponds to the Hosted Zone ID for CloudFront distributions in the us-east-1 region.</li><li>DNSName: !GetAtt MyDistribution.DomainName: This references the domain name of a CloudFront distribution named MyDistribution. It uses the !GetAtt function to retrieve the DomainName attribute of the CloudFront distribution, and this DNS name becomes the target of the Route 53 alias record.</li></ul><p><strong>Key Points:</strong></p><ul><li>This code creates a Route 53 record that routes traffic to a CloudFront distribution.</li><li>It uses an alias record to achieve this, providing flexibility in routing.</li><li>It’s important to replace placeholders with actual values and consider region-specific settings.</li></ul><p><strong>Step 2:</strong> Check the output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdkPrNpbpZq9drVQRlKzWA.png" /></figure><ul><li>The above screenshot shows the record created using the above code.</li><li>Open your custom domain in a new tab and check the result, It should show the content of our static website.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3T4G7yQA1xsHz4YXagWL9Q.png" /></figure><ul><li>It will give a 403 error and it is happening because the CloudFront distribution we created is not allowing the Route 53 record However we created it.</li><li>We need Cloudfront to allow that Domain name to be called through CloudFront Distribution and We will figure that out in the next blog.</li></ul><p><strong>If this post was helpful, please follow and click on the clap 👏 button</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7236aee98558" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2 — CloudFront Configuration of Cloud Resume Challenge]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/part-2-cloudfront-configuration-of-cloud-resume-challenge-3a91a56edad4?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a91a56edad4</guid>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Sun, 24 Dec 2023 12:20:07 GMT</pubDate>
            <atom:updated>2023-12-24T12:22:17.833Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 2 — CloudFront Configuration of Cloud Resume Challenge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*uQVZUR0M1NRha8povLWaEw.png" /></figure><h3>Overview</h3><ul><li>What is CloudFront?</li><li>Deploying and Configuring CloudFront</li></ul><h3>Objective</h3><p>By the end of this blog, you will have a nice-looking CloudFront URL where you can see your Static content. We will Understand more about CloudFront and why we are implementing it.</p><h3>Pre-requisites</h3><p><a href="https://medium.com/@U_N_R_3_A_L/part-1-the-cloud-resume-challenge-aws-167710e25ac9">Part 1: The Cloud Resume Challenge — AWS</a></p><p>Just follow the above blog to deploy the static content on the S3 bucket.</p><h3><strong>What is CloudFront</strong></h3><p>Amazon CloudFront is a content delivery network (CDN) service provided by Amazon Web Services (AWS). It enables efficient and secure distribution of static and dynamic web content, including images, videos, scripts, and APIs, to users globally. By using a network of strategically located edge locations, CloudFront reduces latency and accelerates the delivery of content, resulting in an improved user experience.</p><p><strong>Key Features:</strong></p><ol><li><strong>Global Reach:</strong> CloudFront operates from a vast network of edge locations strategically positioned worldwide, ensuring low-latency content delivery to users wherever they are.</li><li><strong>High Performance:</strong> Leveraging advanced caching techniques, CloudFront accelerates the delivery of content by caching it at edge locations. This minimizes the load on origin servers and reduces latency for end-users.</li><li><strong>Security:</strong> CloudFront provides robust security features, including SSL/TLS encryption, access control, and integration with AWS Web Application Firewall (WAF). This helps protect your content and applications from various online threats.</li><li><strong>Scalability:</strong> CloudFront seamlessly scales to handle varying levels of traffic, making it suitable for websites and applications of any size. It integrates with other AWS services, such as S3, Elastic Load Balancing (ELB), and Lambda, for a flexible and scalable architecture.</li><li><strong>Cost-Effective:</strong> With a pay-as-you-go pricing model, CloudFront allows you to pay only for the data transfer and requests you use. It offers cost-effective solutions for both small websites and large-scale applications.</li></ol><p><strong>Integration with S3:</strong></p><p>One of the powerful use cases for CloudFront is its integration with Amazon S3. By configuring CloudFront to use S3 as its origin, you can achieve a highly scalable and cost-effective solution for serving static content. This blog will guide you through setting up this integration, optimizing performance, and implementing best practices to make the most out of CloudFront and S3 together.</p><h3>Configuring and Deploying CloudFront</h3><p><strong>Step 1:</strong> Add the following code to your <strong>template.yaml</strong> file</p><pre>MyDistribution:<br>  Type: AWS::CloudFront::Distribution<br>  Properties:<br>    DistributionConfig:<br>      DefaultCacheBehavior:<br>        ViewerProtocolPolicy: allow-all<br>        TargetOriginId: your static bucket URL<br>        DefaultTTL: 0<br>        MinTTL: 0<br>        MaxTTL: 0<br>        ForwardedValues:<br>          QueryString: false<br>      Origins:<br>        - DomainName: your static bucket URL<br>          Id: your static bucket URL<br>          CustomOriginConfig:<br>            OriginProtocolPolicy: http-only<br>      Enabled: &quot;true&quot;<br>      DefaultRootObject: index.html</pre><p>DistributionConfig: Configuration for the CloudFront distribution</p><p>DefaultCacheBehavior: Configuration for the default cache behavior.</p><p>ViewerProtocolPolicy: allow-all: Allows viewers to access content using both HTTP and HTTPS.</p><p>TargetOriginId: The ID of the target origin. In this case, it points to an S3 bucket hosting a website in the US East (N. Virginia) region.</p><p>DefaultTTL, MinTTL, MaxTTL: Time-to-live (TTL) settings for caching. All set to 0 means no caching.</p><p>ForwardedValues: Configuration for forwarding values to the origin.</p><p>QueryString: false: Does not forward query strings to the origin.</p><p>Origins: Configuration for the origins (the source of your content).</p><p>DomainName: The domain name of the S3 bucket serving as the origin.</p><p>Id: A unique ID for the origin.</p><p>CustomOriginConfig: Configuration for a custom (non-S3) origin.</p><p>OriginProtocolPolicy: http-only: Specifies that the origin can be accessed using only HTTP.</p><p>Enabled: &quot;true&quot;: Specifies whether the distribution is enabled. In this case, it&#39;s set to true.</p><p>DefaultRootObject: index.html: The default root object (the object that CloudFront returns when requests are made to the root URL).</p><h3><strong>In summary:</strong></h3><ul><li>This code creates a CloudFront distribution that:</li><li>Fetches content from your S3 bucket.</li><li>Allows both HTTP and HTTPS access.</li><li>Disables caching at edge locations.</li><li>Enforces HTTP-only communication with the origin.</li><li>Serves “index.html” as the default file when a directory is requested.</li><li>Prevents query strings from being forwarded to the origin.</li></ul><p><strong>Step 2:</strong> Deploy and review the changes in CloudFront</p><ul><li>Using the SAM command build and deploy the recent changes, after successful deployment check the CloudFront and It should have CloudFront Distribution created.</li><li>Review the Configuration and try the new Distribution Domain Name. It starts with some random number and ends with cloudfront.net</li><li>You should see the static content of your website using the CloudFront domain name. (Add comments in case you are facing any issues.)</li></ul><p><strong>Step 3:</strong> Make simple changes in the code and see the behavior</p><ul><li>Try to make simple changes in your code and sync the code with the s3 bucket using CLI.</li><li>Check the S3 static bucket URL and It should show the latest updated content</li><li>Go to CloudFront URL and It should also show the latest updated content.</li><li>It is happening because we have set the TTL to 0, which means caching is disabled, that’s why it is fetching the latest content from S3.</li><li>While disabling caching can maintain content freshness, it’s important to weigh the trade-offs with potential performance impacts. Consider re-enabling caching if content updates are infrequent and performance is a priority.</li></ul><p>So that should be everything for this Part 2 of the Cloud resume challenge, We have configured CloudFront. However, We have now a unique ID in the URL which is not exactly what we want.</p><p>In the next part will configure CloudFront with Route 53 where we will map the Domain name to replace that unique ID.</p><p><strong>If this post was helpful, please follow and click on the clap 👏 button</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a91a56edad4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: The Cloud Resume Challenge — AWS]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/part-1-the-cloud-resume-challenge-aws-167710e25ac9?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/167710e25ac9</guid>
            <category><![CDATA[cloud-resume-challenge]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Wed, 06 Dec 2023 08:25:06 GMT</pubDate>
            <atom:updated>2023-12-06T08:25:06.521Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: The Cloud Resume Challenge — AWS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u-OI98FxMfJzl_dGjqGGnA.gif" /><figcaption>Image Credit — Offical cloud resume challenge website</figcaption></figure><h3>Overview</h3><ul><li>Introduction to The Cloud Resume Challenge</li><li>AWS Account with IAM User and AWS Vault Setup</li><li>What Is Infrastructure As Code? and What is AWS SAM?</li><li>Deploy to S3 using AWS SAM</li><li>Deploy HTML &amp; CSS with the AWS SAM</li></ul><h3>Objective:</h3><p>The primary goal of the Cloud Resume Challenge is for participants to build a static personal resume website and deploy it using cloud services. The challenge encourages hands-on experience with various cloud technologies, including infrastructure as code (IaC), serverless computing, and storage services.💻</p><h3>Pre-requisites</h3><ul><li>Your resume needs to have the <a href="https://aws.amazon.com/certification/certified-cloud-practitioner/">AWS Cloud Practitioner certification</a> on it. This is an introductory certification that orients you on the industry-leading AWS cloud — if you have a more advanced AWS cert, that’s fine but not expected.</li><li>An AWS account with root privileges</li><li>A basic understanding of Amazon S3, Amazon CloudFront, AWS Lambda, Amazon DynamoDB, and Amazon API Gateway</li><li>Code editor of your choice</li></ul><h3><strong>1. Introduction to The Cloud Resume Challenge</strong></h3><p>The Cloud Resume Challenge is a project created by Forrest Brazeal, a well-known advocate for cloud computing and serverless technologies. The challenge is designed to help individuals enhance their cloud skills and showcase their capabilities by creating a personal resume website hosted on a cloud platform of their choice.🚀</p><p>Steps to Complete the Challenge:</p><ol><li>Create an AWS Account (or choose another cloud provider).</li><li>Set up a static resume website.</li><li>Implement Infrastructure as Code for cloud resource management.</li><li>Deploy the website using cloud services.</li><li>Optional: Enhance the website with additional features or dynamic content.🌟</li></ol><p>So, Let’s jump into the beginning of the challenge by setting up an AWS account</p><h3><strong>2. AWS Account with IAM User and AWS Vault Setup</strong></h3><p>In this step, We will create an IAM user with the necessary permission and Installation of AWS Vault to communicate with AWS Cloud through the command line.</p><ul><li><strong>Why do we need an IAM user? — </strong>IAM users ensure the principle of least privilege, granting only necessary access for tasks.</li><li>Follow the below link to create an IAM user with access keys</li><li><a href="https://medium.com/@U_N_R_3_A_L/creating-first-ec2-instance-with-terraform-7bd3a5ab217#7093">How to Create an IAM User</a></li><li><strong>What is AWS Vault? — </strong>AWS Vault is a tool that securely stores and manages AWS credentials in development environments. It helps protect your AWS credentials from unauthorized access and ensures that only authorized users can access your AWS resources.</li><li>Follow the below link to install AWS Vault. It has detailed instructions for installing the AWS Vault.</li><li><a href="https://github.com/99designs/aws-vault">https://github.com/99designs/aws-vault</a></li><li>After successful installation run the following command to store your credentials. It will ask for the <strong>Access key ID</strong> and <strong>Secret access key.</strong></li></ul><pre>aws-vault add my-user</pre><ul><li>Enter the value you received while creating an IAM User.</li><li>Now run the below command to check if the credential you entered is working or not.</li></ul><pre>aws-vault exec my-user -- aws s3 ls</pre><ul><li>You should see the out as following screenshot</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*phSL2kekBILJLf86.png" /></figure><ul><li><strong>Note:</strong> It will give an error saying <strong>Access denied </strong>if you have not configured the IAM Policy correctly. Do check if the IAM policy is configured correctly or not.</li></ul><p>So, our AWS account and AWS Vault are ready to start working with AWS from the local environment.</p><p>Next, we will use AWS SAM to create an S3 bucket using code.</p><h3><strong>3. What Is Infrastructure As Code? and What is AWS SAM?</strong></h3><p>Infrastructure as Code (IaC) is a practice that involves managing and provisioning computing infrastructure through machine-readable scripts. It treats infrastructure configurations like application code, enabling automation, version control, and reproducibility.</p><p>Key aspects of IaC include:</p><ol><li><strong>Declarative Configuration:</strong> IaC uses declarative language or script files to specify the desired state of the infrastructure. Users declare what resources they want, and the IaC tool determines how to achieve that state.</li><li><strong>Automation:</strong> IaC allows for the automation of infrastructure provisioning, configuration, and management processes, reducing manual errors and increasing efficiency.</li><li><strong>Version Control:</strong> IaC scripts can be versioned using version control systems (e.g., Git), enabling tracking changes, collaboration, and rollback to previous states.</li><li><strong>Reproducibility:</strong> IaC ensures that infrastructure can be reproduced consistently across different environments, from development to production.</li></ol><p>Popular IaC tools include Terraform, AWS SAM, AWS CloudFormation, Ansible, and Chef.</p><p>We are going to use AWS SAM(Serverless Application Model) provided by AWS.</p><p>AWS SAM is an open-source framework for building serverless applications. It extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application. AWS SAM uses a YAML configuration file to describe the serverless application’s architecture and configuration.</p><p>Follow the below link which has step-by-step instructions to install AWS SAM on your preferred operating system.</p><p><a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html">Installing the AWS SAM CLI for Windows, Linux, and macOS</a></p><h3><strong>4. Deploy to S3 using AWS SAM</strong></h3><p>Your HTML resume should be deployed online as an <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">Amazon S3 static website</a>. Services like Netlify and GitHub Pages are great and I would normally recommend them for personal static site deployments, but they make things a little too abstract for our purposes here. Use S3.</p><p>S3 is a file service on AWS to store the files and it is also really useful to host the static website.</p><p>Follow the below steps to initialize SAM in your local system</p><ol><li>Let’s go and hit <strong>sam init</strong> in the command line I am using cmd of Windows.</li></ol><pre>sam init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*tyZx-5N9Yh8llNYc.png" /></figure><p>It will ask you to choose the template of your choice, we will go with <strong>1 — AWS Quick Start Template</strong></p><p>2. Choose an AWS Quick Start application template — 1) Hello World Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*AyxzCb1JtWlGdl7i.png" /></figure><p>3. Use the most popular runtime and package type?(Python and zip) [y/N]: y</p><p>4. Would you like to enable X-Ray tracing on the function(s) in your application? [y/N]: N</p><p>5. Would you like to enable monitoring using CloudWatch Application Insights? — N</p><p>6. Project name [sam-app]: <strong>name of your choice (I am choosing cloud-resume-challenge)</strong></p><p>It will clone the repo in your local folder and now in the terminal change the directory to that folder. and you will see the folder structure as below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/0*hojogDViuA1eilwP.png" /></figure><p>Now run sam build command to build the code so that it can be deployed. After a successful build, you will see the <strong>Build Sucess</strong> message.</p><p><strong>Note:</strong> As we have selected Python runtime, it will look for a specific Python version installed in your system. In my case I had Python 12 installed in my system but the SAM template required Python 9 so to resolve that issue, I uninstalled Python 12.</p><p><strong>SAM Deploy — Now run the below command</strong></p><pre>aws-vault exec my-user --no-session -- sam deploy --guided</pre><p>aws-vault exec my-user: This part of the command is using aws-vault, which is a tool for securely storing and accessing AWS credentials. It allows you to execute commands with temporary AWS credentials without exposing your long-term access key and secret key. In this case, it&#39;s using the profile name my-user we created earlier.</p><p>--no-session: This flag indicates that the AWS credentials should not be stored in a session. Sessions are temporary sets of credentials with a limited lifespan. By using --no-session, you are ensuring that the credentials are used only for the immediate execution of the command.</p><p>sam deploy: Initiates the deployment process for your serverless application.</p><p>--guided: This flag starts an interactive guided deployment. During the guided deployment, AWS SAM will prompt you for information needed to deploy your application, such as AWS Region, Stack Name, and other configuration options.</p><p>After running the sam deploy command it will ask for some information like stack name and region in which you want to deploy the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Yncszl4OZFgqLa-J.png" /></figure><p>On Successful Deployment, you will the success message in your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tiICXLhNfmPkt2tg.png" /></figure><p>Search for CloudFormation in AWS and open it, you will see the stack created for you in CloudFormation. It will store the state of the AWS resources you created. If you are curious then you can just open the stack and look around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WQcnKBvoxyAfBYMt.png" /></figure><p>I have some snippets to create the bucket in S3. We are going to add that in our code and then we will deploy it to AWS.</p><pre>MyWebsite:<br>    Type: AWS::S3::Bucket<br>    Properties:<br>      BucketName: unique-name-of-your-choice</pre><p>Copy this snippet and paste it into the template.yaml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zLC0BPagQ_tkQf3m.png" /></figure><p>Again run sam build and sam deploy command but this time run the sam deploy command without --guided Flag. and check if the bucket is created using the AWS console or using the command in the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*UiWEkW9CWlCHdl6b.png" /></figure><h3><strong>5. Deploy HTML &amp; CSS with the AWS SAM</strong></h3><p>In this step, we are just going to put an HTML file in the bucket we created and enable the static website hosting of the S3 bucket.</p><ol><li><strong>Enable static website hosting</strong></li></ol><p>Add the AccessControl and WebsiteConfiguration properties in the code, and your code should look like the below snippet</p><pre>Resources:<br>  MyWebsite:<br>    Type: AWS::S3::Bucket<br>    Properties:<br>      PublicAccessBlockConfiguration:<br>        BlockPublicAcls: false<br>        IgnorePublicAcls: false<br>        BlockPublicPolicy: false<br>        RestrictPublicBuckets: false<br>      WebsiteConfiguration:<br>        IndexDocument: index.html<br>      BucketName: my-cloud-resume-challenge-5nov</pre><p>After adding this run the build and deploy command. Now go to your S3 bucket in the AWS Console. Now check in the Properties tab, at the bottom you will find static website hosting and it should be enabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y68ys218F9Bu3eN_.png" /></figure><p>Click on the endpoint you can see in the Static website hosting section. and you will see a <strong>403 Forbidden</strong> error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/0*FI09ZHViKAwarmSy.png" /></figure><p>Create one folder in your working directory and add index.html file in that folder with some basic content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ggg6SNfZuyFCtUqn.png" /></figure><p>We have a different command to send the file to the S3 bucket.</p><pre>aws-vault exec my-user --no-session -- aws s3 sync ./resume-site s3://my-cloud-resume-challenge-5nov</pre><p>Try to access that link and we should be able to see the Hello World message but still the same error message.</p><p>We need to add some permission to our bucket and what that does is public read on all the objects within our S3 bucket.</p><pre>Resources:<br>  MyWebsite:<br>    Type: AWS::S3::Bucket<br>    Properties:<br>      AccessControl: PublicRead<br>      WebsiteConfiguration:<br>        IndexDocument: index.html<br>      BucketName: my-cloud-resume-challenge-4nov<br>  BucketPolicy:<br>    Type: AWS::S3::BucketPolicy<br>    Properties:<br>      PolicyDocument:<br>        Id: MyPolicy<br>        Version: 2012-10-17<br>        Statement:<br>          - Sid: PublicReadForGetBucketObjects<br>            Effect: Allow<br>            Principal: &quot;*&quot;<br>            Action: &quot;s3:GetObject&quot;<br>            Resource: !Join<br>              - &quot;&quot;<br>              - - &quot;arn:aws:s3:::&quot;<br>                - !Ref MyWebsite<br>                - /*<br>      Bucket: !Ref MyWebsite</pre><p>And there you go, Now you can see the Hello World message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/0*2bFLeezxq1FaQqxy.png" /></figure><p>Congratulations!! You have deployed a static website on S3 using AWS SAM. but it is not over yet. We have a long way to go but that is the end of Part 1.</p><p>Here are a few resources that I recommend:</p><ul><li>Cloud Resume Challenge’s official website — <a href="https://cloudresumechallenge.dev/">https://cloudresumechallenge.dev/</a></li><li>The tutorial I am following — <a href="https://youtube.com/playlist?list=PLEk97Q5Nj5oesA1WNk7DzaUpZUnCsQFVQ&amp;si=KdskFmpZyaUC8S1R">https://youtube.com/playlist?list=PLEk97Q5Nj5oesA1WNk7DzaUpZUnCsQFVQ&amp;si=KdskFmpZyaUC8S1R</a></li></ul><h3><strong>In a nutshell,</strong></h3><p>This blog post has covered everything you need to know to deploy a static website to AWS S3 using AWS SAM. We’ve talked about The Cloud Resume Challenge, setting up an AWS account, Infrastructure as Code (IaC), AWS Serverless Application Model (SAM), and even how to deploy static HTML and CSS content to S3 using AWS SAM. Stay tuned for Part 2 and Until then Keep learning.</p><p><strong>If this post was helpful, please follow and click on the clap 👏 button</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=167710e25ac9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power of AWS AMI: Streamlining EC2 Instance Launches]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/the-power-of-aws-ami-streamlining-ec2-instance-launches-bbf646d5d880?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbf646d5d880</guid>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[amazon-machine-images]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Sat, 15 Apr 2023 11:53:08 GMT</pubDate>
            <atom:updated>2023-04-15T11:53:08.430Z</atom:updated>
            <content:encoded><![CDATA[<p>First, let’s start with a brief overview of what an AWS AMI is. An AMI (Amazon Machine Image) is essentially a pre-configured virtual machine that you can use as a template to launch EC2 (Elastic Compute Cloud) instances. AMIs can contain an operating system, application server, and pre-installed applications that you can use to quickly and easily launch an EC2 instance.</p><p>AMIs are built for a specific region and can be copied across regions. You can Launch EC2 instances from different kinds of AMIs.</p><ul><li>A public AMI: AWS provided (Amazon Linux 2 AMI)</li><li>Your own AMI: you make and maintain them yourself</li><li>An AWS Marketplace AMI: an AMI someone else made (and potentially sells)</li></ul><p>And even you as a user could create a business of selling AMIs on the AWS marketplace.</p><h3><strong>Some benefits of using AWS AMI include:</strong></h3><ol><li>Faster deployment: Since AMIs contain pre-configured settings and software, it is much faster to launch an EC2 instance from an AMI than to configure it manually.</li><li>Consistent environment: Using the same AMI to launch multiple EC2 instances ensures that all instances have the same software and configurations.</li><li>Cost-effective: Since AMIs can be created from EC2 instances, you can save money by creating an AMI and launching multiple instances from it instead of creating multiple instances from scratch.</li></ol><h3><strong>AMI Process (From an EC2 instance)</strong></h3><ul><li>Start an EC2 instance and customize it</li><li>Stop the instance( for data integrity)</li><li>Build an AMI — this will also create EBS snapshots</li><li>Launch instances from other AMIs</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cswesu_URIuwQWcqDuKpzg.png" /></figure><p>So we have <strong>US-EAST-1C</strong>, and we can create the same instance in <strong>US-EAST-1B</strong>, so the process is we lunch the instance in <strong>US-EAST-1A</strong>, we are going to customize it then we are going to create an AMI from it, which is in the middle of the diagram and then in <strong>US-EAST-1B</strong> we will be able to lunch from that AMI and we will effectively create a copy of our EC2 instance.</p><h3><strong>AMI Hands-on</strong></h3><p>So First we will start with launching the EC2 instance in US-EAST-1C. and then we will install Jenkins in the EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fHWpx_IMnArhbFHLyhrqDw.png" /></figure><p>I have already launched the EC2 instance and installed Jenkins in it.</p><ol><li><strong>Follow the below link to install Jenkins in EC2 instance.</strong></li></ol><p><a href="https://medium.com/@U_N_R_3_A_L/how-to-install-jenkins-in-windows-machine-and-in-aws-ec2-instance-2ddf49ad3122">How to install Jenkins in Windows Machine and in AWS EC2 Instance</a></p><p><strong>2. Select the instance and Action-&gt; Image and templates -&gt; Create Image</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mbNbbCd1kP_E_cVqbMItZw.png" /></figure><p><strong>3. Enter the name of the Image and Create Image</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xVN2waDmVVO66sCNr8MbCw.png" /></figure><p>It will take some time to create AMI from the EC2 instance. Check the status of AMI if it is available then it is ready to use. Once it is available go to the EC2 instance and Lunch the instance.</p><p><strong>4. Select the Custom AMI while launching the Instance. My AMIs-&gt; Owned by me and Select the one you created.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*coYbPK6cGmIptzGqnamJgQ.png" /></figure><p>The rest configuration will be the same as you used for the first instance and lunch the instance.</p><p><strong>5. Copy the Public IP of the instance and Paste it into the browser(Make sure to add Port 8080)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nGNZS2LJW6vsUN9ms4caiw.png" /></figure><p>Congratulations!!⭐️ With the help of AMI, we can directly use Jenkins in our newly created EC2 instance. This is the whole power of AMIs⚡️</p><p>In conclusion, AWS AMI is a powerful tool for deploying and managing EC2 instances. It enables you to quickly and easily launch instances with pre-configured software and configurations, saving you time and money. With proper security and maintenance, AWS AMI can be an essential component of your cloud infrastructure.</p><p>Thank you for reading the blog, If you found this blog helpful then follow and hit the clap<strong>👏</strong> button to show your support 🌳</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbf646d5d880" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Achieve Seamless CI/CD with Github, Jenkins, Docker, and Kubernetes]]></title>
            <link>https://medium.com/@U_N_R_3_A_L/how-to-achieve-seamless-ci-cd-with-github-jenkins-docker-and-kubernetes-9c11a322a2c3?source=rss-1c276ec63bf7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c11a322a2c3</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[jenkins]]></category>
            <dc:creator><![CDATA[Rahul Patel]]></dc:creator>
            <pubDate>Fri, 07 Apr 2023 19:29:11 GMT</pubDate>
            <atom:updated>2023-04-07T19:29:11.034Z</atom:updated>
            <content:encoded><![CDATA[<p>After the end of this blog, you will be able to deploy your project on Kubernetes using the CI-CD pipeline.</p><p>First, we will understand the requirement</p><ul><li>The team of developers working on new features will merge their code to a GitHub repo.</li><li>As soon as the code reaches GitHub, using a CI (Continuous Integration) pipeline, setup in Jenkins, automated builds will be triggered</li><li>The automated builds will frequently deploy new features to the production website</li><li>Every build will prepare a Dockerfile and push docker images to docker-hub</li><li>Every docker image will be deployed (Continuous Deployment) to a Kubernetes cluster.</li></ul><p>So now let’s make the architecture of our application. This will represent the workflow of the CI-CD pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3CIUtdZbg0uXg4hMdK9CA.png" /></figure><ol><li>Developer to push code on the Source code repository</li><li>Jenkins to fetch the code and build the docker image</li><li>Push Docker image to Dockerhub</li><li>Kubernetes to pull the same image from Dockerhub and deploy it to Kubernetes Cluster</li></ol><h3><strong>Fork the following GitHub repo to your GitHub account</strong></h3><p><a href="https://github.com/Patelrahul4884/cicd-pipeline-train-schedule-autodeploy">GitHub - Patelrahul4884/cicd-pipeline-train-schedule-autodeploy: Train Schedule sample app for Jenkins Pipelines CD with Kubernetes Fully Automated Deployment exercises</a></p><h3><strong>Jenkins setup</strong></h3><ul><li>Install required plugin</li></ul><p>Pipeline, Pipeline: API, Kubernetes, Docker, Docker Pipeline</p><p>Enter the <strong>item name</strong> and select <strong>Pipeline and click Ok</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EyfSygRHjHNVUzjcAYyTA.png" /></figure><p>Select the Github Project and add the github repo link</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6UE5l-_eHmWUxBx5GRw_rw.png" /></figure><p>Select Poll SCM and add <strong>* * * * *</strong> star (that means it will check the repo every 2 mins and if there is any change then It will start the build automatically)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MtOjwFZck9AlT-34w9COVw.png" /></figure><p>Find the Jenkinsfile in the project folder and Paste the code in a <strong>Script </strong>section of Pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hzwoax4auWF_LaNQDdt6kg.png" /></figure><pre>pipeline {<br>    agent any<br>    environment {<br>        //be sure to replace &quot;DOCKER_IMAGE_NAME&quot; with your own Docker Hub username<br>        DOCKER_IMAGE_NAME = &quot;rahul4884/train-schedule&quot;<br>    }<br>    stages {<br>        stage(&quot;Checkout from github repo&quot;){<br>            steps{<br>            # Replace with your github repo<br>            git url: &#39;https://github.com/Patelrahul4884/cicd-pipeline-train-schedule-autodeploy.git&#39;<br>            }<br>        }<br>        stage(&#39;Build&#39;) {<br>            steps {<br>                echo &#39;Running build automation&#39;<br>                sh &#39;./gradlew build --no-daemon&#39;<br>                archiveArtifacts artifacts: &#39;dist/trainSchedule.zip&#39;<br>            }<br>        }<br>        stage(&#39;Build Docker Image&#39;) {<br>            steps {<br>                script {<br>                    app = docker.build(DOCKER_IMAGE_NAME)<br>                }<br>            }<br>        }<br>        stage(&#39;Push Docker Image&#39;) {<br>            steps {<br>                script {<br>                    docker.withRegistry(&#39;https://registry.hub.docker.com&#39;, &#39;docker_hub_login&#39;) {<br>                        app.push(&quot;${env.BUILD_NUMBER}&quot;)<br>                        app.push(&quot;latest&quot;)<br>                    }<br>                }<br>            }<br>        }<br>        stage(&#39;DeployToProduction&#39;) {<br>            steps {<br>                kubeconfig(caCertificate: &#39;LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1USXdOREUwTXpZME5sb1hEVE15TVRJd01URTBNelkwTmxvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTVV4CnR2eFdmcmNGV2crVFpxSi92U3pWRFlPSVVMWE0zMlRxOW9TL1g5UzZVVjNkZ0xUTDI4V0IvblF0K0xGbjNwWEQKOE9RNTZVN25sZlhiSWI0Q1ZUdVVkVDg0c2xGcVdWN2lkUVlGNXVNaERDamF2MW16OG9IbVJQVXlBVW9HQWY5VApWWUFxY3h2VnVvbDVKa1EydXpyTHJrZ1VJU2k3dVdYdlVxRnl4bW8rUWt2cWRiUm5ldDBpbHNTbU5FdDlObTNTClVJSStrbTRZU3lod2xtTHlOYXJPc0lsNVU3ZXpuUG1Ua0E0MXN1ZG4wSjNRMXBYQUdSY2NqVXVzWjBIK3FyZm4KOGJWdFpuMmhsbms0VHRMSGhEUS81MFNXOCt1MEVLOHo2Sms5bHVET1BiSjdxam11U0Y1c3RJUDg1VWo2SndhMgpoUm1sclU1UUlzSTd5ZWlFMzZFQ0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZQcFhkVmc3LzJiUGhBZytZdys4WFIzWk90OUJNQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBR2IwcEEwQythVFVDdytOY1FyZgp3NHNhQStUMnNMU0xTM3NGOWh1NEdKU0lHaXdPTDRja2pscE1sUTE5aDltWnVpdVBkOEhNa0RrWTBTRHQvRXdyCm94MVdrYTlxMkFEZ0hyVCtDUzBOWHVJMDBLQ0QzdDd5czBhdGl6b21lWnppcE9aYkZRdnI2eEU0bUhQY0hNQUEKQ1dMR2RvRjNhVEZFODJIUWxLWkM4anFHUklqeE5SWlFpZ1IvVXlxSktYZWs1Z1BQZGVzckJRY2NuQzVtVWxoOQo0cktwT1p0UTBjajFMakx2dkQxNWdCMkVSVzBtK2lDTUhCM1g1SGJXdkZWOEgzOEFzcjc5amwrMHFoU1lRTTVoCmsweVNxd3gvY2hFd0hWc0NURjNKSUZUejAwZVhFa0VPdE1yVitYWEhKNk9jdzFINXFvNFhHY0NoUDN2c3NZbFMKUWw0PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==&#39;, credentialsId: &#39;kubernetes&#39;, serverUrl: &#39;https://192.168.59.104:8443&#39;) {<br>    // some block<br>                 sh &#39;kubectl apply -f deployment.yaml&#39;<br>                 sh &#39;kubectl apply -f app-service.yaml&#39;<br>                 sh &#39;kubectl rollout restart deployment train-schedule&#39;<br>}<br>            }<br>        }<br>    }<br>}</pre><h3><strong>Dockerhub setup</strong></h3><p>Follow this path and add Dockerhub Credential</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wzv_NAC4QFaLcSLoPvgnew.png" /></figure><p>Select Username and Password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qidmrfrOGIV4drU1VWY6bg.png" /></figure><p>To Generate the password go to your docker hub account</p><p>In the security, section add the <strong>New Access Token </strong>and Paste it into the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*43X8793ZPeisuQle9qr9sQ.png" /></figure><p>Note: Id should be as written in Jenkins script</p><p>Here in the Jenkins script, it is <strong>docker_hub_login</strong></p><h3><strong>MiniKube setup</strong></h3><p>First, make sure that Minikube is up and running by typing <strong>minikube start</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NaPxvXya87KUOW0iS2gMjA.png" /></figure><pre>minikube status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*QFJOVMybUoav_3vp9Q3qXw.png" /></figure><p>Everything is up and running</p><pre>kubectl cluster-info</pre><p>to get the IP of the cluster and copy the URL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*U-zPEsMc8ZAHd7K7dErgXw.png" /></figure><p>Paste the URL into <strong>kubeconfig </strong>function of the script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*vUXqBGmbZoFbEYkPo247fA.png" /></figure><h3><strong>Configure Clouds</strong></h3><p>Manage Jenkins -&gt; Manage Nodes and Clouds -&gt; Configure Clouds</p><p>Click on Add a new cloud, you will see <strong>Kubernetes </strong>in the dropdown</p><p>Note: If you are not seeing Kubernetes then you are missing the Kubernetes plugin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*9aY9WgwI9c4SOUC74Y6lSQ.png" /></figure><p>You will see the following screen after Selecting Kubernetes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aFrLGW7VI9FyvZYubB0bIQ.png" /></figure><p>Select <strong>Kubernetes Cloud details</strong></p><p>Scroll down and you will see the credential option</p><p>Add -&gt; Jenkins</p><p>The following screen will pop up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EkLvBJYDuBUIH6CSA-SIOw.png" /></figure><p>Kind: Secret file</p><p>Choose the config file which is located at <strong>C:\Users\patel\.kube</strong></p><p>Note: Where patel is the username of my system</p><p>Id: <strong>kubernetes (</strong>because we have configured it in the script file<strong>)</strong></p><p>And now <strong>Add </strong>the connection and <strong>Test connection</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5aqqHJQGTYnw3LBDeKczA.png" /></figure><p>Minikube is connected with Jenkins.</p><p>Now one final thing that we need to add is <strong>caCertificate</strong></p><p>To get this you need to follow <strong>C:\Users\patel\.minikube</strong></p><p>Here, you will find a file called <strong>ca.crt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*XRDJjfyWLddhckxyDNEyqg.png" /></figure><p>Copy the file content and paste it into <strong>caCertificate </strong>of the script file</p><p>Now we are all set to build the project.</p><p>Before running the project make sure that your Docker Desktop and Minikube are up and running</p><p>Click on Build now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1b9Ua1-rpRw5ept1v4vtQ.png" /></figure><p>It will take some time to complete the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3yDBUEc8ocq2TDlEmhapw.png" /></figure><p>All green and our app is deployed to Kubernetes Cluster.</p><p>Too see the application type below command.</p><pre>minikube service list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*8AHI6EYsfb_CbBjk_J5XwA.png" /></figure><p>Copy the URL and Paste it in the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bS9BIp-0PTKdMwKoGSMfHg.png" /></figure><p>Your application is up and running now.</p><p>Now make any changes and push the changes to Github, Jenkins will automatic detect the changes and start the build.</p><h3><strong>Conclusion</strong></h3><p>Finally we have successfully deployed the application to Kubernetes Cluster with the help of GIthub, Jenkins, Docker and Dockerhub. We have deployed this project locally so other people can’t use it but we can do that as well using AWS and my next blog will be on that. Let me know in the comment section if you face any issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c11a322a2c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>