AWS Elastic Beanstalk Post 部署脚本

AWS Elastic Beanstalk Post Deploy Script

我正在尝试将 post 部署脚本添加到我的 Elastic Beanstalk。我读过一些博客 posts(阅读参考资料),其中提到将配置文件添加到 .elasticbeanstalk 目录。配置文件应该创建一个 shell 脚本并将其复制到目录:

/opt/elasticbeanstalk/hooks/appdeploy/post

在我的 .elasticbeanstalk 文件夹中,我有以下文件:

config.yml

    branch-defaults:
      staging:
        environment: env-name
    global:
      application_name: app-name
      default_ec2_keyname: aws-eb
      default_platform: 64bit Amazon Linux 2015.03 v1.3.1 running Ruby 2.2 (Passenger Standalone)
      default_region: us-west-2
      profile: eb-cli
      sc: git

test.config(我添加的配置用于测试 post 部署脚本的工作原理):

files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/01_test.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      # This is my test shell script

虽然我 运行 eb deploy 之后,shell 脚本没有被复制到上面的目录。我的 /opt/elasticbeanstalk/appdeploy/post 目录是空的。 .elasticbeanstalk文件夹在/var/app/current/目录下是正确的。我也看不到引用新脚本或错误的日志文件中的任何内容。我检查了 eb-tools.logeb-activity.logcron,并在所有日志中查找这些文件周围的关键字。还是不行。

提前感谢任何help/suggestions!

参考文献:

放置配置文件的正确位置是应用中的 .ebextensions 目录,而不是 . elasticbeanstalk。然后您应该在 /opt/elasticbeanstalk/hooks/appdeploy/post 目录中看到您的 shell 脚本。

如论坛中所述post "Dropping files directly into the hooks directories is risky as this is not the documented method, is different in some containers and may change in the future"