Creating key pair, security group, launch an instance on AWS, create EBS volume and attach this volume to the created instance using AWS-CLI

Lalita Sharma
4 min readOct 29, 2020

--

→ Done with launching an instance on aws to attach volume using AWS-CLI

Hello everyone, I am here with my new article with some interesting topics and tasks. So , let’s discuss about the TASK description:-

🔅 Create a key pair

🔅 Create a security group

🔅 Launch an instance using the above created key pair and security group.

🔅 Create an EBS volume of 1 GB.

🔅 The final step is to attach the above created EBS volume to the instance you created in the previous steps.

PRE-REQUISITE: Download the AWS-CLI-MSI Installer (for windows- 64bit)

https://awscli.amazonaws.com/AWSCLI.msi

then, create an account on AWS so that we can use it services and resources.

Now, Create an IAM user with ‘PowerUserAccess’ managed policy or you can give some other access too, such that —

Creating IAM user
Give access to IAM User
Finally, ‘user1’ as IAM-User created

So, IAM user has been created finally. Before going through the task, I would like to discuss some basic and important concepts i.e.

>>What is AWS services?

AWS

Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully featured services from data centers globally. Millions of customers — including the fastest-growing startups, largest enterprises, and leading government agencies — are using AWS to lower costs, become more agile, and innovate faster. It also provides some special services such as Infrastructure as a Service (IaaS), Platform as a Service (PaaS) and Software as a Service (SaaS).

>>What is AWS-CLI?

AWS-CLI(Amazon web services-Command line interface) is an open-source tool that enables you to interact with AWS services using commands through our command prompt in command line. This AWS-CLI provides the same functionality as WEB-UI based on AWS management console.

AWS-CLI

AWS-CLI is the automation tool of AWS ,highly used to launch one or more instances at a single time.

Now, let’s use CLI….

>>To check whether AWS-CLI program is installed or not, use command —

#aws

#aws — version

check aws -cli version

STEP-1 : Create a Key-Pair

Before creating key pair, firstly have to login and for that configure aws for successful authentication using access key id and secret access key by using command —

#aws configure

creating a key pair using cli command
WEBUI

STEP-2: Create a security group

security group created using CLI
WEBUI

If you want to add inbound rule to the security group then, run the below command :-

#aws ec2 authorize-security-group-ingress — group-id sg-0f2eb6b9ccbdd6935 — protocol tcp — port 22 — cidr 0.0.0.0/0

command to create inbound rule
WEBUI

STEP-3: Launch an instance using the above created key pair and security group

Command to launch instance using CLI
WEBUI

STEP-4: Create an EBS volume of 1 GB

Command to create EBS volume using cli
WEBUI

STEP-5: Attach the above created EBS volume to the instance you created above in step-3

command to attach ebs volume to launched instance
WEBUI

So, finally all steps has been done successfully — created a key-pair, security-group, launched an instance , created an EBS volume and attached volume to the instance launched above.

HENCE, task completed.

Hope this article helps you in exploring AWS-CLI in a better way…..

THANKS FOR READING (*~*)

--

--

Lalita Sharma
Lalita Sharma

Written by Lalita Sharma

Aeromodeller|Passionate|Technoholic|Learner|Technical writer

No responses yet