gpt4 book ai didi

amazon-web-services - Cloudformation - ElastiCache::SubnetGroup 不支持资源名称

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

我在 CloudFormation 上遇到了一个奇怪的问题,这似乎是一个错误,或者更有可能 - 我错过了一些非常基本的东西。

我有以下模板(片段)定义两个子网和一个子网组,如下所示:

...

"redissubnet1": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.8.0/24",
"AvailabilityZone": "us-east-1c",
"VpcId": {
"Ref": "myVPC"
},
"Tags": [
{
"Key": "Name",
"Value": "redissubnet1"
}
]
}
},
"redissubnet2": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.9.0/24",
"AvailabilityZone": "us-east-1c",
"VpcId": {
"Ref": "myVPC"
},
"Tags": [
{
"Key": "Name",
"Value": "redissubnet2"
}
]
}
},
"SubnetGroupName": {
"Type": "AWS::ElastiCache::SubnetGroup",
"Properties": {
"Description": "Subnet group for main application redis elastic cache",
"SubnetIds": [
{
"Ref": "redissubnet1"
},
{
"Ref": "redissubnet2"
}
]
}
}

...

所有资源均已创建,但子网组名称 - “SubnetGroupName” - 未得到认可。 AWS 自动分配格式为 [a-z]-[a-z]-[a-z0-9]

的名称

有人遇到过这种情况吗?

我实际上想做的是在创建 ElastiCache::Cluster 时按名称引用此子网组 - 但由于资源名称不受尊重,我无法这样做。

大家有什么想法吗?非常感谢所有帮助:)

最佳答案

答案是引用弹性缓存资源中的子网组名称,如下所示:

{
"subnet1": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.8.0/24",
"AvailabilityZone": "us-east-1c",
"VpcId": {
"Ref": "myVPC"
},
"Tags": [{
"Key": "Name",
"Value": "subnet1"
}]
}
},
"subnet2": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.9.0/24",
"AvailabilityZone": "us-east-1c",
"VpcId": {
"Ref": "myVPC"
},
"Tags": [{
"Key": "Name",
"Value": "subnet2"
}]
}
},
"redis1": {
"Type": "AWS::ElastiCache::SubnetGroup",
"Properties": {
"Description": "Subnet group for main application redis elastic cache",
"SubnetIds": [{
"Ref": "subnet1"
}, {
"Ref": "subnet2"
}]
}
},
"mainredis": {
"Type": "AWS::ElastiCache::CacheCluster",
"Properties": {
"AutoMinorVersionUpgrade": "true",
"CacheNodeType": "cache.t2.small",
"CacheSubnetGroupName": {
"Ref": "redis1"
},
"ClusterName": "mainredis",
"Engine": "redis",
"NumCacheNodes": "1",
"Port": "6379",
"Tags": [{
"Key": "Name",
"Value": "mainredis"
}, {
"Key": "Function",
"Value": "Main redis store"
}],
"VpcSecurityGroupIds": [
"redissecuritygroup"
]
}
}
}

关于amazon-web-services - Cloudformation - ElastiCache::SubnetGroup 不支持资源名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39374519/

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