Reputation: 2508
I work on a project under an AWS IAM role (the default Admin-level permissions). I recently started an EC2 instance of a custom AMI and ensured everything was running correctly. I was able to SSH to the instance without any trouble, and then stopped the instance and sent an email to the root account owner about how to start the instance when he needed it.
He started the instance, and when we met to discuss something, I tried to SSH in but my connection was rejected. I checked all security group settings and updated my SSH login to the new public DNS name, neither was the issue.
Then when I stopped the instance, and started it again, I was able to SSH to it again.
What explains my inability to SSH in when someone else starts an instance that I originally created?
I apologize if this is a rookie question, but I couldn't find a clear answer to it, and I'd really like to understand the issue.
Upvotes: 0
Views: 151
Reputation: 61551
This question is pretty broad but in essence there's no ghostly intervention that made not access your instance.
It's possible that your instance is running scripts to harden authentication and change some of the configuration in the ssh daemon (sshd). Possibly /etc/ssh/sshd_config . When you restart the instance the are a serious of scripts run on your instances primarily run by cloud-init
which you find the configuration under /etc/cloud
. You can read more about cloud-init
here: http://cloudinit.readthedocs.org/en/latest/
Another possibility is that your sshd died and you couldn't connect to the instance. For example this is what happens when you try connect to your instance and your sshd is not running.
$ ssh -p 8022 localhost
ssh: connect to host localhost port 8022: Connection refused
$
Obviously when you restart your instance the sshd is started which would explain that you can login after.
Hope it helps.
Upvotes: 1