gpt4 book ai didi

amazon-web-services - Cloudformation init - 安装多个包

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

我有以下参数询问用户要安装哪些软件包:

  Packages:
Description: A SPACE seperated list of packages that you want installed on this instance.
Type: String
Default: None

然后在 EC2 实例的资源定义中,我有:

  WebServerHost:
Type: AWS::EC2::Instance
Metadata:
Comment: Install HTTP server
AWS::CloudFormation::Init:
config:
packages:
yum:
Fn::Join: [ ' ', [ !Ref Packages ] ]

但这行不通!请有人告诉我我做错了什么或者我是否采取了错误的方法?谢谢

最佳答案

Packages接受对象,而不是列表。所以你不能按照你想要的方式动态地做到这一点。您必须显式指定 yum 的正确值,因为在这种情况下,它们不能作为参数传递。

解决这个问题的唯一方法是通过 CloudFormation macro ,您必须开发它,并且它将正确地将 yum 属性设置为对象,而不是列表。

关于amazon-web-services - Cloudformation init - 安装多个包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70108704/

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