You want to launch an EC2 Instance with your own key pair in AWS.
After you generate the key pair through OpenSSL, how would you configure the key pair in EC2?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - C.
You could use a third-party tool such as OpenSSL to generate a key pair and then import the public key to Amazon EC2
Option A is incorrect because with "Create key pair", you cannot create your own key pair using OpenSSL.
Option B is incorrect because you should import the public key with "Import key pair".
Option C is CORRECT because "Import key pair" allows you to import your own public key to EC2.
Option D is incorrect because the correct AWS CLI should be import-key-pair instead of create-key-pair.
Sure, I'd be happy to help you out with that question.
To launch an EC2 instance with your own key pair in AWS, you first need to generate a key pair using OpenSSL. Here are the steps to generate a key pair using OpenSSL:
csharpopenssl genrsa -out mykey.pem 2048 openssl rsa -in mykey.pem -pubout > mykey.pub
The first command generates a private key called mykey.pem
. The second command extracts the public key from the private key and saves it in a file called mykey.pub
.
Once you have generated the key pair, you need to configure it in EC2. Here are the steps to do that:
mykey.pub
file into the "Public key contents" field.That's it! You have now configured your own key pair in EC2. You can use this key pair to launch EC2 instances and securely access them using SSH.