AWS with CLI

Ashish Dwivedi
4 min readOct 15, 2020

--

What is the Command-line interface (CLI) and AWS (CLI)?

A command-line interface processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor. Similarly, 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.

Why we use AWS CLI?

AWS CLI gives you the ability to automate the entire process of controlling and managing AWS services through scripts. These scripts make it easy for users to fully automate cloud infrastructure. Prior to AWS CLI, users needed a dedicated CLI tool for just the EC2 service.

In this Article we will see

1. How to Create a key pair through cli

  1. How to Create a security group
  2. Launching an instance using the above created key pair and security group.
  3. How we can create an EBS volume of 1 GB.
  4. The final step is to attach the above created EBS volume to the instance we created in the previous steps.

Prerequisites for this task

  1. Installed AWS version 2 on your os. If not use this link to download https://awscli.amazonaws.com/AWSCLIV2.msi
  2. An AWS account.

ALl of the first we have to create IAM user

To create an access key for an IAM user

1. Sign in to the AWS Management Console and open the IAM console

2. Search for users and create one

3.We need to give permissions to a user to successfully authenticate with CLI.

4.After this step create a user and the Access Key and Secret key will be displayed

We have successfully created a user.

Now we will use command

aws configure

output -

Here we have to provide Access key and Secret key

Now to create a key pair we use command

For creating security group we will take help of aws document we will use command

aws ec2 help

after running this command we have to search command to create security group

Now over security group is created

After security we have to give inbounb rules

For Launching Ec2 we will use command -

Now we will creat EBS of 1gb

For this also we will take help of aws documents

Now for attaching the created EBS volume we will use command -

By this command this will attach succefully

Thanks for reading !!

☀️☀️☀️Have a good day☀️☀️☀️

--

--

No responses yet