<?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: Selvakumar</title>
    <description>The latest articles on DEV Community by Selvakumar (@s3lvakumar).</description>
    <link>https://dev.to/s3lvakumar</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%2F839109%2F1b12091b-2358-43e2-a0ec-382614543ed5.png</url>
      <title>DEV Community: Selvakumar</title>
      <link>https://dev.to/s3lvakumar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/s3lvakumar"/>
    <language>en</language>
    <item>
      <title>Adding support for stateful applications deployed on GCP Cloud Run via Filestore</title>
      <dc:creator>Selvakumar</dc:creator>
      <pubDate>Wed, 04 Oct 2023 09:53:40 +0000</pubDate>
      <link>https://dev.to/ittrident/setting-up-gcp-filestore-integration-for-cloud-run-30af</link>
      <guid>https://dev.to/ittrident/setting-up-gcp-filestore-integration-for-cloud-run-30af</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While Cloud Run offers the undeniable advantages of a serverless and stateless environment, it's important to recognize that it primarily caters to stateless applications. However, there may be instances where the need arises to deploy a stateful application which mandates a storage medium (logs, media assets, and such) within the Cloud Run environment. If you find yourself facing this very scenario, fear not, for this blog post will serve as your comprehensive guide, walking you through the process step by step.&lt;/p&gt;

&lt;p&gt;How exactly are we going to do this, you ask? By leveraging a &lt;a href="https://github.com/itTrident/terraform-gcp-cloudrun-filestore"&gt;tf module&lt;/a&gt; I authored, of course! &lt;/p&gt;

&lt;p&gt;A lil' pretext as to why I even came about with the idea to write this was when the only other way I saw around making stateful applications seamlessly work with Cloud Run was to make direct changes (google libs, sdk, etc.) to the codebase in effect, which would unequivocally alter the very substance of the application to render it working ONLY and EXCLUSIVELY on Google Cloud.&lt;/p&gt;

&lt;p&gt;No more meddling around with the code, all thanks to this module, all of the apps volume needs are taken care of within the confinement of the Cloud Run service itself!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Prerequisite:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An account with Google Cloud with administrative access or permissions for the essential components constituting the following services - Cloud Run, VPC, API services, Filestore, and Artifact Hub.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Enable APIs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initially, you must activate the necessary APIs:

&lt;ul&gt;
&lt;li&gt;Cloud Filestore API&lt;/li&gt;
&lt;li&gt;Cloud Run API&lt;/li&gt;
&lt;li&gt;Serverless VPC Access API&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Navigate to the "APIs &amp;amp; Services" section, proceed to the "Library" section, and search for the specified APIs mentioned above. Afterward, enable them as needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--arFApM4j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb1l3b6kmrx4wver5a99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--arFApM4j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb1l3b6kmrx4wver5a99.png" alt="Image description" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7PcHxr5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lw3tk9upacfaxhrair3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7PcHxr5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lw3tk9upacfaxhrair3.png" alt="Image description" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7ZmTckY1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipvl2xi99q0ge32cdrvx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7ZmTckY1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipvl2xi99q0ge32cdrvx.png" alt="Image description" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create Serverless VPC connector&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To connect to your Filestore instance, your Cloud Run service needs access to the Filestore instance's authorized VPC network.&lt;/li&gt;
&lt;li&gt; Every VPC connector requires its own /28 subnet to place connector instances in. Do note that this IP range must not overlap with any existing IP address reservations in your VPC network&lt;/li&gt;
&lt;li&gt;Goto to &lt;code&gt;Serverless VPC access&lt;/code&gt;, afterware, click &lt;code&gt;CREATE CONNECTOR&lt;/code&gt;, fill the required field&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a8TrqjiT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99r5npx4wlga6fvdvru3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a8TrqjiT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99r5npx4wlga6fvdvru3.png" alt="Image description" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Filestore&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the "Filestore" section.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;CREATE INSTANCE&lt;/code&gt; to create the new filestore.&lt;/li&gt;
&lt;li&gt;Fill the required field and click Create.&lt;/li&gt;
&lt;li&gt;Upon it being created, you'll have the "NFS mount point" displayed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AhuDUIei--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/df9dshfkx82l1t2d8yd1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AhuDUIei--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/df9dshfkx82l1t2d8yd1.png" alt="Image description" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Build Docker Image&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Once you've completed the preceding configuration steps, the next task involves adding the following line to your Dockerfile's ENTRYPOINT or CMD:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mount -o nolock FILESTORE_IP_ADDRESS:/FILE_SHARE_NAME MNT_DIR&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Here's what each argument of this command denotes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FILESTORE_IP_ADDRESS:/FILE_SHARE_NAME: You should obtain this value from step #3 labeled "NFS mount point"&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MNT_DIR: You must specify the target directory where you intend to mount the Filestore.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; FROM ubuntu:latest
 WORKDIR /data
 # If you use entrypoint
 ENTRYPOINT ["mount -o nolock FILESTORE_IP_ADDRESS:/FILE_SHARE_NAME /data", "&amp;amp;&amp;amp;", "npm" , "start"]
 # If you use CMD
 CMD mount -o nolock FILESTORE_IP_ADDRESS:/FILE_SHARE_NAME /data &amp;amp;&amp;amp; npm start
&lt;/code&gt;&lt;/pre&gt;

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


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

&lt;ul&gt;
&lt;li&gt;Subsequently, proceed to build your Docker image and push it to the Artifact Hub.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Deploy that Image to Cloud Run&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to "Cloud Run"&lt;/li&gt;
&lt;li&gt;Click on the "Create Service" button.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Service Configuration:&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;Select the container image you pushed earlier.&lt;/li&gt;
&lt;li&gt;GGive the service a name of your choosing and fill the rest of the information.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Container Configuration:&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;Give the container a port number to start serving on&lt;/li&gt;
&lt;li&gt;Execution environment : Choose "
Second generation"&lt;/li&gt;
&lt;li&gt;Fill the other things.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Network Configuration:&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;Select "
Connect to a VPC for outbound traffic"&lt;/li&gt;
&lt;li&gt;Choose "Use Serverless VPC Access connectors" from the list, next, choose the serverless VPC connector that you have created in Step #2.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Finally, Click "CREATE".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A no-brainer way to smoke test if the filestore crate is actually mounted, do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch a VM (GCE) in the same network as Filestore and SSH into it&lt;/li&gt;
&lt;li&gt;Install the nfs utility (I'm demo'ing this on Debian: &lt;code&gt;sudo apt install nfs-common&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Create an example directory, i.e; nfs? filestore?&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Mount the example directory as a volume in the filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mount -o nolock FILESTORE_IP_ADDRESS:/FILE_SHARE_NAME &amp;lt;example-directory&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;df -h&lt;/code&gt; to check if the share is mounted, &lt;code&gt;cd&lt;/code&gt; into the &amp;lt;example-dir&amp;gt;, &lt;code&gt;mv&lt;/code&gt; files you'd want accessed by the container; later, and as soon as your app begins writing data, you'll naturally find it inside the &amp;lt;example-dir&amp;gt; along with the rest.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gcp</category>
      <category>cloudrun</category>
      <category>filestore</category>
      <category>terraform</category>
    </item>
    <item>
      <title>How to Setup AWS ECS Cluster as Build Slave for Jenkins</title>
      <dc:creator>Selvakumar</dc:creator>
      <pubDate>Wed, 12 Apr 2023 12:30:46 +0000</pubDate>
      <link>https://dev.to/ittrident/how-to-setup-aws-ecs-cluster-as-build-slave-for-jenkins-1fp8</link>
      <guid>https://dev.to/ittrident/how-to-setup-aws-ecs-cluster-as-build-slave-for-jenkins-1fp8</guid>
      <description>&lt;p&gt;This is a blog walk through how to set up the AWS ECS Fargate as a build slave for Jenkins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step#1: (ECS cluster setup)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Login to the AWS&lt;/li&gt;
&lt;li&gt;Goto ECS and click the "Create cluster"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AL1jOkxC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dldunhmvbheb7y0x2zaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AL1jOkxC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dldunhmvbheb7y0x2zaz.png" alt="create cluster" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the "Networking only" and then click "Next step"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HQnfNNix--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cyk5dfebtpo9l0t7mkce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HQnfNNix--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cyk5dfebtpo9l0t7mkce.png" alt="choose fargate" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill the cluster name and if you want to create the new VPC just click the "Create VPC" tick box or just leave it. Finally click the "create" button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---BxAaTK5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hwdeqgv1jzjm65hhm0id.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---BxAaTK5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hwdeqgv1jzjm65hhm0id.png" alt="Image description" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step#2: (Setup ECS task execution IAM role)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Goto IAM, select the "Roles". Then click the "create role" button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W1h65OMu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pow6v5g89ktlzcnzcjya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W1h65OMu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pow6v5g89ktlzcnzcjya.png" alt="Image description" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose "AWS service" on the trusted entry, then select "Elastic Container Service" on the drop down of use cases for other AWS services, then select the "Elastic Container Service Task". And click next.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yit8J9YZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/guhie90wspb2k9nzu1e2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yit8J9YZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/guhie90wspb2k9nzu1e2.png" alt="Image description" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the Add permissions section select 'AmazonECSTaskExecutionRolePolicy", then click next.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PIAp8q7Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgf6wkanj58u3q6k9quo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PIAp8q7Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgf6wkanj58u3q6k9quo.png" alt="Image description" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give the name of the role, then click "create role".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RP0IIhzt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlxkabp57eqwklv4ephm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RP0IIhzt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlxkabp57eqwklv4ephm.png" alt="Image description" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step#3: (Create the security Group to ECS Slave)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create the security group with JNLP port "50000".&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step#4: (Install the Jenkins)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install the Jenkins on the EC2 if you not have it.&lt;a href="https://www.jenkins.io/doc/book/installing/linux/"&gt;Installation link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Note:&lt;/em&gt; &lt;em&gt;Open the JNLP port "50000" on the Jenkins machine security group&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step#5: (AWS credential config at Jenkins)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Configure the AWS programmatic access keys and secret key on Jenkins credential. This will help to run the agent on ECS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2XWDHFoc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjk373um1r299onpa9fw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2XWDHFoc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjk373um1r299onpa9fw.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step#6: (Setup JNLP port on Jenkins settings)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Goto "Manage Jenkins" on the dashboard.&lt;/li&gt;
&lt;li&gt;Click the "Security" under the security section.&lt;/li&gt;
&lt;li&gt;On the "Agents" setting, Choose the "Fixed" and put the port "50000".&lt;/li&gt;
&lt;li&gt;Then "save" it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bzg7lXWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r16u2pthslnu970wfq8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bzg7lXWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r16u2pthslnu970wfq8w.png" alt="Image description" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step#7: (Install ECS plugin on Jenkins)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Goto "Manage Jenkins", then click the "Plugins". &lt;/li&gt;
&lt;li&gt;Install the "Amazon Elastic Container Service(ECS)/Fargate".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R3yfeEJB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87hlfoo0x87biyj0ee6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R3yfeEJB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87hlfoo0x87biyj0ee6w.png" alt="Image description" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step#8:(Setup the slave configuration on the Jenkins)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Goto "Manage Jenkins", then choose the "Nodes and Clouds".&lt;/li&gt;
&lt;li&gt;Click "Clouds" on the left side top.&lt;/li&gt;
&lt;li&gt;Choose "Amazon EC2 Container Service Cloud" on the add a new cloud drop down.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hkeoEzP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtbrf10se5699wvb9her.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hkeoEzP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtbrf10se5699wvb9her.png" alt="Image description" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt; -&amp;gt; Give name to you cloud config. Then click "Show More".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon ECS Credentials&lt;/strong&gt; -&amp;gt; Select an AWS credential which we were configured before on step-5.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon ECS Region Name&lt;/strong&gt; -&amp;gt; choose the region where your cluster is running(we were created the on step 1)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ECS Cluster&lt;/strong&gt; -&amp;gt; Select the cluster which we were created the on step 1&lt;/li&gt;
&lt;li&gt;Click "Add" under the ECS agent templates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ripqjbGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us2ps7b1nf7rk1oscrdn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ripqjbGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us2ps7b1nf7rk1oscrdn.png" alt="Image description" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Label&lt;/strong&gt; -&amp;gt; Give the label name ( this name will use us to configure the agent with job)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Template Name&lt;/strong&gt; -&amp;gt; Give name to template&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type&lt;/strong&gt; -&amp;gt; Choose "Fargate"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operating System Family&lt;/strong&gt; -&amp;gt; Choose "linux"
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--675NhEPo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7j1fl1wagukp146siwr.png" alt="Image description" width="800" height="563"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network mode&lt;/strong&gt; - &amp;gt; Select "awsvpc"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Soft Memory Reservation and CPU units&lt;/strong&gt; give base on the &lt;a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size"&gt;doc&lt;/a&gt;. For "i.e. Memory is 2048 means, CPU should be 1024" &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subnets&lt;/strong&gt; -&amp;gt; Given the subnets to run agent on vpc network("," is a delimiter). i.e subnet-1,subnet-2&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt; -&amp;gt; Give the security group ID which we were created on step 3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assign Public Ip&lt;/strong&gt; -&amp;gt; Tick the check box.&lt;/li&gt;
&lt;li&gt;Then click "Advanced".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3dXSCWka--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/339olg4wai8we3kvtdjm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3dXSCWka--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/339olg4wai8we3kvtdjm.png" alt="Image description" width="800" height="571"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Task Execution Role ARN&lt;/strong&gt; -&amp;gt; Give the role ARN name wich we were created on step 2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ContainerUser&lt;/strong&gt; -&amp;gt; Given container user is "root".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dbwvRGeh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3y6k6ioaoaetdym50c6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dbwvRGeh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3y6k6ioaoaetdym50c6z.png" alt="Image description" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;_Note: the following log configuration step are "not required", but If you want to see agent logs then config these. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Logging Driver&lt;/strong&gt; -&amp;gt; Give "awslogs"&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Logging Configuration:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;note: you must create the log group (/ecs/jenkins-slave) on cloud watch before you give here.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Key:&lt;/strong&gt; &lt;code&gt;awslogs-group&lt;/code&gt; &lt;strong&gt;Value:&lt;/strong&gt; &lt;code&gt;/ecs/jenkins-slave&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key:&lt;/strong&gt; &lt;code&gt;awslogs-region&lt;/code&gt; &lt;strong&gt;Value:&lt;/strong&gt; &lt;code&gt;us-east-1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key:&lt;/strong&gt;&lt;code&gt;awslogs-stream-prefix&lt;/code&gt; &lt;strong&gt;Value:&lt;/strong&gt;&lt;code&gt;ecs&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x0EsNmDo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e5kdndvjqk6y27x45fop.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x0EsNmDo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e5kdndvjqk6y27x45fop.png" alt="Image description" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, Save the configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Step#8:(Create the test job)
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;On the "Dashboard", add new item.&lt;/li&gt;
&lt;li&gt;Select "Freestyle project".&lt;/li&gt;
&lt;li&gt;Give the label name which we configured on step 7 
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FIGxE-4n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pf56os2igtvsuoxwgwyh.png" alt="Image description" width="800" height="391"&gt;
&lt;/li&gt;
&lt;li&gt;On the build step just put some shell command. Then save and run the job&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mWQw5VTu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9oqqruzecciepoznpmvg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mWQw5VTu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9oqqruzecciepoznpmvg.png" alt="Image description" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The slave container is PROVISIONING
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H31W6RTT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o488j6rfw4ft000sd7lp.png" alt="Image description" width="800" height="361"&gt;
&lt;/li&gt;
&lt;li&gt;Console output&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s1z0j-7O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00bv2c4m5pt5wgi7w78z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s1z0j-7O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00bv2c4m5pt5wgi7w78z.png" alt="Image description" width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: The Jenkins and the ecs salve should be on same network.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ecs</category>
      <category>jenkins</category>
    </item>
    <item>
      <title>Restore SSH connectivity to EC2 instance if SSH key pair is lost</title>
      <dc:creator>Selvakumar</dc:creator>
      <pubDate>Thu, 06 Oct 2022 13:42:07 +0000</pubDate>
      <link>https://dev.to/ittrident/restore-ssh-connectivity-to-ec2-instance-if-ssh-key-pair-is-lost-4dnn</link>
      <guid>https://dev.to/ittrident/restore-ssh-connectivity-to-ec2-instance-if-ssh-key-pair-is-lost-4dnn</guid>
      <description>&lt;p&gt;Some time back, unfortunately, we had lost an SSH key pair belonging to an important EC2 instance. At that point in time, we had just taken a snapshot of the instance and moved on to create a new one with a new key pair. In this blog post, we shall see how to restore SSH connectivity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step #1:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new EC2 instance. If performing on an existing instance, make sure you hold that machine's SSH private key&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step #2:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stop the instance you lost the SSH key pair to and detach its volume right after (Make absolutely sure that before you go about detaching the volume, it is the correct one)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Goto --&amp;gt; AWS --&amp;gt; EC2 --&amp;gt; Volumes(EBS)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Step #3:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Post volume detachment, attach the volume to the EC2 machine of choice from &lt;strong&gt;#1&lt;/strong&gt;, which is either a new or an existing
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Goto --&amp;gt; AWS --&amp;gt; EC2 --&amp;gt; Volumes(EBS)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Select that detached volume and click &lt;code&gt;action&lt;/code&gt; choose &lt;code&gt;Attach volume&lt;/code&gt;, and select the EC2 instance that wants the volume attached to&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Verify that you have attached the volume to the right instance. Go to the EC2 console, select the instance, and select storage, and you should see &lt;em&gt;two&lt;/em&gt; volumes: one is the root and the other is our attached&lt;/li&gt;
&lt;/ul&gt;

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

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;br&gt;
Before moving on to Step #4, you have to create an SSH key pair&lt;br&gt;
&lt;code&gt;ssh-keygen -t rsa -b 4096&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step #4:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Login to the instance from &lt;strong&gt;#3&lt;/strong&gt;. Then, mount the attached volume into a directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ssh -i path/to/private.key username@ip-addr
$ lsblk
$ mkdir ~/data
$ sudo mount /dev/xvdf1 /data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Step #5:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Once mounted, navigate to the mounted directory
&lt;code&gt;cd ~/data/home/ubuntu/.ssh&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Edit the &lt;code&gt;authorized_keys&lt;/code&gt; file, delete the existing public key and paste the new public key generated in &lt;strong&gt;#4&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Once, that is done, unmount the volume
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;sudo umount ~/data&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finish it by detaching the volume from the instance, and reattaching the volume back to its former owner i.e; stopped instance.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; 1. Goto --&amp;gt; AWS --&amp;gt; EC2 --&amp;gt; Volumes (EBS)
 2. Select the correct volume, then "action --&amp;gt; force detach/detach volume"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjq3tnwr7dcrzxxso1uoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjq3tnwr7dcrzxxso1uoz.png" alt="Image description"&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; 3. Select the volume again, "action --&amp;gt; attach volume"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; "Device name" should be "/dev/sda1"&lt;br&gt;
Because this is the device naming supported by the root volume&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;h2&gt;
  
  
  Step #6:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Here on forth, you can SSH back into the machine you lost your SSH keys to, using the new private key which was created in &lt;strong&gt;#3&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ssh</category>
      <category>ec2</category>
      <category>ebs</category>
    </item>
    <item>
      <title>Migrate RDS Cross-Account</title>
      <dc:creator>Selvakumar</dc:creator>
      <pubDate>Thu, 06 Oct 2022 13:17:31 +0000</pubDate>
      <link>https://dev.to/ittrident/migrate-rds-cross-account-4bp6</link>
      <guid>https://dev.to/ittrident/migrate-rds-cross-account-4bp6</guid>
      <description>&lt;p&gt;This post gives a walkthrough on how to migrate an RDS DB across two AWS accounts.&lt;/p&gt;

&lt;h3&gt;
  
  
  #1 Take Snapshot
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Take a snapshot of the target DB
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Go to AWS --&amp;gt; RDS --&amp;gt; Snapshots --&amp;gt; Take snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  #2 Create a KMS key
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a fresh KMS key and share it with the target account
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AWS --&amp;gt; KMS --&amp;gt; Customer-managed keys --&amp;gt; create key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Before you go on creating the new key, don't skip the above step. Now proceed to enter the target account ID in the below field&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Create a snapshot (a second) &lt;em&gt;of&lt;/em&gt; the snapshot created in &lt;strong&gt;#1&lt;/strong&gt;. The reasoning for this is that the KMS key created in &lt;strong&gt;#2&lt;/strong&gt; which was shared with the target account, was done to allow the creation of the DB on the target account
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select the snapshot --&amp;gt; action --&amp;gt; copy snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;While the steps to copying are underway, select the freshly created KMS key (I named it "test") from the drop-down&lt;/li&gt;
&lt;/ul&gt;

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

&lt;h3&gt;
  
  
  #3 Share the Snapshot
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Share the copied snapshot with the target account and enter the target account ID, once more
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Select the snapshot --&amp;gt; Action --&amp;gt; share snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt;&lt;/strong&gt;  The below-proceeding steps should be executed on the target account&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  #4 Create a New DB.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The shared DB snapshot will show up in your target account
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Go to AWS --&amp;gt; RDS --&amp;gt; Snapshot --&amp;gt; Shared with me
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;In the target account, create a new DB instance by restoring the DB snapshot
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RDS --&amp;gt; Snapshot --&amp;gt; Shared with me --&amp;gt; select snapshot --&amp;gt; action --&amp;gt;  restore snapshot.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt;&lt;/strong&gt;  When creating a DB from the snapshot, &lt;strong&gt;DO NOT FORGET&lt;/strong&gt; to swap the "test" KMS key with the "default" on the target account key. Select "(default) aws/rds"&lt;/p&gt;
&lt;/blockquote&gt;

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

</description>
      <category>aws</category>
      <category>rds</category>
      <category>crossaccount</category>
      <category>dbmigration</category>
    </item>
  </channel>
</rss>
