gpt4 book ai didi

amazon-web-services - AWS 云形成 : unable to create ElasticCache

转载 作者:行者123 更新时间:2023-12-03 07:14:22 24 4
gpt4 key购买 nike

我正在使用 CloudFomration 创建 ElasticCache memcached 资源。但是当我部署模板时它失败了。

这是我的模板

  ElasticCacheSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
Properties:
DBSubnetGroupDescription: Subnet Group to specify the subnets for elastic cache
SubnetIds:
- !Ref DatabaseSubnet1
- !Ref DatabaseSubnet2
ElasticCacheSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref Vpc
GroupDescription: Enable TCP connection on port 3306 for database connection
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '3306'
ToPort: '3306'
CidrIp: 0.0.0.0/0
ElasticCacheCluster:
Type: AWS::ElastiCache::CacheCluster
Properties:
AZMode: cross-az
CacheNodeType: cache.t2.small
Engine: memcached
NumCacheNodes: '3'
CacheSubnetGroupName: !Ref ElasticCacheSubnetGroup
VpcSecurityGroupIds:
- !Ref ElasticCacheSecurityGroup
PreferredAvailabilityZones:
- !Select
- 0
- Fn::GetAZs: !Ref AWS::Region
- !Select
- 1
- Fn::GetAZs: !Ref AWS::Region

这是我在日志中收到的错误。

 {
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/threetierwebapp/c88ea6d0-d029-11ea-9279-02162fdbb6ee",
"EventId": "eed78640-d029-11ea-8cd8-02e056ab1688",
"ResourceStatus": "ROLLBACK_IN_PROGRESS",
"ResourceType": "AWS::CloudFormation::Stack",
"Timestamp": "2020-07-27T16:55:10.741Z",
"ResourceStatusReason": "The following resource(s) failed to create: [ElasticCacheCluster]. . Rollback requested by user.",
"StackName": "threetierwebapp",
"PhysicalResourceId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/threetierwebapp/c88ea6d0-d029-11ea-9279-02162fdbb6ee",
"LogicalResourceId": "threetierwebapp"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/threetierwebapp/c88ea6d0-d029-11ea-9279-02162fdbb6ee",
"EventId": "ElasticCacheCluster-CREATE_FAILED-2020-07-27T16:55:09.946Z",
"ResourceStatus": "CREATE_FAILED",
"ResourceType": "AWS::ElastiCache::CacheCluster",
"Timestamp": "2020-07-27T16:55:09.946Z",
"ResourceStatusReason": "Cache Subnet Group threetierwebapp-elasticcachesubnetgroup-1hxvajmdjip1i does not exist. (Service: AmazonElastiCache; Status Code: 400; Error Code: CacheSubnetGroupNotFoundFault; Request ID: 790019b8-2ed8-4748-9c38-7c1eec121251)",
"StackName": "threetierwebapp",
"ResourceProperties": "{\"CacheNodeType\":\"cache.t2.small\",\"CacheSubnetGroupName\":\"threetierwebapp-elasticcachesubnetgroup-1hxvajmdjip1i\",\"VpcSecurityGroupIds\":[\"sg-0603c1f4b76c8afde\"],\"PreferredAvailabilityZones\":[\"eu-west-1a\",\"eu-west-1b\",\"eu-west-1c\"],\"NumCacheNodes\":\"3\",\"Engine\":\"memcached\",\"AZMode\":\"cross-az\"}",
"PhysicalResourceId": "",
"LogicalResourceId": "ElasticCacheCluster"
},

我的模板有什么问题以及如何修复它?

最佳答案

您已为您的 ElasticCacheSubnetGroup 资源分配了 AWS::RDS::DBSubnetGroup

而是将其交换为 AWS::ElastiCache::SubnetGroup并从中删除 DBSubnetGroupDescription 属性。

这看起来像下面


ElasticCacheSubnetGroup:
Type: AWS::ElastiCache::SubnetGroup
Properties:
SubnetIds:
- !Ref DatabaseSubnet1
- !Ref DatabaseSubnet2
ElasticCacheSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref Vpc
GroupDescription: Enable TCP connection on port 3306 for database connection
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '3306'
ToPort: '3306'
CidrIp: 0.0.0.0/0
ElasticCacheCluster:
Type: AWS::ElastiCache::CacheCluster
Properties:
AZMode: cross-az
CacheNodeType: cache.t2.small
Engine: memcached
NumCacheNodes: '3'
CacheSubnetGroupName: !Ref ElasticCacheSubnetGroup
VpcSecurityGroupIds:
- !Ref ElasticCacheSecurityGroup
PreferredAvailabilityZones:
- !Select
- 0
- Fn::GetAZs: !Ref AWS::Region
- !Select
- 1
- Fn::GetAZs: !Ref AWS::Region
- !Select
- 2
- Fn::GetAZs: !Ref AWS::Region

关于amazon-web-services - AWS 云形成 : unable to create ElasticCache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63120030/

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