AWS Command Line Interface(CLI)
Operations To be Performed are:
🔅 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.
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.
How to setup AWS CLI on your Laptop?
Step 1: Download and Install the AWS CLI using the following link:
https://awscli.amazonaws.com/AWSCLIV2.msi
Step 2: Go to Command line / Terminal and Run command "aws --version" to check whether the was is installed on your machine or not
Step 3: Now Login to your AWS Account using CLI
Note: To Login you should have access key and secret key. You can get these keys by adding new IAM user through IAM service of AWS.
- To add IAM user:
a) Go to IAM Dashboard
b) Go to Users , then click add user:
c) Fill all the details and don't select "require password reset".
d) after filling details set permissions , add policy "PowerUserAccess" in "Attach existing policies directly"
e) It is optional to add tags
f) Now Review the details and click on "Create User"
g) Finally user is created and you can have "Access Key Id" and "Secret Access Key" for login using command line interface.
Command to login in your was account using AWS CLI is:
Step 4: Create Key Pair
aws ec2 create-key-pair --key-name <key name>
Check whether key pair is created or not using WebUI
Step 5: Create Security Group
aws ec2 create-security-group --group-name <SG group name> --description <description>
Check whether Security Group is created or not using WebUI
Step 6: Launch an Instance using the above created key pair and security group.
aws ec2 run-instances --image-id <image id> --instance-type <type of instance> --count <count of instance> --subnet-id <id of the subnet> --security-group-ids <security group ids> --key-name <name of the key>
Check whether Instance is created or not using WebUI
Step 7: Create an EBS volume of 1 GB
aws ec2 create-volume --volume-type <volume type> --size <size in gb> --availability-zone <zone name>
Check whether EBS Volume is created or not using WebUI
Step 8: Attach the above created EBS volume to the EC2 instance you created in the previous steps.
aws ec2 attach-volume --volume-id <id of the volume> --instance-id <instance id> --device <device name>
Check whether EBS Volume is attached to Instance or not using WebUI
Task Completed!!
Thankyou!!