gpt4 book ai didi

amazon-web-services - ro 如何在 aws 弹性 beantalk 环境实例启动上运行 shell 脚本

转载 作者:行者123 更新时间:2023-12-02 07:21:57 26 4
gpt4 key购买 nike

我正在使用 Terraform 脚本创建 aws 弹性 beanstalk 环境,我需要在实例启动时启动一个 shell 脚本

我已经尝试了以下

resource "aws_elastic_beanstalk_environment" "Environment" {
name = "${var.ebs_env_name}"
application = "${var.ebs_app_name}"
---
---
---
setting = {
namespace = "aws:autoscaling:launchconfiguration"
name = "user_data"
value = "${file("user-data.sh")}"
}
}

这是抛出错误

Error applying plan:

1 error(s) occurred:

aws_elastic_beanstalk_environment.Environment: ConfigurationValidationException: Configuration validation exception: Invalid option specification (Namespace: 'aws:autoscaling:launchconfiguration', OptionName: 'user_data'): Unknown configuration setting. status code: 400, request id: xxxxx-xxxxxx



请帮忙

最佳答案

感谢您的回答,我找到了解决方案
我创建了一个文件夹 .ebextensions 并在文件夹中创建了一个名为 99delayed_job.config 的文件(您可以提供任何名称)
enter image description here

commands: 
create_post_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/pre"
ignoreErrors: true
files:
/opt/elasticbeanstalk/hooks/appdeploy/pre/99_restart_delayed_job.sh:
group: root
mode: "000755"
owner: root
content: |-
#!/usr/bin/env bash
<My shell script here>
A 并用“Dockerrun.aws.json”压缩这个 zip 我发送到 s3 并用于部署
enter image description here
工作正常:)

关于amazon-web-services - ro 如何在 aws 弹性 beantalk 环境实例启动上运行 shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43487335/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com