gpt4 book ai didi

amazon-web-services - 更改云形成模板中的 ElastiCache 节点 DNS 记录

转载 作者:行者123 更新时间:2023-12-04 08:08:25 24 4
gpt4 key购买 nike

我需要为 ElastiCache 集群创建 CNAME 记录。但是我搭建的redis集群只有一个节点。据我发现没有Redis 集群的 ConfigurationEndpoint.Address。是否有机会更改集群中节点的 DNS 名称以及如何更改?

当前模板如下所示:

  "ElastiCahceDNSRecord" : {
"Type" : "AWS::Route53::RecordSetGroup",
"Properties" : {
"HostedZoneName" : "example.com.",
"Comment" : "Targered to ElastiCache",
"RecordSets" : [{
"Name" : "elche01.example.com.",
"Type" : "CNAME",
"TTL" : "300",
"ResourceRecords" : [
{
"Fn::GetAtt": [ "myelasticache", "ConfigurationEndpoint.Address" ]
}
]

}]

}

}

最佳答案

对于来到此页面寻求解决方案的人们。现在有一种方法可以直接从 CFN 内获取 Redis 端点。

现在可以从 AWS::ElastiCache::CacheClusterPrimaryEndPoint.Address 获取 RedisEndpoint.Address AWS::ElastiCache::ReplicationGroup

根据文档 (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html):

RedisEndpoint.Address - The DNS address of the configuration endpoint for the Redis cache cluster.

RedisEndpoint.Port - The port number of the configuration endpoint for the Redis cache cluster.

根据文档 (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html):

PrimaryEndPoint.Address - The DNS address of the primary read-write cache node.

PrimaryEndPoint.Port - The number of the port that the primary read-write cache engine is listening on.

CFN 示例(不包括其他位):

Resources:
DnsRedis:
Type: 'AWS::Route53::RecordSetGroup'
Properties:
HostedZoneName: 'a.hosted.zone.name.'
RecordSets:
- Name: 'a.record.set.name'
Type: CNAME
TTL: '300'
ResourceRecords:
- !GetAtt
- RedisCacheCluster
- RedisEndpoint.Address
DependsOn: RedisCacheCluster

RedisCacheCluster:
Type: 'AWS::ElastiCache::CacheCluster'
Properties:
ClusterName: cluster-name-redis
AutoMinorVersionUpgrade: 'true'
AZMode: single-az
CacheNodeType: cache.t2.small
Engine: redis
EngineVersion: 3.2.4
NumCacheNodes: 1
CacheSubnetGroupName: !Ref ElastiCacheSubnetGroupId
VpcSecurityGroupIds:
- !GetAtt
- elasticacheSecGrp
- GroupId

关于amazon-web-services - 更改云形成模板中的 ElastiCache 节点 DNS 记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35014038/

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