AWS COMMAND LINE INTERFACE (CLI)
Rahul Kumar
3x REDHAT | RHCSA | RHCE | AWS | Ansible | Kubernetes | Jenkins | Cloud Computing | BigData | DevOps | Artificial Intelligence | Machine Learning | Data Science | GCP | Docker | CRI-O | Terraform | OpenStack | Hadoop
An instance is created. As shown below it is in the initializing stage.:
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
So today's the task is to use this CLI and perform the following :
Task Description - AWS ???????
?? 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.
STEP 1 : (key creation)
lets begin by creating a key pair.We can use the command "create-key-pair" to make one.
The command can be used as shown below-
Once the key is created a key id is generated.We can also confirm that the key is created by going to the console. As one can see below , a key name "Task3" is created.
STEP 2 : (security group creation)
Now we need to create a security goup.We can use the command "create-security-group" to make one.The syntax is shown below.
Here security group named "ArthSecurity" is created.It generates an ID.
A security group is created and we can check it by going to the console , as shown below.
STEP 3:( launching an instance)
So now we need to launch an instance , using the above created key pair and security group.
we can use the command "run instances" and following sub commands and parameters to launch an instance.
>aws ec2 run-instances --image-id ami-03657b56516ab7912 --instance-type t2.micro --count 1 --subnet-id subnet-2975a442 --security-group-ids sg-0765b1a6ede161a42 --key-name Task
An instance is created. As shown below it is in the initializing stage.:
STEP 4:(creating an EBS volume)
Moving further , we need to create an EBS volume and attach it to out newly launched instance. We can use theh command "create-volume" to craete the volume.
It will generate an volume ID which will be used in next step of attaching the volume.
DONE!
STEP 5:(attaching the volume)
Now we move towards the last step of the task i.e attaching the volume to the instance. And we need to use a simple command i.e "attach-volume'. we need to mention the volume ID and Instance ID along with the device type.
So, lets go head and do it!
and DONE!!!
The above created volume is successfully attached to the newly launched instance using aws CLI.
Cyber Security Professional @ TCS Digital | 2x AWS Certified Security Specialist | 3x Azure Certified | RedHat Certified | Kubernetes | Python | Cloud Security | Web Application Security | Network Security
4 年Good work