部署后如何获取container_commands的输出?

Ben*_*rel 7 amazon-web-services elastic-beanstalk

我的 Elastic Beanstalk 容器使用container_commands运行脚本来在每次部署时修补数据库。

我使用自制脚本运行部署,该脚本在 Elastic Beanstalk API 上调用UpdateEnvironment

问题是,我看不到 my 的输出container_commands,这在部署过程中非常可怕。我可以判断是否出现问题的唯一方法是当命令返回非零值时:在这种情况下,DescribeEvents将报告问题。但是,我仍然无法获得命令的实际输出。

container_commands部署完成后如何获取输出?

理想情况下,使用 Elastic Beanstalk API,但任何其他编程方式都可以!

Mar*_*rry 14

不是控制台视图,但它(现在)在日志中可见。

.ebextensions/10-log.config

container_commands:
  05-whoami:
    command: "whoami"
Run Code Online (Sandbox Code Playgroud)

部署后的/var/log/cfn-init.log

2014-07-01 22:08:10,695 [DEBUG] Running command 05-whoami
2014-07-01 22:08:10,695 [DEBUG] Generating defaults for command 05-whoami
2014-07-01 22:08:11,014 [DEBUG] Defaults script for 05-whoami output: {"env":{"EB_REQUEST_ID":"110d0932-016c-11e4-9f71-3fe967c5cd60", [long list of params omitted for brevity]}
2014-07-01 22:08:11,015 [DEBUG] No test for command 05-whoami
2014-07-01 22:08:11,050 [INFO] Command 05-whoami succeeded
2014-07-01 22:08:11,050 [DEBUG] Command 05-whoami output: root
Run Code Online (Sandbox Code Playgroud)

  • 在 `/var/log/cfn-init-cmd.log` 中找到了我的 (2认同)

Ben*_*rel 4

AWS 支持的回复:

查看输出的最简单方法是将命令或脚本输出通过管道传输到文件>>。不幸的是,没有可以查看的实时控制台来实时显示流程。

不幸的是,目前还没有办法做到这一点。