CLI managing instances in AWS

Palak Jain
3 min readMar 26, 2021

In this blog, we will be managing AWS EC2 instances through AWS CLI. Things that will do here are creating a key pair, security group, launching an instance using the created key pair and security group, creating an EBS volume, and then in last attaching the EBS volume to the instance which is created recently.

SO the pre-requisites here are:

  1. AWS account for the implementation
  2. OpenSSH client configured in the system

Now moving to the practical:

STEP 1: Creating an IAM user

To create the IAM user, first, go to IAM dashboard in AWS then rest is shown in images.

IAM dashboard

On the left of the IAM dashboard select Users and select Add user.

Users

Add details.

Add Permissions that you want to give to the user.

Permissions

Add tags.

Tags

In last, review and create user.

Review and create

After this download and install AWS CLI to work on it.

STEP 2: Creating Keypair

A key will be generated.

STEP 3: Creating a Security group

A security group will be generated.

STEP 4: Creating an instance and adding tags

Instance

Note down the instance id, availability zone from the above step as it will be used further.

Tags

STEP 5: Creating an EBS volume

EBS Volume

Note down the volume id from the above step as it will be used further.

STEP 6: Attaching the EBS volume to the instance created

Attaching EBS volume to the instance

Hence it’s complete.

Hope this blog helped you for managing instance using AWS CLI.

--

--