AWS EC2, EBS and Security Group by CLI

The task we have to perform is

the important thing is each and every step we will do from the cli(command line)

Step1: Create a key-pair

this command we can use to ask help from AWS, it will give us the list of all the commands and programs that AWS ec2 has

this is the command we can use to create the key-pair

but challenge is we do not know the way this command should be used, so we will again ask from the AWS help

this command will open the document for us so we can get to know the use of this command and the syntax/synopsis to use

so this is the synopsis of this command if we want to use this program we will have to use accordingly

by this command key is created

it is always good practice to cross-check so we will verify from the GUI

so now we are sure that key has been created successfully

so first step is done

Step2: Create the security-group

we will again ask from the AWS to help because we do not need to remember the program name

this is the function we can use to create the security group

if we are not sure we can again view the document of this program and confirm

see it is clearly written in the document that this program we can use to create the security group

this is the synopsis of this command by which we can use it

so now we will create the security group

security group is created we can see the group id in output

we should verify it from GUI

security group is successfully created

but the challenge we have here we will not be able to launch any instance from this security group because this security group does not have any rule

and this is obvious if no one allowed to come in then how will you login after you launched this instance

so we will create one security rule that is anyone can connect it by ssh protocol

this is the command we have to create the inbound security rule

this is the synopsis how we can add the rules

we have successfully created the rule for security group

we should always verify from GUI

so we have created one inbound rule that any can come and connect via ssh protocol

now my security group is ready to launch

so step 2 is done

these two steps we have done till now

Step3: Launch an instance using the above created key pair and security group

Before we launch any instance we should collect the information that we will use while launching the information

so these are the information we need to launch the instances we have collected them

we are going to use the same key and same security group that we have created now

this is the command we will use to launch any instance

we can see the synopsis

by using this synopsis we can launch the instance

so by this command we launch our instance

we can verify from GUI as well

so we have successfully launched one instance from the key and the security group we have created

step3 is done

Step4: Create an EBS volume of 1GB

this is the program that will help us in creating the volume

see here we have created one ebs volume of 1gb

we can verify from the GUI as well

so step 4 is done

Step5: The final step is to attach the above created EBS volume to the instance created in the previous step

now we need to attach this ebs volume to the instance we have created

this is the command by which we can attach the ebs volume to the instance

so we can see that ebs volume of 1 gb has been attached to the instance we just launched

step5 is done

Thank you for your precious time



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