Enhanced ssh command line for EC2 that can find an instance by the instance id, instance name tag, or private IP address. It even supports indexing when multiple instances share the same name (i.e. auto-scaling groups).
pip install essh
# To ssh by instance id
essh <instance id>
# To run a command over ssh on instance id
essh <instance id> ls /tmp
# To ssh by private ip
essh <private ip>
# To ssh to the first instance with this name tag
essh <tag name>
# To ssh to the second instance with this name tag
essh <tag name>[1]
Add the following to your ~/.ssh/config file:
Host *
User centos
If you don't want to do this, essh will try different usernames in the following order: centos, ec2-user, ubuntu, admin, bitnami, and root.
Add the following to your ~/.ssh/config file:
CheckHostIP no
StrictHostKeyChecking no
The default keypair directory is ~/.ssh
and default keypair extension is .pem
. To change either of these set the --keypair-dir
and/or --keypair-extension
options on the command line.