Ec2 instance is unable to connect after restart

amazon ec2public-key

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??

Best Answer

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.

Related Topic