KEY-PAIR / SECURITY-GROUP/ VOLUME CREATION ON AWS USING CLI

This blog welcomes my readers to that part of the segment where we will be working on AWS using CLI (Command Line Interface). The thought of using CLI scared me at first but as of now, I pretty much enjoy it.

source : Google

So lets get started with the task…………………..!

  1. Create a key pair
  2. Create a security group
  3. Launch an instance using the above created key pair and security group.
  4. Create an EBS volume of 80 GB.
  5. The final step is to attach the above created EBS volume to the instance you created in the previous steps.

Above is the problem statement that we are going to solve part by part. So here is my solution for the problem.

  • Software to be installed — AWSCLIV2.msi
Software Installation
  • Creating User and setting the password (here, I gave the name of my choice and choose the create the password manually)
User Created
  • Confirm the software’s installation on CLI
  • Help can accumulated using this command

aws ec2 help

  • Configure the system by entering details acquired from creation of user on AWS portal (data required — USER ID, PASSWORD, REGION, available from — AWS Portal inside IAM{Users})
  • Create Key-pair using the command —

aws ec2 create-key-pair — key-name MyKey1

  • Create Security Group

aws ec2 create-security-group — group-name MySG — description “Security Group”

  • Create Volume Group
  • Run instance using key-pair name, security group id, subnet mask (obtained from AWS portal)

aws ec2 run-instances — image-id ami-03d64741867e7bb94 — count 1 — instance-type t2.micro — key-name MyKey1 — security-group-ids sg-0cbab2cf5b619b16f — subnet-id subnet-344a5f4e

  • Attach Volume Group to the existing Instance (data required — instance id, available from — Running Instances {AWS PORTAL})

aws ec2 attach-volume — device /dev/sdd — instance-id i-05e59e0f86f8c08e2 — volume-id vol-0a6d2ec5c94a4d9f2

As clear from above image, the volume has been created and successfully attached to the running instance in the same region (in my case it is, us-east-2 / Ohio)

Hence, the task was completed successfully!

Thanks For Reading…!!

--

--

--

Full Stack Web Developer | Ansible | Docker | Kubernetes | OpenShift | RedHat | AWS | Azure | GCP

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Boolean Operators in Python

Building a Continuous Delivery flow for your Infrastructure as Code.

What is SaaS? The Definitive List of Characteristics and Differences

Power BI Solution at LFS

Everyone is a Product Manager

How to deploy NextCloud in your Linux Server with docker and SSL

Data Visualization

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Niharika Dhanik

Niharika Dhanik

Full Stack Web Developer | Ansible | Docker | Kubernetes | OpenShift | RedHat | AWS | Azure | GCP

More from Medium

AWS Elastic Beanstalk disable journald RateLimitBurst

Centralized Logging for Multi Accounts and Multi Regions Using CloudTrail

How to create Records in AWS Route53

How to add GUI Desktop in AWS Ubuntu server EC2