I've gotten a lot of mileage out of Sigil (https://github.com/danmx/sigil#readme ) which supports starting sessions via Name tag, instance-id, or private-dns-name in order to save one the need to use awscli in a lot of cases; it also supports the handy `sigil ls` to show the connected instances, since trying to start an SSM connection with an instance whose agent is offline produces a dumb error message with start-session
---
as an aside: `function name()` is redundant; the `function name {` syntax is a bashism, `name() {` is the posix syntax
Oh, that's interesting! Didn't know AWS had that ability. Maybe then there are also some SDK functions I don't know about? I wonder why Packer doesn't go this route.
Super tiny downside to your approach: you'll be paying for storage of that instance while shut down, I guess. But that's probably peanuts.
I was about to comment that I looked into this a while back and they thought it would be too complicated to implement... but it seems that it was actually implemented [0] earlier this year. I haven't tried it out but that seems quite promising to me.
- Create an EC2 instance in a private subnet, and assign the AmazonSSMManagedInstanceCore IAM role to it
- Install the AWS CLI tools on your desktop
- Add a function to your .bash_profile like this:
Then just run "jumphost" from your terminal and boom, SSH'ed in via the magic of SSM.Bonus points: add a cronjob to your jumphost to shutdown every X hours in case you forget ;-)