Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We own an AWS account but we're no longer in contact with the developer who had sole access to the running EC2 instance.

Restarting the instance may not be possible: As far as we understand, shutting down an instance can cause changes in the assigned IP. Also, there may be app processes that need to be started manually. We don't know yet.

Thus, the question: Given that we own the account and have access to the AWS admin UI, how can we gain root access to our running instance?

(All we've learned so far points to installing new keysets that will give access to NEWLY started instances.)

share|improve this question
up vote 2 down vote accepted

I don't see what the issue is with the assigned IP changing. If your using a Amazon static ip , assigned to the given instance, then it wont matter. DNS will still resolve after the restart of the instance.

To get control of the machine and get the password: First, stop the instance (do NOT terminate!!!) . Then, start another instance of a blank server (same OS), then attach the hard drive of the inaccessible instance , and from their you can mount the drive and recover the password using the usual methods. After password is recovered, dismount the drive, start your instance up again, and login.

I don't believe you can mount a drive of another instance unless the other instance is off. So, whatever you do, it sounds like it requires up to an hour of downtime.

share|improve this answer
  1. Take a Snapshot of the instance.
  2. Create a new Keypair.
  3. Start a new instance.
  4. SSH to it.
  5. Attach the snapshot to the new instance as a simple volume at /mnt, via the AWS console.
  6. Copy the necessary data/configs from /mnt to their correct locations on the new instance.
  7. Test.
  8. Make the new instance the 'live' instance (assign a static IP and point your other systems to that IP)
  9. Shut down the old instance.
  10. Delete the old keypair.

I believe that should cover it.

share|improve this answer
My answer was going great up until it got to...Step 1. You can't make snapshots of instances. You can create a new AMI from an EBS instance however, as arheops mentioned in his answer, which - if you've created a new keypair - would accomplish about the same thing. If the instance is not EBS, you are out of luck. – anastrophe Jul 26 '11 at 5:09

The only way to gain root access to a running instance is with the key that the developer probably has.

From what I know amazon doesn't store the key file anywhere once it's been generated.

share|improve this answer

There is another solution in current ec2 console (in Amazon account). You can select a running instance and "create AMI". After that you can run that AMI with a different ssh-key for login. Unfortunately the current EC2 tool to create an AMI will REBOOT your box to take the snapshot.

share|improve this answer
This only works for EBS AMI's, which may not be the case for this person. – anastrophe Jul 26 '11 at 0:52
for non-ebs AMI there are no other ways except hack. for example snapshot of non-EBS is not posible too. – arheops Jul 26 '11 at 0:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.