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

I've been asked to edit the html of a splash screen on a static temporary site for a client (its super simple). I have full access to the AWS portal where the instance is hosted but appear to be unable to access the instance as I do not have the .pem.

It is presently not possible to contact the former dev of the site.

Is there anything I can do to gain access to the VM so that I might inspect the contents and work out what I need to change?

I did try to create an AMI from that instance but when I request the password its now telling me:

Instances launched from a custom AMI will inherit the User and Password of the AMI's parent instance

Is there anything I can do outside of completely recreating the site????

share|improve this question
You can mount the EBS to a new instance with a new .pem and change the authorized keys, then re-mount it to the old instance. – ceejayoz Oct 24 '12 at 14:14
Create a snapshot of the EBS volume attached to the instance, and create a new EBS volume from that. Launch a new instance, and attach the newly created EBS volume to the new instance. 1) If you just want a copy of the files, then simply copy them from the newly attached EBS volume. 2) If you want to keep the existing server configuration: Find the username (e.g. from etc/passwd and etc/sudoers); Generate a new SSH and set it up. Detach your EBS volume, and attach it as the root volume to another instance - login with the SSH key you generated. – cyberx86 Oct 24 '12 at 14:15

1 Answer 1

Yes, it is possible to recover the access to your files, but only for EBS disks. The following method doesn't work if you want to recover files in a root device that is of type Instance Store. You can find your storage type in EC2 console, clicking at the Instance and looking in the info for "Root device type".

Note: You can get a more detailed guide here or here.

Steps using AWS EC2 Console:

  1. Stop the instance that you've lost access.
  2. Create an AMI from it.
  3. Create a new instance using this AMI and safely store your new .pem file.
  4. Go to Volumes and detach the volume used in the original instance.
  5. Attach this volume to the new instance.
  6. Mount the new attached volume.

If you want just to copy the files, you can stop from here. But if you want to use the old machine, continue:

  1. Copy the authorized_keys from the new instance root device and replace the old EBS authorized_keys that you have just attached.
    • [ec2-user ~]$ cp .ssh/authorized_keys /mnt/tempvol/home/ec2-user/.ssh/authorized_keys
  2. Unmount the volume.
  3. Terminate the machine that was created just to recover the EBS.
  4. Attach the volume to the old machine and start it.
  5. Connect to the old machine using the credentials that you've created for the temporary instance.
share|improve this answer

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.