<?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: Oluwole Suliat Adefowoke</title>
    <description>The latest articles on DEV Community by Oluwole Suliat Adefowoke (@fowokzz).</description>
    <link>https://dev.to/fowokzz</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%2F1252289%2Fedab84f8-9372-4fb8-b3c5-522e970ed75f.jpeg</url>
      <title>DEV Community: Oluwole Suliat Adefowoke</title>
      <link>https://dev.to/fowokzz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fowokzz"/>
    <language>en</language>
    <item>
      <title>Elastic File System (EFS) Multi-Instance Deployment: Streamlining File Sharing Across AWS Instances</title>
      <dc:creator>Oluwole Suliat Adefowoke</dc:creator>
      <pubDate>Fri, 19 Jan 2024 19:00:11 +0000</pubDate>
      <link>https://dev.to/fowokzz/elastic-file-system-efs-multi-instance-deployment-streamlining-file-sharing-across-aws-instances-47im</link>
      <guid>https://dev.to/fowokzz/elastic-file-system-efs-multi-instance-deployment-streamlining-file-sharing-across-aws-instances-47im</guid>
      <description>&lt;p&gt;In this article, we'll dive into AWS Elastic File System (EFS), a robust storage service that sets itself apart by enabling simultaneous mounting on multiple instances, offering a heightened level of flexibility. If you missed our exploration of Elastic Block Store (EBS), you can find it &lt;a href="https://dev.to/fowokzz/exploring-awss-elastic-block-store-a-step-by-step-beginners-guide-52f2"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, let's proceed with a comprehensive overview of the steps involved:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Create EC2 Instances
&lt;/h4&gt;

&lt;p&gt;Similar to the process for Elastic Block Store (EBS), I provisioned servers with no special configurations, running on &lt;strong&gt;eu-north-1b&lt;/strong&gt;. &lt;/p&gt;

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

&lt;h4&gt;
  
  
  2. Create File System
&lt;/h4&gt;

&lt;p&gt;In the AWS console, search for Elastic File System service and click on &lt;strong&gt;"Create file system"&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3kt3chtjhgqrpborbop.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3kt3chtjhgqrpborbop.png" alt="Image description" width="800" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose between quick creation with default settings or customize for specific configurations&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr00azmqi2j1lrdu1u41o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr00azmqi2j1lrdu1u41o.png" alt="Image description" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For customization, follow the detailed steps below:&lt;/p&gt;
&lt;h5&gt;
  
  
  Step 1: File System Settings
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;File Name: &lt;strong&gt;efs-demo&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;File System Type: Regional (redundant across multiple Availability Zones)&lt;/li&gt;
&lt;li&gt;Automatic Backups: Disable (for now)&lt;/li&gt;
&lt;li&gt;Lifecycle Management: Default&lt;/li&gt;
&lt;li&gt;Performance Settings: Default
Click on &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Step 2: Network Access
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Specify Mount Targets for each Availability Zone where instances are running.&lt;/li&gt;
&lt;li&gt;Select the VPC and subnet ID of your instances. (EFS is a VPC specific service)&lt;/li&gt;
&lt;li&gt;Specify a security group which will act as a firewall for Mount Targets.
Click on  &lt;strong&gt;Next&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Step 3: File System Policy
&lt;/h5&gt;

&lt;p&gt;This is very optional setting but you can configure different file system policies if you want but for this demo, we leave as default and proceed to review and create the file system &lt;/p&gt;

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

&lt;p&gt;Access the terminal with connections to both Instances A &amp;amp; B.&lt;br&gt;
Starting with Instance-A, &lt;em&gt;when working with EFS, Amazon has made it really easy if you're using an Amazon Linux Image, you can install a package they created called &lt;strong&gt;Amazon-EFS-utils&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
To install this package, Run &lt;code&gt;sudo yum install -y amazon-efs-utils&lt;/code&gt;&lt;br&gt;
Repeat this command on Instance-B.&lt;/p&gt;

&lt;p&gt;Now that we installed the EFS package, we want to mount that file system we created in the console. &lt;br&gt;
To see a list of installed efs packages; Run &lt;code&gt;sudo mount. + tab&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ncer5epu4gp0c798guq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ncer5epu4gp0c798guq.png" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;br&gt;
We can see a .efs after running that command because we installed the amazon efs utils package. &lt;/p&gt;

&lt;p&gt;To mount a file system, you need 2 things &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;efs instance id&lt;/li&gt;
&lt;li&gt;a folder/directory to mount on 
To get the efs instance id, go in to the console, click on the efs instance and copy the id as indicated in the image below &lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Now that we have all we need, to mount file system, Run &lt;code&gt;sudo mount.efs efs-instance-id /efsdemo/&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  SIDE NOTE: I went through this so you don't have to
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F60784ooo8l5x6dx8jw73.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F60784ooo8l5x6dx8jw73.png" alt="Image description" width="800" height="154"&gt;&lt;/a&gt;&lt;br&gt;
If encountering mounting errors, ensure that the mount target security group has an inbound rule allowing NFS access from the EC2 security group. Edit the inbound rule accordingly.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F74i25jb771w0lvep1vca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F74i25jb771w0lvep1vca.png" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;br&gt;
Once the error is resolved, running &lt;code&gt;df -h&lt;/code&gt; should confirm the successful mounting of the file system at &lt;strong&gt;/efsdemo&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At this point, we technically can use our EFS file systems but the changes made would not persist through a reboot&lt;/p&gt;
&lt;h4&gt;
  
  
  4. Persist Data
&lt;/h4&gt;

&lt;p&gt;To ensure data persistence through reboots, open the fstab file using the command &lt;code&gt;sudo nano etc/fstab&lt;/code&gt;. &lt;br&gt;
Provide essential details such as the file system ID, the mount point, the file system type, and additional configurations sourced from the &lt;a href="https://docs.aws.amazon.com/efs/latest/ug/mounting-fs-nfs-mount-settings.html"&gt;AWS EFS Mount Configuration&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;After completing these configurations, a system reboot should automatically mount the file system, ensuring seamless data persistence.&lt;/p&gt;

&lt;p&gt;To verify the persistence, create a file within the mounted directory using the command: &lt;br&gt;
&lt;code&gt;sudo nano efsfile.txt&lt;/code&gt; and input the desired content.&lt;/p&gt;

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

&lt;p&gt;Unlike EBS, EFS supports simultaneous mounting on multiple instances. Proceed to the second instance and replicate the process performed on Instance-A. Execute the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir /efsdemo
sudo mount.efs fs-0b058364663762fc9 /efsdemo
df -h
cd /efsdemo/
ls 
cat efsfile.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7w5c3dvr9xfqvqs48le9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7w5c3dvr9xfqvqs48le9.png" alt="Image description" width="800" height="419"&gt;&lt;/a&gt;&lt;br&gt;
The successful execution of these commands on Instance-B demonstrates that the file created on Instance-A is accessible on Instance-B.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7nmjgl7bbmql0iefh37b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7nmjgl7bbmql0iefh37b.png" alt="Image description" width="800" height="392"&gt;&lt;/a&gt;&lt;br&gt;
Additionally, creating a new file &lt;strong&gt;efsfile2.txt&lt;/strong&gt; on Instance-B is reflected when inspecting the contents on Instance-A.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feo3syo3gwcraahcdq0vs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feo3syo3gwcraahcdq0vs.png" alt="Image description" width="694" height="395"&gt;&lt;/a&gt;&lt;br&gt;
This capability underscores the flexibility and convenience offered by AWS Elastic File System for simultaneous data access across multiple instances.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>storage</category>
      <category>awscommunitybuilder</category>
      <category>awsefs</category>
    </item>
    <item>
      <title>Exploring AWS's Elastic Block Store: A Step-by-Step Beginner's Guide</title>
      <dc:creator>Oluwole Suliat Adefowoke</dc:creator>
      <pubDate>Mon, 15 Jan 2024 17:10:38 +0000</pubDate>
      <link>https://dev.to/fowokzz/exploring-awss-elastic-block-store-a-step-by-step-beginners-guide-52f2</link>
      <guid>https://dev.to/fowokzz/exploring-awss-elastic-block-store-a-step-by-step-beginners-guide-52f2</guid>
      <description>&lt;p&gt;In this article, we will provide a step-by-step beginner's guide on how to effectively utilize AWS's Elastic Block Store (EBS).&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to Note
&lt;/h3&gt;

&lt;p&gt;Before we delve into the detailed explanation, it's crucial to keep the following points in mind:&lt;/p&gt;

&lt;h4&gt;
  
  
  EC2 Instance and EBS Availability Zone:
&lt;/h4&gt;

&lt;p&gt;Ensure that your EC2 instance is in the same availability zone as your EBS. This alignment is vital for seamless interaction between the two.&lt;/p&gt;

&lt;h4&gt;
  
  
  EBS Volume Independence:
&lt;/h4&gt;

&lt;p&gt;Unlike EC2 instances, EBS volumes are not tied to a specific instance. This characteristic allows for flexibility in managing storage resources.&lt;/p&gt;

&lt;p&gt;Now, let's proceed with a comprehensive overview of the steps involved:&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Create EC2 Instances
&lt;/h4&gt;

&lt;p&gt;For this demonstration, I have provisioned a couple of servers with no special configurations. However, it's essential to highlight the importance of the Availability Zone (AZ). Both instances in the image below are deployed in &lt;strong&gt;eu-north-1b&lt;/strong&gt;. As EBS is specific to an Availability Zone, any volume attached must be created in the same zone as the instances.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1o9se3woq5p7wz1j4uzk.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%2F1o9se3woq5p7wz1j4uzk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Create EBS Volume
&lt;/h4&gt;

&lt;p&gt;Navigate to the EBS page within the EC2 window. Scroll down to "Elastic Block Store" and click on "Volume." Even if you have existing volumes, click "Create volume" for a new one. Configure the volume settings based on your specifications. For this demo, we'll use the minimum requirements, as shown in the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9n9ii07z7nprlm9uken5.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%2F9n9ii07z7nprlm9uken5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember to create the volume in the same availability zone as your instances. Once created, wait for the volume state to change to "attached" before proceeding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1868if2440zz0zqu6zhs.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%2F1868if2440zz0zqu6zhs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Attach Volume to EC2 Instance
&lt;/h4&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%2F9ct7jyki6sjwwrpe7obx.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%2F9ct7jyki6sjwwrpe7obx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the volume details, click on the "Actions" button and select "Attach Volume". Specify the instance by clicking the dropdown.&lt;br&gt;
As in the image below, we're attaching it to Instance-A.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fifrq3ztcqgi3h6i6xlkx.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%2Fifrq3ztcqgi3h6i6xlkx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the image above, we can see the device name. When we attach the EBS Volume, that's the name it's going to show up as. We can also see a message saying on newer Linux kernels, it may rename it to &lt;strong&gt;/dev/xvdf&lt;/strong&gt; through &lt;strong&gt;/dev/xvdp&lt;/strong&gt;. So it's going to be either &lt;strong&gt;/dev/sdf&lt;/strong&gt; or &lt;strong&gt;/dev/xvdf&lt;/strong&gt; depending on how our operating system handles it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;However, it is also important to note that with the advent of &lt;strong&gt;NVMe&lt;/strong&gt; storage, the naming convention has changed to better reflect the underlying technology. This naming scheme is more specific and aligned with the characteristics of &lt;strong&gt;NVMe&lt;/strong&gt; storage, providing a clearer representation of the device's identity in the system. The shift to the "&lt;strong&gt;nvmeXnY&lt;/strong&gt;" naming convention is part of the Linux kernel's adaptation to better support and differentiate &lt;strong&gt;NVMe&lt;/strong&gt; storage devices. But that's what to look out for once we log into our instances.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We go into the terminal, and we have a connection with both instances. Since we attached the EBS Volume to Instance-A, that's what we'll be working with for now.&lt;/p&gt;
&lt;h4&gt;
  
  
  4. Create File System
&lt;/h4&gt;

&lt;p&gt;On Instance-A, to take a look at all the block devices connected to it, Run: &lt;code&gt;lsblk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuiuinavansa9cnjgyzdh.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%2Fuiuinavansa9cnjgyzdh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see from the image above that our Operating system named the block device as "nvme1n1". In this case, it suggests it's an NVMe (Non-Volatile Memory Express) device. The number "1" indicates the index of the NVMe controller, and "n1" suggests it is the first NVMe namespace under that controller. The one that is 8G is our root device where the OS was installed, and the one that's 20G is our EBS Volume.&lt;/p&gt;

&lt;p&gt;At this point, we can't do anything with it. We have to create a file system, then mount it. First, let's verify if there's a file system on there. Run: &lt;code&gt;sudo file -s /dev/nvme1n1&lt;/code&gt;&lt;br&gt;
&lt;em&gt;Don't forget to specify the name of YOUR block device; i.e., either /dev/xvdf, /dev/nvme1n1, or /dev/sdf&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3gma7ir1j06wps6c9ga.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%2Fn3gma7ir1j06wps6c9ga.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
If the command returns "data" like in the image above, that means there's no file system available. &lt;br&gt;
To create a file system, type in the command &lt;code&gt;sudo mkfs. + tab&lt;/code&gt; to show all the different file systems you can create. For this demo, we'll be using .ext4. &lt;br&gt;
Run: &lt;code&gt;sudo mkfs.ext4 /dev/nvme1n1&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpizghkpu6qfqgeorpvw0.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%2Fpizghkpu6qfqgeorpvw0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the file system is created and we run the command again, we can see that it doesn't return "data" like earlier as indicated in the image above.&lt;/p&gt;
&lt;h4&gt;
  
  
  5. Mount File System
&lt;/h4&gt;

&lt;p&gt;After the file system has been created, the next step is to mount it. First, we need a directory that we're going to mount this file system to. Run: &lt;code&gt;sudo mkdir /ebs-demo&lt;/code&gt;&lt;br&gt;
And if you run &lt;code&gt;ls /&lt;/code&gt;, you should see our ebs-demo folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fntkrcvxr54vrwju9ymxy.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%2Fntkrcvxr54vrwju9ymxy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To mount the file system in the directory, &lt;br&gt;
Run: &lt;code&gt;sudo mount /dev/nvme1n1 /ebs-demo/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now if we run &lt;code&gt;lsblk&lt;/code&gt; again, we can see it has been mounted on the ebs-demo folder. And if we run &lt;code&gt;df -h&lt;/code&gt;, we can see our file system /dev/nvme1n1 has been mounted on /ebs-demo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhvrx9q8slobygt2myvw1.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%2Fhvrx9q8slobygt2myvw1.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
At this point, our configurations are set. We have our EBS Volume, created file system, and mounted it to a folder. However, our changes in data wouldn't persist through a reboot.&lt;/p&gt;
&lt;h4&gt;
  
  
  6. To Persist Data
&lt;/h4&gt;

&lt;p&gt;Cd into the folder /ebs-demo and run &lt;code&gt;sudo blkid&lt;/code&gt; to get the UUID for our file system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1xs9shrdi0btu8xgmk8.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%2Ft1xs9shrdi0btu8xgmk8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the UUID as indicated in the image above and use it to modify the FS tab file so that it can read the configurations upon a reboot. Run: &lt;code&gt;sudo nano /etc/fstab&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15unrv9tjz304wztumxg.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%2F15unrv9tjz304wztumxg.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
All we have to do is edit the file by adding the UUID number, the specific directory where we mounted the file system, type of file system, and specify to use default configuration settings as indicated in the image above.&lt;/p&gt;

&lt;p&gt;At this point, if we reboot our machine, it should automatically mount to our file system.&lt;/p&gt;

&lt;p&gt;Now that everything is up and running, we can create a file inside the directory that we mount our file system. &lt;br&gt;
Run: &lt;code&gt;sudo nano ebsfile.txt&lt;/code&gt; and put in message you want in the text file. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5eum244ubimxauzlk3ob.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%2F5eum244ubimxauzlk3ob.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  7. Detach from Instance A and Attach to Instance B
&lt;/h4&gt;

&lt;p&gt;Returning to the AWS console, our goal is to demonstrate that an EBS Volume is not tied exclusively to a specific instance. Although the option to detach the volume may initially appear greyed out, it is indeed possible to detach and reattach it to another instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frn2wyf7blqbhz7pvv3jx.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%2Frn2wyf7blqbhz7pvv3jx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To execute this, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the AWS EC2 Instances dashboard.&lt;/li&gt;
&lt;li&gt;Locate and stop Instance-A.&lt;/li&gt;
&lt;li&gt;Once stopped, proceed to detach the EBS volume. Allow a few moments for the operation to complete.&lt;/li&gt;
&lt;li&gt;After detaching from Instance-A, reattach the volume to a different instance, in this case, Instance-B.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once the volume is successfully attached to Instance-B, return to the terminal connected to Instance-B.&lt;/p&gt;

&lt;p&gt;Run the following command to check the available block devices, similar to what was done on Instance-A: &lt;code&gt;lsblk&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxdzpi9qa6mf1si6d26p.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%2Fwxdzpi9qa6mf1si6d26p.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should observe the 20GB block device named "nvme1n1", as seen previously. To ensure the presence of a file system, &lt;br&gt;
execute: &lt;code&gt;sudo file -s /dev/nvme1n1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xg9naptiloctrzsod45.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%2F0xg9naptiloctrzsod45.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you have the flexibility to mount this file system wherever needed. For the purposes of this demo, create a directory and mount the file system using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir /ebs2-demo
sudo mount /dev/nvme1n1 /ebs2-demo/

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

&lt;/div&gt;



&lt;p&gt;Navigate into /ebs2-demo/, list the files, and confirm the existence of the previously created ebsfile.txt. If you view the content of this file, you will find the data persisted from Instance-A.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftn7r5nkg2wnbmqnf7m7v.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%2Ftn7r5nkg2wnbmqnf7m7v.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This demonstration illustrates the dynamic nature of EBS Volumes, allowing detachment, reattachment to different instances, and seamless continuity of data operations. &lt;br&gt;
As a concluding step, you can proceed to delete both instances and the associated EBS volume.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awsebs</category>
      <category>storage</category>
      <category>cloudpractitioner</category>
    </item>
  </channel>
</rss>
