我是CloudFormation的新手。我的任务是创建一个Aurora数据库集群。问题是,我在执行CloudFormation模板后遇到以下错误。
嵌入式堆栈 ARN:AWS:cloudformation:EU-西-2:232313142384:堆叠/测试deploy4-数据库-1INKI7L337Z6X / 57a8ad10-123c-11e8-81aa-504dcd6ad3ba 未成功创建:以下资源未能成功 创建:[DatabaseCluster]。
以下是CloudFormation模板
--- AWSTemplateFormatVersion: 2010-09-09 Description: A basic CloudFormation template for an RDS Aurora cluster. Parameters:
DatabaseInstanceType:
Default: db.r3.large
AllowedValues:
- db.r3.large
- db.r3.xlarge
- db.r3.2xlarge
- db.r3.4xlarge
- db.r3.8xlarge
Description: The instance type to use for the database.
Type: String
DatabasePassword:
ConstraintDescription: must contain only alphanumeric characters.
Description: The database admin account password.
MaxLength: '41'
MinLength: '8'
NoEcho: 'true'
Type: String
DatabaseUsername:
ConstraintDescription: must contain only alphanumeric characters.
Description: The database admin account user name.
MaxLength: '16'
MinLength: '1'
Type: String
DatabaseBackupRetentionPeriod:
Type: String
Default: 7
AllowedValues:
- 1
- 7
Description: The database backup retention period in days.
DatabaseSubnets:
Description: The subnets to place database instances in.
Type: List<AWS::EC2::Subnet::Id>
DatabaseSecurityGroups:
Type: List<AWS::EC2::SecurityGroup::Id>
Description: Security groups to apply to the RDS cluster. Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Database Configuration
Parameters:
- DatabaseInstanceType
- DatabaseName
- DatabaseUsername
- DatabasePassword
- DatabaseSubnets
- DatabaseSecurityGroups
- DatabaseBackupRetentionPeriod
ParameterLabels:
DatabaseInstanceType:
default: Database Instance Type
DatabasePassword:
default: Database Password
DatabaseUsername:
default: Database Username
DatabaseBackupRetentionPeriod:
default: Database Backup Retention Period
DatabaseSubnets:
default: Database Subnets
DatabaseSecurityGroups:
default: Database Security Groups Resources:
DatabaseSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
Properties:
DBSubnetGroupDescription: CloudFormation managed DB subnet group.
SubnetIds:
Ref: DatabaseSubnets
DatabaseCluster:
Type: AWS::RDS::DBCluster
Properties:
Engine: aurora
MasterUsername:
Ref: DatabaseUsername
MasterUserPassword:
Ref: DatabasePassword
BackupRetentionPeriod:
Ref: DatabaseBackupRetentionPeriod
PreferredBackupWindow: 02:00-03:00
PreferredMaintenanceWindow: mon:03:00-mon:04:00
DBSubnetGroupName:
Ref: DatabaseSubnetGroup
VpcSecurityGroupIds:
Ref: DatabaseSecurityGroups
DatabasePrimaryInstance:
Type: AWS::RDS::DBInstance
Properties:
Engine: aurora
DBClusterIdentifier:
Ref: DatabaseCluster
DBInstanceClass:
Ref: DatabaseInstanceType
DBSubnetGroupName:
Ref: DatabaseSubnetGroup
除了此错误消息之外没有其他消息,这不会告诉我失败的真正原因。任何人都可以帮我理解如何调试它?
我正在附上状态屏幕的屏幕截图:
答案 0 :(得分:1)
因此,首先,如果您通过AWS控制台创建堆栈,请在选项 - &gt;高级 - &gt;失败时回滚时关闭失败时回滚选项。设置回滚失败到“否”#39;。然后,当堆栈创建失败时,您可以看到堆栈数据库。我将名称数据库称为引用,但该堆栈名称可能不是&#34;数据库&#34;。堆栈名称可能是MasterStackID和此名称&#39;数据库&#39;的组合。在该数据库堆栈中,您可以在资源&#34; DatabaseCluster&#34;中找到该堆栈失败的原因。这里发生的是当你尝试检查错误时,失败的堆栈被删除了。所以你找不到主要的错误。尝试通过关闭“失败时回滚”来创建堆栈。然后你可以看到数据库堆栈中的错误。希望有所帮助!