A. The key pair named 'WrongKey' does not exist in your AWS account
B. The AMI ID is invalid
C. The instance type t3.small is not supported
D. The security group 'Default' is missing
Solution
Step 1: Understand the error message
'InvalidKeyPair.NotFound' means the specified key pair is not found in your AWS account.
Step 2: Match error to command parameters
The key-name 'WrongKey' likely does not exist or is misspelled, causing the error.
Final Answer:
The key pair named 'WrongKey' does not exist in your AWS account -> Option A
Quick Check:
InvalidKeyPair error = missing key pair [OK]
Hint: Check key pair name spelling if InvalidKeyPair error occurs [OK]
Common Mistakes:
Assuming AMI or instance type caused the error
Thinking security group 'Default' is missing
Ignoring key pair existence in the region
5. You want to launch 3 EC2 instances with the same settings but different subnet IDs for high availability. Which approach is best?
hard
A. Use aws ec2 create-subnet to create three subnets and launch one instance
B. Run one aws ec2 run-instances command with --count 3 and a single --subnet-id
C. Launch one instance and then clone it twice manually
D. Run three separate aws ec2 run-instances commands, each with a different --subnet-id
Solution
Step 1: Understand subnet and instance launch
Each EC2 instance can be launched in only one subnet at a time.
Step 2: Plan for multiple subnets
To launch instances in different subnets, run separate commands specifying each subnet ID.
Step 3: Evaluate options
Run three separate aws ec2 run-instances commands, each with a different --subnet-id. This runs three commands with different subnet IDs, ensuring instances spread across subnets.
Final Answer:
Run three separate aws ec2 run-instances commands, each with a different --subnet-id -> Option D
Quick Check:
One subnet per instance, multiple commands for multiple subnets [OK]
Hint: One subnet per instance, use multiple commands for multiple subnets [OK]