amazon-web-services - "Value of property CidrIp must be of type String"云信息

标签 amazon-web-services aws-cloudformation

我的 CFN 模板遇到问题。我在参数中定义了一个 CIDR block ,并希望将其用作安全组资源中的 CidrIp

但是,当我运行堆栈时,我收到 Value of property CidrIp must be of type String 错误,并且堆栈正在回滚。

这是我的最小失败模板。我想使用 VPCCidrBlock 来定义 CidrIp。

有趣的是,AWS 的示例模板 LAMP_Multi_AZ 执行完全相同的操作。

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "A cloud VPC",
  "Metadata": {
  },
  "Resources": {
    "myvpc": {
      "Type": "AWS::EC2::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VPCCidrBlock"
        }
      }
    },
    "SipserverSecurityGroup": {
      "Type": "AWS::EC2::SecurityGroup",
      "Properties": {
        "GroupDescription": "Enable VPC access",
        "VpcId": {
          "Ref": "myvpc"
        },
        "SecurityGroupIngress": [
          { "IpProtocol": "tcp", "FromPort": "22", "ToPort": "22", "CidrIp": { "Ref": "VPCCidrBlock" } },
          { "IpProtocol": "udp", "FromPort": "5060", "ToPort": "5060", "CidrIp": { "Ref:": "VPCCidrBlock" } }
        ]
      }
    }
  },
  "Parameters": {
    "VPCCidrBlock": {
      "Description": "Main CIDR block for the whole VPC",
      "Type": "String",
      "MinLength": "9",
      "MaxLength": "18",
      "Default": "10.13.0.0/16",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
    }
  }
}

最佳答案

我也遇到了类似的问题,我能够指出这个问题。我使用“ref”而不是“Ref”来引用参数。

关于amazon-web-services - "Value of property CidrIp must be of type String"云信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33485738/

相关文章:

amazon-web-services - 如何为 AWS 中的 lambda 遇到的错误百分比设置警报?

java - 从java aws lambda访问s3

amazon-web-services - 从.txt文件/s3存储桶获取cloudform参数

amazon-web-services - 如何使用 RedShift 查询的输出作为 EMR 作业的输入?

sql - Redshift 选择随机记录但避免重复

regex - CloudFormation 参数动态正则表达式

amazon-web-services - AWS 特定参数类型背后的想法是什么?

amazon-web-services - 如何在 AWS 市场上部署 EKS 集群应用程序

amazon-web-services - 错误 : exec: \"app.handler\": executable file not found in $PATH", "errorType": "Runtime.InvalidEntrypoint"

amazon-web-services - Cloudformation 创建的 Autoscaling 组超时