KEY-PAIR / SECURITY-GROUP/ VOLUME CREATION ON AWS USING CLI
This blog welcomes my readers to that part of the segment where we will be working on AWS using CLI (Command Line Interface). The thought of using CLI scared me at first but as of now, I pretty much enjoy it.
So lets get started with the task…………………..!
- 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 80 GB.
- The final step is to attach the above created EBS volume to the instance you created in the previous steps.
Above is the problem statement that we are going to solve part by part. So here is my solution for the problem.
- Software to be installed — AWSCLIV2.msi
- Creating User and setting the password (here, I gave the name of my choice and choose the create the password manually)
- Confirm the software’s installation on CLI
- Help can accumulated using this command
aws ec2 help
- Configure the system by entering details acquired from creation of user on AWS portal (data required — USER ID, PASSWORD, REGION, available from — AWS Portal inside IAM{Users})
- Create Key-pair using the command —
aws ec2 create-key-pair — key-name MyKey1
- Create Security Group
aws ec2 create-security-group — group-name MySG — description “Security Group”
- Create Volume Group
- Run instance using key-pair name, security group id, subnet mask (obtained from AWS portal)
aws ec2 run-instances — image-id ami-03d64741867e7bb94 — count 1 — instance-type t2.micro — key-name MyKey1 — security-group-ids sg-0cbab2cf5b619b16f — subnet-id subnet-344a5f4e
- Attach Volume Group to the existing Instance (data required — instance id, available from — Running Instances {AWS PORTAL})
aws ec2 attach-volume — device /dev/sdd — instance-id i-05e59e0f86f8c08e2 — volume-id vol-0a6d2ec5c94a4d9f2
As clear from above image, the volume has been created and successfully attached to the running instance in the same region (in my case it is, us-east-2 / Ohio)
Hence, the task was completed successfully!
Thanks For Reading…!!