我在哪里创建 .ebextensions 以使其在 AWS Elastic Beanstalk 中工作

Where do I create .ebextensions for it to work in AWS Elastic Beanstalk

每次有新的部署,我都需要创建几个空目录。

我将遵循 中已接受答案的建议并使用 .ebextensions 方法。

根据文档,我需要放置这个目录"in the root of your source bundle." https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

这是源包的根目录吗? /var/application/current

我按照说明制作了一个 .config 文件,但没有被提取或应用。

我也试过手动创建我需要的目录,但是在web.stdout.log,我的应用没有权限使用创建的目录。我什至在这些目录上尝试过 chmod 777。

请帮我创建这些空目录upon/after部署

更新:

我现在用我的可部署 jar 压缩了 .ebextensions,我在日志中看到我的 .config 正在被提取。但是,当我尝试访问我正在创建的目录时,我仍然面临同样的权限问题。这里有什么问题?

createIODir.config:

commands:
  create_IO_dir:
    command: "mkdir /myIoDir"
    ignoreErrors: true
  create_input_dir:
    command: "mkdir /myIoDir/input"
    ignoreErrors: true
  create_output_dir:
    command: "mkdir /myIoDir/output"
    ignoreErrors: true
  create_record_dir:
    command: "mkdir /myIoDir/input/record"
    ignoreErrors: true
  create_schema_dir:
    command: "mkdir /myIoDir/input/schema"
    ignoreErrors: true
  create_json_dir:
    command: "mkdir /myIoDir/output/json"
    ignoreErrors: true
  create_avro_dir:
    command: "mkdir /myIoDir/output/avro"
    ignoreErrors: true
  permissions_IO_dir:
    command: "chmod 777 /myIoDir"
    ignoreErrors: true
  permissions_input_dir:
    command: "chmod 777 /myIoDir/input"
    ignoreErrors: true
  permissions_output_dir:
    command: "chmod 777 /myIoDir/output"
    ignoreErrors: true
  permissions_record_dir:
    command: "chmod 777 /myIoDir/input/record"
    ignoreErrors: true
  permissions_schema_dir:
    command: "chmod 777 /myIoDir/input/schema"
    ignoreErrors: true
  permissions_json_dir:
    command: "chmod 777 /myIoDir/output/json"
    ignoreErrors: true
  permissions_avro_dir:
    command: "chmod 777 /myIoDir/output/avro"
    ignoreErrors: true

基于命令。

问题是这些文件夹是在 linux 文件系统的 root / 中创建的,而不是在部署文件夹中创建的。

解决方案 是修复创建的文件夹的路径。