We run a bunch of hosts on EC2 and while most just have the default DNS name, they all have a Name tag to identify their purpose. While there’s lots of automation setup via ansible, it is often still necessary to SSH directly into a particular box, especially while debugging issues.
I find it annoying to have to go log into the AWS console just to find the DNS name of the particular box I want so I’ve written a little script that searches for hosts based on the name tag and can then SSH into them.
It requires having the
aws utility setup and able to login, plus having
awssh <name> where
<name> is a regex that matches any Name tag. Typically a substring match is simplest. So to SSH to the Medalla testnet bootnode we run I’d just use
If more than one node matches it provides a list of the matching nodes, so to select one of the Medalla nodes I’d run
awssh medalla then select from the resulting list.