Attaching EBS volume to AWS ec2 instance using CLI.

Abhijeet Bakale
3 min readMar 31, 2021

Introduction:

In this blog we are going to understand how to attach EBS through

command line interface also we are creating the security group

key pair , a EC2 instance and EBS volume through aws cli and

plugging them togrther.

AWS cli :

The AWS Command Line Interface (CLI) is a unified tool to

manage your AWS services. With just one tool to download

and configure, you can control multiple AWS services from the

command line and automate them through scripts.

Benefits:

One of the main benefits is the ability to save substantial time. The savings comes in the form of easier installs, support of all services from one tool, moving beyond GUIs, and automating processes and commands with shell scripting.

How It Works:

AWS is a secure cloud services platform that offers computing power, content delivery, database storage, and other infrastructure services for developers. Proponents point to its speed, flexible pricing, exemplary customer service, and a huge variety of services as benefits. The AWS CLI puts the icing on the cake by tying control of all those services together into one simple command line interface. It cuts out the user-friendly (but time-consuming, according to some) step of interacting with the system through a Graphical User Interface (GUI).

We are doing following steps to accomplish our task:

1.Creating a keypair.

2.Creating a Security group.

3.Launcingh instance using above created keypair and security group.

4.Creating EBS volume of 1GB.

5.Final step is attaching the above created EBS volume to the instance you created in previous steps.

Step1. Logging in to my aws using aws configure command.

Step2. Creating key-pair through cli.

Step3. Checking the key through graphical interface.

Step4. Creating new security group.

Step5. Checking the Security group through graphical interface.

Step6. Launching a ec-2 instance from cli.

Step7. Checking the launched instance .

Step8. Creating a EBS volume .

Step9. Checking the EBS Volume is available or not.

Step10. Attaching the EBS volume to newly created Ec2 instance.

Step11.Checking if the EBS is connected or not and BOOM!! Its connected…. And in use.

Conclusion : Finally we are able to connect a EBS volume using aws cli.

--

--