0

I created an micro ec2 instance with free tier option. After using it a week, i realized that i need more memory. So, i thought of changing the instance type from micro to small(for which i have to pay per use).

I stopped the instance, changed its type from micro to small and restarted it.

After changing the instance type(to small), i got a new public DNS using which i can access my applications. But im not able to connect to the instance using WinSCP/Putty/Linux shell now. It says "Server refused our key" in windows, "Permission denied (publickey)" in linux.

Can any one help me out of this??

Karthik Jayapal
  • 163
  • 2
  • 6
  • I tried the same (stop, change type & restart) with an another instance. But with just the public DNS change i could access the instance from both SSH & browser. Its **TOTALLY STRANGE**. I ended up creating an another instance from scratch :( – Karthik Jayapal Mar 29 '11 at 13:39
  • Check that the permissions on the contents of .ssh directory are correct. – egorgry Mar 29 '11 at 16:40

4 Answers4

1

When you create an instance there is an option to select one of your existing key pairs or create a new one. You, simply, have not selected the same key-pair for the small instance as applied to the micro.

Look at the two instances in the AWS dashboard, under the description tab you'll find the "Key Pair Name" field.

Unfortunately, you cannot change the the key pair of a running instance. You need to recreate the small instance and double check the key pair you use.

Otherwise, check what the new key pair and to obtain the public key, log into your account, go to Security Credentials and click on the Key Pairs tab.

If you don't have a copy of the private key, that cannot be recovered.

0

Don't change the rights and ownership of ec2-user directory under path /home/ec2-user.

if you do then you won't be able to re-login again and get the server refused key error.

0

It sounds as if the instance has reset to the Amazon-issued key when you created the instance.

You could try that to login.

jscott
  • 24,484
  • 8
  • 79
  • 100
Jonathan Ross
  • 2,183
  • 11
  • 14
  • That is what im trying with. I mean the instance still uses the same key when it was created. There can be only one key for an instance right? Can we change the key? – Karthik Jayapal Mar 28 '11 at 09:18
-1

My problem resolved.. I was changing the permission of the ec2-user home directory so that it can be acccessed by other users..And it was causing the SSH to not to connect ! Once restoring the original permissions to ec2-user home directory , issue was resolved !