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

i have lost the keypair of my ec2 instance. I created an image from the previous instance and launched a new instance. But now I wish to block access to the previous instance without stopping it. I tried deleting the keypair from the list of keypairs in aws management console on a different instance, but this does not stop a user who has the key file from accessing it.

Is there some way to block access to the instance... prefereably from the management console ?

share|improve this question

migrated from Nov 11 '11 at 13:38

This question came from our site for professional and enthusiast programmers.

You can block access to it using EC2 Security Groups.

You'll probably want to make sure that no other servers are in the same group.

share|improve this answer

If you are running an EBS boot instance, then you can gain access to the root disk and modify it to prevent login through the old key and allow login through a new ssh key using the approach I describe in this article:

Fixing Files on the Root EBS Volume of an EC2 Instance

That approach does require stopping the instance temporarily.

If you really can't stop the instance even temporarily, then you might consider changing the port permissions allowed by the security groups that are associated with that instance. You could remove the permission to connect to the ssh port (22 by default).

Note, however, that this would also affect any other instances running with that security group, so you'd need to make sure you run other instances with a different security group that allows connecting to the ssh port.

share|improve this answer

Your Answer


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