A company accidentally deleted the private key for an Amazon Elastic Block Store (Amazon EBS)–backed Amazon EC2 instance. A security engineer must regain access to the instance. Which combination of steps will accomplish this? (Choose two.)
Choose an answer
Tap an option to check your answer.
Correct answer: Stop the instance. Detach the root volume. Generate a new key pair., When the volume is detached from the original instance, attach it to another instance as a data volume. Modify the authorized_keys file with a new public key. Move the volume back to the original instance. Start the instance..
Why this is the answer
To regain access to an EC2 instance after losing its private key, you must replace the public key stored on the instance. This process requires stopping the instance to detach its root volume. You cannot detach the root volume of a running instance. After stopping the instance, you detach its root volume and attach it to a temporary "rescue" instance as a data volume. Then, you generate a new key pair and copy the public key from this new key pair into the authorizedkeys file on the mounted root volume. Once the authorizedkeys file is updated, you detach the volume from the rescue instance and reattach it to the original instance as its root volume. Finally, you start the original instance, and you can now access it using the new private key. Attaching the volume back to the original instance while it is running is not possible, as the instance must be stopped to modify its root volume. Modifying the authorizedkeys file with a new private key is incorrect; it should be the public key.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed