The document outlines the steps to launch an EC2 instance and attach an EBS volume using AWS CLI:
1. Create a key pair and security group using AWS CLI commands.
2. Launch an EC2 instance using the created key pair and security group, along with specifying an AMI, instance type, and subnet.
3. Create a 1GB EBS volume in the same availability zone and attach it to the newly launched instance, specifying the volume ID and instance ID.
Passive Air Cooling System and Solar Water Heater.ppt
Task 2
1. TASK 2:
1. Create a key pair
2. Create a security group
3. Launch an instance using the above
created key pair and security group.
4. Create an EBS volume of 1 GB.
5. The final step is to attach the above created EBS volume to the instance you created in the
previous steps.
Let's Start:
Creating key-pair
To create key pair using AWS CLI we use this command:
aws ec2 create-key-pair --key-name mykey889(Enter any name here)
Creating Security Group
Use this command for creating Security Group:
aws ec2 create-security-group --group-name MySecurity(Enter any name
here) --description SGMS(Enter any name here)
2. Launching instance through AWS CLI
Following things are required for launching instance using AWS CLI:-
• Image ID
• Instance ID
• Subnet ID
• Security group ID
• Key name
Command to launch the instance:
aws ec2 run-instances --image-id ami-010aff33ed5991201 --count 1 --
instance-type t2.micro --key-name mykey889 --security-group-ids sg-
0d23a1bc3e8d5b51b --subnet-id subnet-003d0c6f34892cd9b