SSH 到 Elastic Beanstalk 实例 [英] SSH to Elastic Beanstalk instance

查看:27
本文介绍了SSH 到 Elastic Beanstalk 实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注册了亚马逊的新 Elastic Beanstalk 产品.我不知道如何通过 SSH 连接到 Beanstalk 实例.我没有私钥,因为 Beanstalk 代表我生成了实例.

I just signed up for Amazon's new Elastic Beanstalk offering. What I can't figure out is how to SSH to a Beanstalk instance. I don't have a private key because Beanstalk generated the instance on my behalf.

推荐答案

我发现这是一个 2 步过程.这假设您已经设置了一个密钥对来访问相关区域中的 EC2 实例.

I found it to be a 2-step process. This assumes that you've already set up a keypair to access EC2 instances in the relevant region.

  1. 在 AWS 控制台中,打开 EC2 选项卡.

  1. In the AWS console, open the EC2 tab.

选择相关区域并点击安全组.

Select the relevant region and click on Security Group.

如果您在该区域启动了 Elastic Beanstalk 实例,您应该有一个 elasticbeanstalk-default 安全组.

You should have an elasticbeanstalk-default security group if you have launched an Elastic Beanstalk instance in that region.

编辑安全组以添加 SSH 访问规则.下面将锁定它以只允许来自特定 IP 地址的入口.

Edit the security group to add a rule for SSH access. The below will lock it down to only allow ingress from a specific IP address.

SSH | tcp | 22 | 22 | 192.168.1.1/32

配置 Elastic Beanstalk 应用程序的环境

  1. 如果您尚未制作密钥对,请点击 ec2 选项卡中安全组下方的密钥对进行制作.
  2. 在 AWS 控制台中,打开 Elastic Beanstalk 选项卡.
  3. 选择相关区域.
  4. 选择相关环境
  5. 在左侧窗格中选择配置.
  6. 选择安全.
  7. 在EC2 密钥对:"下,在 Existing Key Pair 字段中选择您的密钥对的名称.
  1. If you haven't made a key pair yet, make one by clicking Key Pairs below Security Group in the ec2 tab.
  2. In the AWS console, open the Elastic Beanstalk tab.
  3. Select the relevant region.
  4. Select relevant Environment
  5. Select Configurations in left pane.
  6. Select Security.
  7. Under "EC2 key pair:", select the name of your keypair in the Existing Key Pair field.

如果在这些步骤之后您看到 Health 设置为 Degraded

If after these steps you see that the Health is set Degraded

这是正常的,它只是意味着 EC2 实例正在更新.再等几秒就好了

that's normal and it just means that the EC2 instance is being updated. Just wait on a few seconds it'll be Ok again

实例重新启动后,您需要从 AWS 控制台 EC2 实例选项卡或通过 API 获取主机名.然后您应该可以通过 ssh 连接到服务器.

Once the instance has relaunched, you need to get the host name from the AWS Console EC2 instances tab, or via the API. You should then be able to ssh onto the server.

$ ssh -i path/to/keypair.pub ec2-user@ec2-an-ip-address.compute-1.amazonaws.com

注意:要向环境配置添加密钥对,必须关闭实例的终止保护,因为 Beanstalk 会尝试终止当前实例并使用密钥对启动新实例.

Note: For adding a keypair to the environment configuration, the instances' termination protection must be off as Beanstalk would try to terminate the current instances and start new instances with the KeyPair.

注意:如果出现问题,请检查事件"Beanstalk 应用程序/环境中的选项卡,找出问题所在.

Note: If something is not working, check the "Events" tab in the Beanstalk application / environments and find out what went wrong.

这篇关于SSH 到 Elastic Beanstalk 实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆