Add Keypair to existing EC2 instance

amazon ec2amazon-web-services

I was given AWS Console access to an account with 2 instances running that I cannot shut down (in production). I would however like to gain SSH access to these instances, is it possible to create a new Keypair and apply it to the instances so I can SSH in? Obtaining the exisiting pem file for the keypair the instances were created under is currently not an option.

If this isn't possible is there some other way I can get into the instances?

Best Answer

https://forums.aws.amazon.com/thread.jspa?threadID=46776&tstart=45#179656

  1. Launch a new instance
  2. Detach root device from locked instance (must be EBS)
  3. Attach root device for locked instance to new instance
  4. Logon to new instance, mount attached device, replace .ssh/authorized_keys with that of the new instance (or whatever)
  5. Unmount, detach, reattach
Related Topic