gianlucaborello / aws-ssh-config

Generate SSH config files from AWS EC2 inventory
GNU General Public License v2.0
242 stars 84 forks source link

cloudformation & region #1

Open lavie opened 9 years ago

lavie commented 9 years ago

Very cool script. Thank you.

Would be great if it had a --cfn option to generate host names based on logical-resource-id. And also the ability to concat the region name (which is seldom a tag) to the host name. So host name in this mode would be, e.g. [CFN stack name]-[CFN logical name]-[region]. Just a thought.

gianlucaborello commented 9 years ago

Thanks a lot for your feedback.

I added a --region option that adds the region (and AZ) at the end of the host name. About cloudformation, if I correctly understand, your request that can already be achieved with tags:

python aws-ssh-config.py --tags aws:cloudformation:stack-name,aws:cloudformation:logical-id --region

Let me know if it doesn't work the way you wanted it to!

lavie commented 9 years ago

Oh, of course! You're right. Tags do work for CFN resources. I guess what I really meant is to ignore click-resources, or anything not generated by CFN. See, what I got when I used the script was all my stack resources properly named (except for the region thing - and thanks for adding that, btw), but I also got a pile of various click-resources that weren't properly named. I guess lots of accounts have those lying around. That's what made me think that --cfn mode, where e.g. you could just filter out all the stuff that's not created by CFN, would be a good idea. But now that I think of it, all I really need is a filter option. If there were a white-list filter (tag based) I could filter out non-CFN resources, and I could even generate host configs just for specific stacks, if I wanted to.

In any case, I really appreciate your quick response and help.

gianlucaborello commented 9 years ago

Sounds like a great idea, give me a bit and I'll implement a --filter switch