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


当前回答

我也一直在玩这个。

去你的弹性豆茎服务标签 在你的应用程序概览开始行动——>编辑配置 将出现在EC2选项卡中的密钥名称(对于同一区域)添加到现有的密钥输入框中,然后点击apply changes

该服务将重新启动,所以煮5分钟咖啡

在相同区域的ec2选项卡上,您将看到新的运行实例。 使用3中添加的密钥,SSH到公共DNS名称为ec2-user 如。 ssh ec2 - user@ec2 - xx - xxx - xx xxx.compute - 1. amazonaws.com

其他回答

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

使用当前UI为ElasticBeanstalk ec2实例设置键对的方向是: 警告:这将需要更新ElasticBeanstalk App中的EC2实例。 注意:在此之前,您需要在EC2仪表板中创建一个密钥对。

1)在AWS仪表板中,选择ElasticBeanstalk服务 2)选择要使用的应用程序。 3)选择“配置” 4)在“实例”配置框中选择齿轮(设置)图标。 5)这将带你到一个名为“服务器”的页面,在那里你可以更新“EC2密钥对”下拉字段与你想要的密钥对,并选择“保存”。

需要注意的一点是,这可能不适用于具有多个实例的应用程序(但我认为,如果它们都与密钥对位于同一区域,则可能如此)。

我也一直在玩这个。

去你的弹性豆茎服务标签 在你的应用程序概览开始行动——>编辑配置 将出现在EC2选项卡中的密钥名称(对于同一区域)添加到现有的密钥输入框中,然后点击apply changes

该服务将重新启动,所以煮5分钟咖啡

在相同区域的ec2选项卡上,您将看到新的运行实例。 使用3中添加的密钥,SSH到公共DNS名称为ec2-user 如。 ssh ec2 - user@ec2 - xx - xxx - xx xxx.compute - 1. amazonaws.com

在mac上,你可以使用brew安装命令行:

brew install awsebcli

使用命令行工具,您可以ssh:

eb ssh environment-name

也可以做其他的运算。这假设您已经添加了一个允许从您的ip进行ssh的安全组。

我在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

祝你好运