
Well we already know how to launch or even run an instance using WebUi provided by amazon and it is quite easy to do that…
But here question is what we have to automate our AWS or even to just do things with one click or with using simple commands, Yes we can definitely do that !!…. But do you know what we need if Not here we will discuss it
SO here’s our task we going to perform:
🔅 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.
Here’s the steps we need to follow to do above task.
1)Security Group id created is : “Group Id”: “sg-083b1d3f1c794c704”

Creating a New Key Pair.
2)(a)Using help to check what is needed for creating key pair :AWS ec2 create-key-pair help

2)(ii)Creating a key pair with name : aws ec2 create-key-pair — key-name CLIkey

Creating a new instances and running it
REQUIREMENTS TO CRETAE A NEW INSTANCE
— AMI id : ami-052c08d70def0ac62
— Instance id : t2.micro
— Subnet : subnet-a9cdc4c1
— Availabilty zone : ap-south-1a
— Key name : CLIkey
##We will use the following command to launch/run new instance:-##
aws ec2 — image-id <id> — instance-type <type> — count <1> — subnet-id <value> — security-group-ids <sg_id> — key-name <key>.

Here’s the proof that new instance is created

Creating a Volume using CLI using Following Commands
aws ec2 create-volume \
— volume-type gp2 \
— size 1 \
— availability-zone ap-south-1a

Attaching the Above created Volume to new instance
To do so we will use help command to check all the requirements.
(a)aws ec2 attach-volume help

(b)Now attaching the above volume to the instance created
aws ec2 attach-volume — device “xvdh” — instance-id i-0318d487e763fc150 — volume-id vol-0147697afc8475858

Here’s the proof that EBS Volume has been attached and in use with Newly created Instance

One key note : All the task are given under the guidance of “Mr. Vimal Daga”, I would like to thank him for all the efforts and knowledge passed by him to each one of us.
Everything taught till now or even in future by sir is very useful and mind blowing.
Thanking again for providing such opportunity to us for being better in technology as well as an overall human being.