AWS CSA Task2: 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.
In this task, using CLI we are firstly going to create a key-pair and a security group and launch an EC2 instance using the same, then create an EBS volume and at last attach the same to the instance created. And
Step 1: Create key-pair
Command:
aws ec2 create-key-pair --key-name <your-keyname>


Step 2: Create security groups
Command:
aws ec2 create-security-group --group-name <your-group-name> --description <"write description">


Step 3: Launching an EC2 instance
Command:
aws ec2 run-instances --image-id <your-image-id> --instance-type <instance-type> --security-group-ids <your-security-group-id> --subnet-id <subnet-id> --key-name <key-name>


Step 4: Creating EBS volume
Command:
aws ec2 create-volume --availability-zone <availability-zone> --size 1 --volume-type <volume-type>


Step 5: Attaching the created volume to the instance
Command:
aws ec2 attach-volume --device xvdh --instance-id <your-instance-id> --volume-id <your-volume-id>


Here in the above image we can see two volumes are attached to the instance created.
That’s all folks. Thanks for reading :)