简体   繁体   English

AWS Opsworks 添加 EC2 实例失败

[英]AWS Opsworks failed to add EC2 instance

I made new EC2 instance, and created new layer on Opsworks.我创建了新的 EC2 实例,并在 Opsworks 上创建了新层。 I ran a command that displayed on Opsworks panel, but it kept failing to register on Opsworks.我运行了一个显示在 Opsworks 面板上的命令,但它一直无法在 Opsworks 上注册。

Command命令

aws opsworks register --use-instance-profile --infrastructure-class ec2 --region us-east-1 --stack-id [stack id] --local

Error log when I ran the command in the instance我在实例中运行命令时的错误日志

aws opsworks register --use-instance-profile --infrastructure-class ec2 --region us-east-1 --stack-id 50aebe6e-5aa1-4d2e-801c-b50ff1f22884 --local
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:380: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning,
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100 6468k  100 6468k    0     0  28.5M      0 --:--:-- --:--:-- --:--:-- 28.5M
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Initializing AWS OpsWorks environment
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Checking if OS is supported
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Running on supported OS
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Setup motd
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Executing: ln -sf --backup /etc/motd.opsworks-static /etc/motd
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Using assets bucket from environment: 'opsworks-instance-assets-us-east-1.s3.amazonaws.com'.
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Installing Ruby for the agent
[Thu, 19 Dec 2019 08:32:54 +0000] opsworks-init: Executing: /tmp/opsworks-agent-installer.Xl3O6gYd9TptvPYs/opsworks-agent-installer/opsworks-agent/bin/installer_wrapper.sh -r -R opsworks-instance-assets-us-east-1.s3.amazonaws.com
[Thu, 19 Dec 2019 08:32:56 +0000] opsworks-init: Starting the installer
[Thu, 14 Dec 2017 09:08:30 +0000] opsworks-init: Initializing AWS OpsWorks environment
[Thu, 14 Dec 2017 09:08:30 +0000] opsworks-init: Setup motd
[Thu, 14 Dec 2017 09:08:30 +0000] opsworks-init: Executing: ln -sf /etc/motd.opsworks-static /etc/motd
[Thu, 14 Dec 2017 09:08:30 +0000] opsworks-init: Checking network connectivity
healthy[Thu, 14 Dec 2017 09:08:30 +0000] opsworks-init: Recent OpsWorks agent version not yet installed, continuing.
[Thu, 14 Dec 2017 09:08:31 +0000] opsworks-init: Executing: mkdir -m 0755 -p /etc/chef/ohai/hints
[Thu, 14 Dec 2017 09:08:31 +0000] opsworks-init: Executing: touch /etc/chef/ohai/hints/ec2.json
[Thu, 14 Dec 2017 09:08:31 +0000] opsworks-init: Executing: chmod 0444 /etc/chef/ohai/hints/ec2.json
[Thu, 14 Dec 2017 09:08:31 +0000] opsworks-init: Executing: mkdir -m 0750 -p /var/lib/aws/opsworks

[Thu, 19 Dec 2019 05:52:09 +0000] installer-wrapper: Skipping installation of opsworks-agent-ruby because it's already installed
[Thu, 19 Dec 2019 05:52:09 +0000] installer-wrapper: Cleaning up
[Thu, 19 Dec 2019 05:52:09 +0000] opsworks-init: Starting the installer
/opt/aws/opsworks/releases/20160913111958_3440-20160913111958/vendor/bundle/ruby/2.0.0/gems/aws-sdk-v1-1.65.0/lib/aws/core/credential_providers.rb:41:in `credentials':      (AWS::Errors::MissingCredentialsError)
Missing Credentials.

it said missing credentials , but I already configured credential.它说missing credentials ,但我已经配置了凭据。 aws-cli version is aws-cli版本是

aws-cli/1.16.306 Python/2.7.6 Linux/3.13.0-137-generic botocore/1.13.42

Also, this instance is in different VPC unlike others, so I wonder if only instances in the same VPC can be registered.另外,这个实例和其他实例不同,在不同的VPC中,所以我想知道是否只能注册同一个VPC中的实例。

I had the very same issue and could not really figure out the reason.我有同样的问题,无法真正找出原因。

There is another way to install OpsWorks though, namely to attach a role to the EC2 instance in the management console and then run the installer on the instance.不过,还有另一种安装 OpsWorks 的方法,即将角色附加到管理控制台中的 EC2 实例,然后在实例上运行安装程序。 This way there is no need to run aws configure这样就不需要运行aws configure

Check out the details here: https://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register-registering-cli.html#registered-instances-register-registering-cli-role在此处查看详细信息: https : //docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register-registering-cli.html#registered-instances-register-registering-cli-role

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM