Launch EC-2 instance & attach EBS volume using AWS CLI
--
In this blog we will cover
📌 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.
Firstly we need to install aws cli on our machine where we want to run aws commands. After installing we need to configure our machine by the command
aws configure
Here we get Access Key Id and Secret key Id by configuring IAM(Identity Access Management) AWS
- Creating a key-pair
aws ec2 create-key-pair --key-name "cli-task3"
We can verify the results of above command by going to Key pair section of ec2 dashboard
2. Making a security-groups
aws ec2 create-security-group --description cli-2-task --group-name cli-2-sg
3. Launching an ec2 instance using the above created key pair and security group.
4. Creating an EBS volume of 1 GB.
5. Attaching the above created EBS volume to the EC2 instance
Thank you
If you have any doubt, can message me on Linkedin