How to find your EC2 username and password

amazon ec2capistranoruby-on-rails

I recently took over a rails project from another developer that uses capistrano to deploy to EC2. When I try to deploy it is asking for a password.

I can't figure out where to change the user and password in my EC2 account. I can login, but it seems that the deploy process is using a different user. The error looks like this:

connection failed for: ec2-XXX-XX-XX-XX.compute-1.amazonaws.com (Net::SSH::AuthenticationFailed: stackbuilders)

"stackbuilders" is the old username. Where would I change this to my EC2 username and set up a new password?

Best Answer

This isn't an EC2 account username, it's the SSH credentials on the instance(s) in question. You should get this information from the previous developer, or your client.

If that isn't possible, there's a couple of options:

  • Rebuild the environment from scratch. If the instances are ephemeral, this is the only possibility.
  • If the instances are EBS-backed, you can stop them (do NOT terminate them), attach and mount the EBS root volumes on a scratch EC2 instance you've built and know the password to, and then modify the disk image to have credentials you control (edit /etc/shadow, or chuck an SSH key into the right place).

If this sounds like effort, well, welcome to being a sysadmin. And next time, get the password off the previous dev before you take the job on, or at least tack an extra few hundred clams onto the estimate for your hassle.