Friday, 13 December 2019

Mounting an EBS Volume on a Linux EC2 Instance in AWS (Amazon Web Services)

Mounting an EBS Volume on a Linux EC2 Instance in AWS (Amazon Web Services)

In this article,we will see Mounting an EBS Volume on a Linux EC2 Instance.
Implementation Steps
  1. View your existing Instance.
  2. Connect to Linux EC2 Instance through putty.
  3. Mount an EBS Volume to your Linux EC2 Instance.
First, we need to AWS Console page by using below link.
Click on sign in to Console button.
Logging to aws account
Login using username & password and click on sign in.
Enter to AWS Management Console
We can see the AWS Management Console Dashboard.
Go to Services, under the compute module click EC2 service to open.
I have already launched Instance.
View your existing Instance
We can see Linux Server “My Linux” which was created earlier.
Verify volumes of your Linux EC2 Instance.
Go volumes,we can see two volumes attached to Linux EC2 Instance.
The first one is root volume and second one is EBS volume.
Note
If you want to store the files inside the EBS volume, you need to mount EBS volume to your Linux EC2 Instance.Manually.
Connect to Linux EC2 Instance through putty
Mount an EBS Volume to your Linux EC2 Instance.
Switch to root user
Verify Available disks in your Linux Server
Verify the volume has any data by using the following command.
Format the volume to ext4 filesystem
Create a directory to mount our new ext4 volume (use any directory name you like)
Make Directory
Mount the volume to “ktexperts” directory
Verify the disk space in your Linux Server
Go to Mount Directory and verify files.
Make Files and Directories inside mount directory
EBS Automount on Reboot
By default on every reboot the  EBS volumes other than root volume will get unmounted.
To enable automount, you need to make an entry in the /etc/fstab file
Execute the following command to check id the fstab file has any error

Thank you for giving your valuable time to read the above information.