After Reading This Article You will come to know about Basics Of AWS CLI and how to manage AWS Console using AWS CLI.
What Is AWS CLI??
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.
To Learn More about AWS CLI: https://aws.amazon.com/cli/
The Installation of AWS CLI is very simple. You just have to download the application compatible with your Operating System from the link provided below and just install it as you install any-other software in your system.
Link: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html
Once you have installed aws cli in your system open your Terminal or Command Prompt and Run the command mentioned below:
Make sure you have Created one user using IAM Service of AWS.
AWS configure:
To authenticate our AWS CLI with our AWS account. For that go to the command line and type the below-mentioned command.
aws configure
🎇 Next We have to provide your “access key” and “secret key” and then provide region means on which region you want to work on. After That press enter.
🎇 If no error comes up then you are successfully logged in.
🎇Now to run commands in AWS CLI you should have some knowledge of AWS and Its Services. For That The documentation by AWS is best to read and understand. Link: https://docs.aws.amazon.com/cli/index.html Simple way is to use aws help command which will lead us to great insights.
🎇In this article we are going to discuss the below mentioned tasks.
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.
🎇So Let’s Begin…
1) Create a key pair
To create a key pair we need to run the below mentioned command.
aws ec2 create-key-pair --key-name KeyName
We can also see more options using help , So here our First objective is completed.
2) Create a Security Group
To Create a Security Group We can run below mentioned Command.
aws ec2 create-security-group --group-name Name --description "DESCRIPTION"
Again we can explore more options in this command using help. So here we have created a security Group.
3) Launch an instance using the above created key pair and security group.
Here We have to use The following command. Make sure to confirm the AMI id of particular image of AWS.
aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --count 1 --subnet-id subnet-a57e77cd --security-group-ids sg-03386457f927715fa --key-name task3key
4) Create an EBS volume of 1 GB.
To create an EBS volume of 1GB we have to run the following Command.
aws ec2 create-volume --volume-type volume type --size 1 --availability-zone Zone
Again here we can also look for more options.
Confirmation in AWS Console.
5) The final step is to attach the above created EBS volume to the instance you created in the previous steps.
Type the following command:
aws ec2 attach-volume --instance-id Instance id --volume-id Volume id --device /dev/sdp
🎇These were a few demos of how we can use AWS CLI. Command Line Interface is used by most of the Professionals , Hence to know how to work in cli is very IMPORTANT
I hope you get something new out of it.
Finally😊, Thanks for reading…….
Top comments (0)