AWS-Services-Using-CLI
Task Description — AWS
Step-1 Create a key pair
Step-2 Create a security group
Step-3 Launch an instance using the above created key pair and security group.
Step-4 Create an EBS volume of 1 GB.
Step-5 The final step is to attach the above created EBS volume to the instance you created in the previous steps.
*All the above steps must be performed using AWS CLI*
AWS Command Line Interface (AWS CLI) is a program that enables us to interact with the AWS services with the help of commands.
⇨ To check the version of AWS CLI, run the following command in command prompt.
aws — version
⇨ To configure the IAM account, run the following command.
aws configure
⇨ To go through all ec2 services
aws ec2 help
Step1 — Create a Key Pair
aws ec2 create-key-pair — key-name awskey
Step2 — Create a Security Group
aws ec2 create-security-group — description my first security group — group name Mysecuritygroup
Step3 — Launch an Instance using the above created Key Pair and Security Group.
aws ec2 run-instances — image-id ami-0e306788ff2473ccb — instance-type t2.micro — subnet-id — count 1 — key-name — security-group-ids
Step4 — Create an EBS volume of 1 GB.
aws ec2 create-volume — availability-zone ap-south-1a — size 1 — volume-type gp2
Step5 — The final step is to attach the above created EBS volume to the instance you created in the previous steps.
aws ec2 attach-volume — device /dev/sdh — instance-id i 0e7ad4291d7534efb — volume-id vol-0083a7a46aff5ffa5