gpt4 book ai didi

amazon-web-services - 是否可以在AWS中的option_settings上使用Ref函数?

转载 作者:行者123 更新时间:2023-12-03 07:12:39 27 4
gpt4 key购买 nike

我正在使用 Elastic Beanstalk 通过 SQS 部署工作线程层环境。

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

option_settings:
aws:elasticbeanstalk:sqsd:
WorkerQueueURL:
Ref: WorkerQueue
HttpPath: "/sqs/"
InactivityTimeout: 1650
VisibilityTimeout: 1680
MaxRetries: 1

Resources:
WorkerQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: "tpc-clients-aws-queue"
VisibilityTimeout: 1680

但是,此操作失败并出现以下错误:

"option_settings" in one of the configuration files failed validation. More details to follow.

Invalid option value: 'Ref=WorkerQueue' (Namespace: 'aws:elasticbeanstalk:sqsd', OptionName: 'WorkerQueueURL'): Value does not satisfy regex: '^$|^http(s)?://.+$' [Valid non empty URL starting with http(s)]

看来AWSCloudFormation Ref function不能在 option_settings 中使用。有人可以确认是否是这种情况吗?

我在 StackOverflow 上看到了一些使用 option_settings 中的内部函数的代码片段,例如 this answermount-config.config 中。以及 this question 。那么,这些示例是否使用了无效语法?或者有一些内在函数或特定资源可以在 option_settings 上使用?

最后,如果我无法使用 Ref 函数,我该怎么办?

最佳答案

是的,你可以在.ebextentions中引用,但是语法有点奇怪。它显示在文档 here 中.

您可以尝试按照以下方式进行操作(注意各种引号):

option_settings:
aws:elasticbeanstalk:sqsd:
WorkerQueueURL: '`{"Ref" : "WorkerQueue"}`'
HttpPath: "/sqs/"
InactivityTimeout: 1650
VisibilityTimeout: 1680
MaxRetries: 1

Resources:
WorkerQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: "tpc-clients-aws-queue"
VisibilityTimeout: 1680

如果您在输出中导出 WorkerQueue,您还可以使用 ImportValue

更新

要检查获得的值,您可以将其设置为环境变量,并在 EB 控制台中检查:

option_settings:
aws:elasticbeanstalk:application:environment:
SQS_NAME: '`{"Ref" : "WorkerQueue"}`'

关于amazon-web-services - 是否可以在AWS中的option_settings上使用Ref函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64110317/

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