Performing different Tasks on AWS by using CLI.

To work on AWS by using Bare-metal OS CLI , firstly we need to have a installed AWS CLI program and also we need to have a user with a programmatic access which provides us with access key ID and secret access key which later on help us to login by using CLI . Now to make task ready on CLI write command aws configure and then we have to login with the given access key Id and secret access key and also have to specify which region we would work on .Now we are ready to perform tasks ,but befor that this are the prerequisites.

Prasantmahato
5 min readOct 15, 2020

CREATE A KEY PAIR

First task I performed was to create a key pair . To launch/create a key pair we need to know under which service does key pair is in ,we can easily get to know by running aws help command now we know ec2 is the service then we find for subcommand as we want to create to key pair we again use aws ec2 help command now we get create-key-pair is the subcommand ,so now we need to know the option again by aws ec2 create-key-pair help now we get the option we need is — key-name .Now the final command to create key pair is aws ec2 create-key-pair — key-name mykey2.

Successfully created a key pair

CREATE A SECURITY GROUP

To launch/create a security group we need to know under which service does security group is in ,we can easily get to know by running aws help command now we know ec2 is the service, then we find for subcommand as we want to create to security group we again use aws ec2 help command now we get create-security-group is the subcommand ,so now we need to know the option again by aws ec2 create-security-group help now we get the option we need is — description and — group-name .Now the final command to create key pair is aws ec2 create-security-group — description “Making this security group for testing ” — group-name “testing” .

Successfully created a security group

LAUNCH AN INSTANCE USING THE ABOVE CREATED KEY PAIR AND SECURITY GROUP .

To launch/create a instance we need to know under which service does security group is in ,we can easily get to know by running aws help command now we know ec2 is the service, then we find for subcommand as we want to create to security group we again use aws ec2 help command now we get run-instances is the subcommand ,so now we need to know the option again by aws ec2 run-instances help now we get the option we need is — image-id , — instance-type , — key-name , — security-group-ids , — subnet-id and — count .Now the final command to create instance is aws ec2 run-instances — image-id xxxx — instance-type xxxx — key-name xxxx — security-group-ids xxxx — subnet-id xxxx — count x .

Successfully launched an instance

CREATE AN EBS VOLUME OF 1GB

To launch/create a EBS volume we need to know under which service does security group is in ,we can easily get to know by running aws help command now we know ec2 is the service, then we find for subcommand as we want to create to security group we again use aws ec2 help command now we get create-volume is the subcommand ,so now we need to know the option again by aws ec2 create-volume help now we get the option we need is — availibility-zone , — size and — volume-type .Now the final command to create volume is aws ec2 create-volume — availibilty-zone “xxxxx” — size 1 — volume-type “xxx” .

Successfully created an EBS volume

ATTACHING THE EBS VOLUME CREATED BY US TO THE INSTANCE WE CREATED .

To launch/create a EBS volume we need to know under which service does security group is in ,we can easily get to know by running aws help command now we know ec2 is the service, then we find for subcommand as we want to create to security group we again use aws ec2 help command now we get attach-volume is the subcommand ,so now we need to know the option again by aws ec2 attach-volume help now we get the option we need is — device , — instance-id and — volume-id .Now the final command to create volume is aws ec2 attach-volume — device xxxxx — size 1 — volume-id xxx — instance-id xxxxxx.

Successfully attached the EBS volume .

I have successfully completed all the tasks given below .

Assigned Tasks

I really appreciate that you are reading my post.

THANKYOU

--

--