如何通过云形成获得弹性缓存节点ip地址

时间:2015-11-16 09:49:08

标签: amazon-web-services amazon-cloudformation

我正在使用cloud-formation来创建一个带有redis引擎的elasitc缓存集群。

我想为该节点创建route53 DNS。

关注AWS Documentation他们使用AWS CLI获取IP节点,但是当尝试在JSON脚本中获取它时,这不起作用。

请考虑以下事项:

"DNS": {
  "Type": "AWS::Route53::HostedZone",
  "DependsOn": [
    "VPC"
  ],
  "Properties": {
    "HostedZoneConfig": {
      "Comment": "Private hosted zone for company.com"
    },
    "Name": "internal.company.com.",
    "VPCs": [
      {
        "VPCId": {
          "Ref": "VPC"
        },
        "VPCRegion": {
          "Ref": "AWS::Region"
        }
      }
    ]
  }
},
"DNSRedis" : {
        "Type" : "AWS::Route53::RecordSet",
        "DependsOn": [
    "DNS",
    "RedisElasticacheCluster"
  ],
        "Properties" : {
            "HostedZoneName" : "internal.company.com.",
            "Comment" : "Redis record",
            "Name" : "redis.internal.conpany.com.",
            "Type" : "A",
            "TTL" : "900",
            "ResourceRecords" : [
                "$cluster_config['RedisElasticacheCluster'][0]['CacheNodes'][0]['Endpoint']['Address']"
            ]
        }
    }

产生以下错误:

Invalid Resource Record: FATAL problem: ARRDATAIllegalIPv4Address encountered at $cluster_config['RedisElasticacheCluster'][0]['CacheNodes'][0]['Endpoint']['Address']

我在使用Memcached时也遇到错误:

"DNSMemcached" : {
        "Type" : "AWS::Route53::RecordSet",
        "DependsOn": [
    "DNS",
    "MemcachedElasticacheCluster"
  ],
        "Properties" : {
            "HostedZoneName" : "internal.company.com.",
            "Comment" : "Redis record",
            "Name" : "memcached.internal.company.com.",
            "Type" : "A",
            "TTL" : "900",
            "ResourceRecords" : [
                {
                  "Fn::GetAtt": [
                    "MemcachedElasticacheCluster",
                    "ConfigurationEndpoint.Address"
                  ]
      }
            ]
        }
    }

产生以下错误:

Invalid Resource Record: FATAL problem: ARRDATAIllegalIPv4Address encountered at tes-me-1wqeucxfrxr7x.euoka1.cfg.use1.cache.amazonaws.com

0 个答案:

没有答案