amazon-web-services - Cloudformation 模板中的组合 Fn::Select + Fn::Split + Fn:GetAtt

标签 amazon-web-services aws-cloudformation

我正在尝试使用以下 cloudformation 堆栈,但我一直失败并出现以下错误:

模板错误:每个 Fn::Split 对象都需要两个参数,(1) 字符串分隔符和 (2) 要拆分的字符串或返回要拆分的字符串的函数。

  {
      "Type": "AWS::Route53Resolver::ResolverRule",
      "Properties": {
        "DomainName": {"Fn::Sub": "ad.${EnvName}.yyy.xxx.com"},
        "Name": {"Fn::Sub": "${EnvName}"},
        "ResolverEndpointId": "1",
        "RuleType": "FORWARD",
        "Tags" : [
          {
            "Key": "Name",
            "Value": {
              "Fn::Sub": "${EnvName}-ADResolverRule"
            }
          }
        ],
        "TargetIps": [
            {
                "Ip": {
                    "Fn::Select": [
                        0,
                        {
                            "Fn::Split": [
                                ",",
                                {
                                  "Fn::GetAtt": [
                                      "MicrosoftAD",
                                      "DnsIpAddresses"
                                  ]
                                }
                            ]
                        }
                    ]
                },
                "Port": "53"
            }
        ]
      }
    }

不太确定为什么我有 Fn::Split 函数的值,任何帮助将不胜感激。

谢谢。

最佳答案

问题似乎是您不需要在此处调用 split 。在这种情况下,当您调用 Fn::GetAtt 时,它不会创建字符串。如果你看documentation ,它生成一个列表对象。看着各种examples您会发现拆分是不必要的。

关于amazon-web-services - Cloudformation 模板中的组合 Fn::Select + Fn::Split + Fn:GetAtt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59636051/

相关文章:

amazon-web-services - 在CloudFormation中创建安全组时如何指定我的IP?

amazon-web-services - AWS : RDS Instance change DB Name

amazon-web-services - 数据库实例和EC2安全组位于不同的VPC,cloudFormation错误

amazon-web-services - 如何将 fsx forluster 输入到 Amazon Sagemaker?

amazon-web-services - 使用 REST 客户端 POSTMAN 使用 api key 调用 AWS api 网关端点

amazon-web-services - 引用无服务器框架中现有的 Cloudformation 堆栈输出

amazon-web-services - 使用 NLB 和 IAM 身份验证公开 AWS MSK - 主机名验证失败

amazon-web-services - 使用为云形成堆栈提供的参数命名资源

amazon-web-services - 无法使用 SAM 模板为 Lambda 函数创建 S3 PutObject 事件

amazon-web-services - aws CloudFormation AWS::EC2::Instance BlockDeviceMappings 和卷