Connect to your EC2 Instance

  • SSH Connection: Open your terminal or command prompt and use the SSH command to connect to your EC2 instance. Replace your-ec2-instance-ip with the public IP address of your EC2 instance, and your-ec2-key.pem with the path to your private key file:
ssh -i /path/to/your-ec2-key.pem ec2-user@your-ec2-instance-ip
  • Click attach after selecting the instance to which you want it to attach. The instance has now been given access to your volume. Now use the instructions below to connect to the root.
$ sudo su 
$ cd
  • You can now list the disk available on your EC2 instance by firing the below command.
lsblk
  • If you want to check whether the disk is mounted to the server or not. You can use the below command
$ df -h

How to Attach and Mount an Extra Volume to an Linux Instance in AWS?

EBS is a block type durable and persistent storage that can be attached to EC2-instances for additional storage. Unlike EC-2 instance storage volumes which are suitable for holding temporary data EBS volumes are highly suitable for essential and long term data. EBS volumes are specific to availability zones and can only be attached to instances within the same availability zone.

Similar Reads

How it works

Amazon Elastic Block Store (Amazon EBS) stands as a versatile and scalable block storage solution tailored for Amazon Elastic Compute Cloud (Amazon EC2). Within the expansive AWS ecosystem, users enjoy the liberty to create new EBS volumes seamlessly, geared to supplement instances with additional storage capacity. However, the journey to harnessing the potential of an EBS volume hinges significantly on the pivotal task of mounting it to a specific directory within an instance....

Uses Of Attaching An Amazon EBS Volume To An Instance

Following are the some use cases of attaching an EBS to EC2 instance:...

Steps To Attach An EBS Volume To An Instance Using The Console

Before creating an EC2 instance you need to have AWS account to create Free tier AWS account refer to Amazon Web Services (AWS) – Free Tier Account Set up....

Step 1: Create an EC2 instance if you don’t have any

For detail information to create the ec2 instance refer this link....

Step 2: Create an EBS Volume

Go to Volumes Section: In the EC2 Dashboard, locate the “Volumes” option in the left-hand navigation pane and click on it. Create Volume: On the Volumes page, click the “Create Volume” button. Configure Volume: In the “Create Volume” wizard, configure the volume settings such as volume type, size, availability zone, and any additional settings as needed. Review and Create: After configuring the volume settings, review the settings to ensure they are correct, and then click the “Create Volume” button....

Step 3: Attach EBS Volume to EC2 Instance

Select Volume: In the AWS Management Console, navigate to the EC2 Dashboard and click on the “Volumes” option in the left-hand navigation pane. Select the volume you want to attach by clicking on its row in the volume list. Click Action Button: After selecting the volume, locate the “Actions” button above the volume list and click on it. Choose Attach: From the dropdown menu that appears after clicking the “Actions” button, select the “Attach Volume” option. Select Instance: In the “Attach Volume” dialog box, select the instance to which you want to attach the volume from the dropdown menu. Ensure that the instance and the volume are in the same availability zone. Specify Device: After selecting the instance, specify the device name for the volume in the “Device” field. This is the device name that will be used to mount the volume on the instance (e.g., /dev/sdf). Attach Volume: Once you have selected the instance and specified the device name, click the “Attach” button to attach the volume to the instance. Confirmation: After clicking “Attach”, you will receive a confirmation message indicating that the volume has been successfully attached to the instance....

Step 4: Connect to your EC2 Instance

SSH Connection: Open your terminal or command prompt and use the SSH command to connect to your EC2 instance. Replace your-ec2-instance-ip with the public IP address of your EC2 instance, and your-ec2-key.pem with the path to your private key file:...

Step 5: Create a Filesystem on the EBS Volume

Using the following command, format the volume as ext4 filesystem....

Step 6: Mount the EBS Volume

View all the disks which are attached to the instance by using following command.The output of lsblk removes the /dev/ prefix from full device paths....

Step 6: Configure Automatic Mount on Boot

After mounting your volume click the following command...

Steps to add Multiple EBS Volumes to EC2 Instance

Step 1: Use the following command to attach the ebs volume with aws ec instance in the following command just teplace few things like , with the your IDs....

Mount one EBS volume to Multiple EC2 Instances

No, it’s not possible to mount one EBS volume to multiple EC2 instances simultaneously. Amazon Elastic Block Store (EBS) volumes are designed to be attached to a single EC2 instance at a time....

How many EBS volumes can I attach to an Instance?

The number of storage volumes you can attach to an instance depends on its size. Larger instances usually allow more volumes....

Make An Amazon EBS Volume Available For Use On Linux

After attaching an EBS volume to AWS EC2 instance the volume will be in the form block device which is not formated before using the EBS volume you need to format the disk which which you can perform the operations. The data which is going to add to this file system will be stored in the EBS volume you can take the backup of the data by using snapshots....

Format And Mount An Attached Volume

Before making available to perform the task you need to perform some taks means you need to formate the disk which is /dev/sdf. And root volume refer to the /dev/xvda....

Steps To Add Multiple EBS Volumes To EC2 Instance

Step 1: Use the following command to attach the ebs volume with aws ec instance in the following command just teplace few things like , with the your IDs....

Mount one EBS volume to Multiple EC2 Instances

There are some conditions you need to follow before attaching an single EBS volume to multiple EC2 Instances.Following are listed below:...

Conclusion

By following the steps mentioned above you can perform attach and mount EBS voulume to the EC2 instances. As an DevOps engineer you need to take care of this whole process which will be in real time scenarios....

FAQs On Attach and Mount an Extra Volume to an Linux Instance in AWS

1. How Many EBS Volumes Can I Attach To An Instance?...