1

I followed the procedures for Creating an Amazon EBS-Backed Linux AMI with the exception that I did not shut down the original instance, just let AWS reboot it.

When I launch & start a new instance, I consistently cannot connect via SSH (or any method for that matter). I can connect to the original instance with no problems, even after reboots.

The new instances are in the same availability zone, in the same security group, and have the same key-pair as the original instance.

I don't think it matters, but the original instance was a m1.medium, and I'm trying to launch a m1.small.

1

I was able to fix this, and it was two things:

  1. I had removed the ec2-user key from /root/.ssh/authorized_keys which I think was preventing the AWS process from completing the initialization process.
  2. The NFS service seemed to be hanging on boot.

When I put the ec2-user info back in, and then set NFS to not start on boot, I was able to successfully launch and log in to a new instance.

1

Double check in Amazon Web Services the followings settings for your instance:

  • Security Group for your instance is allowing Inbound SSH access (check: view rules).
  • For VPC instance, check its attached Route table which should have 0.0.0.0/0 as Destination and your Internet Gateway as Target.
  • Double check your route info in System Log in Networking of the instance.

For more details, check: Troubleshooting Connecting to Your Instance

0

My issue was I was using user ubuntu instead of ec2-user on the Amazon Linux AMIs. May help future googlers.

0

I've solved this by making a different user account, putting the public key in ~/.ssh/authorized-keys in that user's HOME directory, and giving that user sudo access.

Once you do that, make the AMI. Then you can always log in to that AMI as that user with the given public key, whether or not you provide EC2 a key pair.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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