Edit 1: Created an issue [0] already.
Edit 2: Added a request [1] to integrate fwknop [2] for full automation and better security.
[0]: https://github.com/mikery/ssh2ec2/issues/1
Edit 1: Created an issue [0] already.
Edit 2: Added a request [1] to integrate fwknop [2] for full automation and better security.
[0]: https://github.com/mikery/ssh2ec2/issues/1
I sometimes find myself needing to connect to any instance in a particular ASG, and I don't really care which one. This tool is built to solve that particular problem. If I want to access a specific instance I will address it by its instance ID (ssh2ec2 --instance-id i-123456).
What would the index refer to? The list of instances in an ASG would need to be sorted (perhaps by instance ID) in order for an index to be useful. The behaviour would still be undefined to a certain extent, as the logic would be "return the instance at position n in the list", when the number of instances in the ASG might have changed due to a scaling event.
Edit: Thanks for the pull requests - we can discuss further there.
Having said that, you can do something on all matching instances with:
ssh2ec2 --tag foo=bar --all-matching-instances /some/commandAs previously covered multiple times, some innovative startups don't even enable SSH for their servers as SSH doesn't fit nicely in the immutable infrastructure paradigm.
But then there's the real world.
If you want to address a unique instance, do it by instance ID. If you want to address all of them, use the command example Mike put forth. To add an index is redundant. Use fabric if you're interested in that level of control.
Not SSHing to your instances works just fine, until you need to tweak a knob without launching a new instance, or get logs that you didn't know you needed to get. If you feel the need to get on the immutable infrastructure hype train though, go for it.