我刚刚注册了亚马逊的Elastic Beanstalk新产品。我不明白的是如何SSH到Beanstalk实例。我没有私钥,因为Beanstalk代表我生成了实例。


当前回答

如果您正在使用elastic bean和EB CLI,只需使用EB ssh登录到实例。您可以使用下列链接中指定的选项 http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-ssh.html

其他回答

在EC2实例的“实例操作”菜单中有一个方便的“连接”选项。它将为您提供使用实例的正确url执行的确切SSH命令。杰布利的全部指示都是正确的。

不久前我也遇到了同样的问题。我想使用密钥文件,但是Amazon在某个地方说不能向现有的EC2服务器添加密钥文件。对于第一个Beanstalk应用程序,Amazon为您预配置了应用程序。您需要创建一个新的应用程序,您可以配置运行Beanstalk应用程序的EC2服务器使用旧的pem文件(如果使用Putty则为ppk),或者您也可以创建一个新的pem文件。现在您应该能够SSH了。

然后配置,然后删除你的旧应用。

Elastic Beanstalk可以将单个EC2对绑定到实例概要文件。让多个用户ssh进入EBS的手动解决方案是在authorized_keys文件中添加他们的公钥。

根据您的环境配置,在为您的环境创建的EC2实例上可能没有公共IP地址。你可以通过以下方法查看:

转到EC2控制台 找到实例并检查Description选项卡 如果没有公共IP…… 在导航中单击“弹性IPs” 单击“分配新地址” 选择亚马逊的泳池 点击分配

最后,选择您的新EIP并从操作菜单中选择关联地址。将该IP与EC2实例关联。您现在应该能够使用eb ssh连接。

可以通过执行eb ssh——setup命令重置连接详细信息。

我在2013年8月使用linux客户端和简单的AWS Beanstalk安装(单个EC2实例)的经验如下(基于上面的Community Wiki)

配置安全组

In the AWS console, select EC2 to go to the EC2 Dashboard Discover the security group to which your EC2 instance belongs by clicking Instances in the left hand panel and then selecting the instance you want to connect to (in my case there is only one - called Default Environment). The details are shown at the base of the page - You should see a field for Security Groups - make a note of the name - in my case "awsweb...". From the left hand panel select Security Groups. Select the awsweb... security group and the details should show at the base of the page Select the Inbound tab and choose SSH from the "Create a New Rule" drop down. Insert the ip address/CIDR of your local machine (from which you intend to connect), e.g. 192.168.0.12/32 and click Add Rule and Apply Rule Changes.

创建公私钥对

在EC2仪表板中,从左手面板中选择Key Pairs 单击密钥对(在顶部)并输入一个名称,如myname-key-pair-myregion或任何您喜欢的有效密钥名称。 确认并接受从浏览器下载私钥,例如将其保存到您的主目录或任何您喜欢的地方。确保该目录只有您的写权限。

将公私钥对关联到Elastic Beanstalk EC2服务器

向Elastic Beanstalk EC2添加公共-私有密钥对 instance do: Services -> Elastic Beanstalk -> My App -> Default Environment将带您到默认环境(您将在其中 上传你的应用) 点击配置(在左手面板),然后在齿轮/齿轮 与“实例”相关的 显示“服务器”页面 从EC2密钥对中选择预构建的密钥参数并保存 将显示一些警告消息,因此请再次保存。

使用SSH连接到AWS EC2实例

在终端会话中,更改到包含您的私钥(。pem文件)。 如果你已经尝试过几次,你可能应该做一些关于.ssh/known_hosts(如果你有一个)的事情,比如重命名它。否则,您可能会得到一个关于主机标识已更改的错误。 执行:ssh -i ./myname-key-pair-my-region。pem ec2 - user@ec2一些address.us -西方- 2. compute.amazonaws.com

祝你好运