AWS CLI:无法在 Opsworks 上注册 EC2 EBS 支持的实例

AWS CLI : Cannot register a EC2 EBS-Backed Instance on Opsworks

通过使用 AWS CLI,我尝试在指定的日期时间创建我的 OpsWorks 堆栈的克隆。

为了做到这一点,我确保我有以下内容:

与 RDS 相关的一切工作正常,但我似乎无法在 OpsWorks 中正确附加 EC2 实例。

起初,我尝试从我的快照创建一个 AMI,运行 它作为一个 EC2 实例,然后将它注册到我的堆栈中,这产生了以下错误:

[Thu, 12 Mar 2015 11:48:14 +0000] opsworks-init: Starting the installer Building native extensions. This could take a while... /tmp/opsworks-agent-installer.APUKk5gzWGKpIB4l/opsworks-agent-installer/opsworks-agent/lib/bootstrap/installer.rb:74:in install_instance_agent': /opt/aws/opsworks/releases/20150210181912_33600020150210181912 already exists and is current - aborting. (RuntimeError) from /tmp/opsworks-agent-installer.APUKk5gzWGKpIB4l/opsworks-agent-installer/opsworks-agent/lib/bootstrap/instance_agent_registration_installer.rb:30:inblock in run' from /tmp/opsworks-agent-installer.APUKk5gzWGKpIB4l/opsworks-agent-installer/opsworks-agent/lib/bootstrap/log.rb:96:in measure' from /tmp/opsworks-agent-installer.APUKk5gzWGKpIB4l/opsworks-agent-installer/opsworks-agent/lib/bootstrap/instance_agent_registration_installer.rb:30:inrun' from /tmp/opsworks-agent-installer.APUKk5gzWGKpIB4l/opsworks-agent-installer/opsworks-agent/lib/bootstrap/instance_agent_registration_installer.rb:13:in run' from /tmp/opsworks-agent-installer.APUKk5gzWGKpIB4l/opsworks-agent-installer/opsworks-agent/bin/opsworks-agent-registration-installer.rb:18:in' [Thu, 12 Mar 2015 11:50:08 +0000] opsworks-init: Agent installation failed. [Thu, 12 Mar 2015 11:50:08 +0000] opsworks-init: Please verify the log files found under /var/log/aws/opsworks and submit findings to AWS Support.

我的第二次尝试是用我的快照创建一个卷,然后用它替换我的 EC2 实例的根设备。结果是:

A client error (IncorrectState) occurred when calling the DetachVolume operation: Unable to detach root volume [...]

然后,我想我会使用 Amazon 的 Ubuntu LTS 14.04 AMI 测试附加一个新创建的 EC2 实例,但也没有成功:

Command '['ssh', '-tt', '', u'/bin/sh -c \'set -e\numask 007\nAGENT_TMP_DIR=$(mktemp -d /tmp/opsworks-agent-installer.XXXXXXXXXXXXXXXX)\ncurl --retry 5 -L https://opsworks-instance-agent.s3.amazonaws.com/33600020150210181912/opsworks-agent-installer.tgz | tar xz -C $AGENT_TMP_DIR\ncat >$AGENT_TMP_DIR/opsworks-agent-installer/preconfig <https://opsworks-instance-agent.s3.amazonaws.com"\n:agent_installer_tgz: "opsworks-agent-installer.tgz"\n:assets_download_bucket: "opsworks-instance-assets-us-east-1.s3.amazonaws.com"\n:charlie_public_key: "-----BEGIN PUBLIC KEY----------END PUBLIC KEY-----"\n:import: true\n:instance_service_endpoint: "opsworks-instance-service.us-east-1.amazonaws.com"\n:instance_service_port: "443"\n:instance_service_region: "us-east-1"\n:instance_service_ssl_verify_peer: "true"\n:instance_service_use_ssl: "true"\n:ops_works_endpoint: "opsworks.us-east-1.amazonaws.com"\n:ops_works_port: "443"\n:ops_works_region: "us-east-1"\n:ops_works_ssl_verify_peer: "true"\n:ops_works_use_ssl: "true"\n:secret_access_key: "YCsdiyHlR9zwUO7WvQrr3xNPIQqL89XcgmgIUC7h"\n:stack_id: "54bc78bc-d9bd-469a-ae31-2fae7e43762e"\n:verbose: "false"\n:wait_between_runs: "60"\nEOF\nexec sudo /bin/sh -c "OPSWORKS_ASSETS_DOWNLOAD_BUCKET=opsworks-instance-assets-us-east-1.s3.amazonaws.com $AGENT_TMP_DIR/opsworks-agent-installer/boot-registration; rm -rf $AGENT_TMP_DIR"\n\'']' returned non-zero exit status 255

似乎我 运行 在尝试在计算机上安装 OpsWorks 代理时遇到了一些问题。

使用 AWS CLI 在全新堆栈中注册 运行ning EBS 支持 Opsworks 堆栈的克隆的最佳方法是什么?

谢谢!

出于好奇,你在制作你的作品时是否遵循了the documentation on creating AMIs from OpsWorks instances

在创建实例之前,您需要在实例上执行某些操作。我想它可能会干扰 opsworks init/bootstrap 进程。您遇到的错误似乎暗示了这一点。