Reputation: 6349
I am new to CloudFormation. I have been tasked to create an Aurora DB cluster. The problem is that, I am getting the following error after I execute the CloudFormation tempate.
Embedded stack arn:aws:cloudformation:eu-west-2:232313142384:stack/test-deploy4-Database-1INKI7L337Z6X/57a8ad10-123c-11e8-81aa-504dcd6ad3ba was not successfully created: The following resource(s) failed to create: [DatabaseCluster].
Following is the CloudFormation template
--- 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
There is no other message other than this error message, which does not give me the real reason for the failure. Can anyone please help me understand how do I debug this?
I am attaching the screen shot of status screen:
Upvotes: 0
Views: 1311
Reputation: 26
So, First of all, If you create the stack through AWS Console, turn off Rollback on failure option in Options->Advanced->Rollback on failure. Set Rollback on failure to 'No'. Then When stack creation failed, you can see a Stack Database. I called the name Database for reference, but that stack name might not be "Database". The Stack Name might be a combination of MasterStackID and this name 'Database'. Inside that Database stack, you can find the reason why that stack got failed at the resource "DatabaseCluster". What happened here is by the time you try to check the error, the failed Stack got deleted. So you cannot find the main error. Try to Create the stack by turning off 'Rollback on failure' and then you can see the error in Database Stack. Hope that will help!
Upvotes: 1