TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

SSH into your EC2 instances with ease

65 pointsby ozkatzalmost 12 years ago

10 comments

jwilliamsalmost 12 years ago
Perhaps different use case - but I prefer to use a VPC with internal addressing and DNS. Particularly if you&#x27;re using more than just a few instances.<p>Then have a bastion host in a DMZ that forward to the actual instances (I prefer 172 as it tends to avoid clashing with wifi networks). This does cost you a m1.small Amazon instance, but if you reserve it the cost is negligible.<p>Even better. You can do this automagically with ssh by putting a suitable `ProxyCommand ssh &lt;bastion&gt; &quot;nc %h %p&quot;` in your ssh config. So you just `ssh 172.0.0.10` or ssh `my-internal-name.blah` and it tunnels straight in for you.<p>You can pair this with internal DNS if you want to get really fancy - although it&#x27;s a bit fiddly. From what I read internal DNS is pretty high up on the Route 53 feature request list.
评论 #5916742 未加载
评论 #5916472 未加载
评论 #5917245 未加载
jperrasalmost 12 years ago
Hi! I&#x27;m the author of the blog post that you listed in your article. Glad you found it useful; it surprises me to this day, almost 2 years later, at just how many pageviews it continues to generate.<p>However, I would like to point out that the correct solution to this problem is DNS, as others here have indicated. Couple Route53 with something like Zonify (<a href="http:&#x2F;&#x2F;nerds.airbnb.com&#x2F;easy-aws-inventorying-with-dns&#x2F;" rel="nofollow">http:&#x2F;&#x2F;nerds.airbnb.com&#x2F;easy-aws-inventorying-with-dns&#x2F;</a>) by the fine folks at AirBnB, and you&#x27;ve got something quite powerful that is diff&#x27;able via your normal tools, and can be easily versioned for sanity and safety.<p>Don&#x27;t let my comments (or the comments of others here) detract from the pretty clever approach that you took. I think it&#x27;s the fate of every ops&#x2F;devops to, at some point in their careers, create a host address storage&#x2F;querying system that contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of DNS without realizing it the first time around.
评论 #5916612 未加载
dueyalmost 12 years ago
Could also just name your hosts appropriately and use something like puppet to create and update DNS records for your hosts automatically.
评论 #5916174 未加载
cturalmost 12 years ago
This is a pretty complicated solution. There are a ton of easier ones, but probably the easiest is to just use ec2-ssh. It lets you apply tags to your ec2 instances and ssh to them by very simple names.<p><a href="https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;ec2-ssh" rel="nofollow">https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;ec2-ssh</a>
评论 #5917488 未加载
josephruscioalmost 12 years ago
If you&#x27;re looking for something a little more packaged and not averse to installing a Ruby gem, this will manage multiple AWS accounts and allow you to ssh&#x2F;scp using AWS instance IDs as the target: <a href="https:&#x2F;&#x2F;github.com&#x2F;mheffner&#x2F;awsam" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mheffner&#x2F;awsam</a>
imperialWicketalmost 12 years ago
DNS is a good solution here, but it also seems appropriate to highlight that you shouldn&#x27;t need to be connecting to these instances directly. As others said, some type of configuration tool should be in place, logs should be centralized, storage should be centralized, queues should be elsewhere. Painful ssh config is a symptom of a different issue.
anurajalmost 12 years ago
what is the problem with<p>&gt;&gt;ssh -i &lt;yourkey&gt; ec2-user@&lt;yourinstance&gt;.amazonaws.com<p>isn&#x27;t it the easiest it can get to?
评论 #5916861 未加载
bitskitsalmost 12 years ago
This is a complicated solution to a simple problem. How about just editing &#x2F;etc&#x2F;hosts or adding it to your DNS?
TallboyOnealmost 12 years ago
Just use the elastic IP? I have all of my instances in a subnet, and just connect to each&#x27;s elastic IP. easy.
dmouratialmost 12 years ago
No, just no. Please make it stop.