How can I resolve the "DBInstance xxxxxx failed to stabilize" error when I create an RDS DB instance using AWS CloudFormation?

Last updated: 2019-05-31

When I try to create an AWS::RDS::DBInstance resource with AWS CloudFormation, I get the following error: "DBInstance xxxxxx failed to stabilize." How can I resolve this error?

Short Description

If you create an Amazon Relational Database Service (Amazon RDS) DB instance (AWS::RDS::DBInstance) from an existing RDS DB snapshot using AWS CloudFormation, you can receive an error due to the following reasons:

  • The storage type in the DB snapshot doesn't match the storage type in the DB instance.
  • Your DB snapshots contain invalid objects.

Resolution

Match the storage types between your DB snapshot and DB instance

1.    Verify the storage type of the DB snapshot by using the Amazon RDS console or the describe-db-snapshots command in the AWS Command Line Interface (AWS CLI).

See the following example:

aws rds describe-db-snapshots --db-snapshot-identifier MyRDSSnapShot --region us-east-1
{
    "DBSnapshots": [
        {
            .......
            "AllocatedStorage": 20, 
            "Status": "available", 
            "PercentProgress": 100, 
            "DBSnapshotArn": "arn:aws:rds:us-east-1:1234567890:snapshot:MyRDSSnapShot", 
            "EngineVersion": "12.1.0.2.v7", 
            "ProcessorFeatures": [], 
            "OptionGroupName": "default:oracle-ee-12-1", 
            "SnapshotCreateTime": "2019-03-16T17:43:41Z", 
            "AvailabilityZone": "us-east-1f", 
            "StorageType": "gp2",
            .......
        }
    ]
}

Note: The StorageType value gp2 from the AWS CLI command maps to the value General Purpose (SSD) in the Amazon RDS console.

2.    In the AWS::RDS::DBInstance resource definition of your AWS CloudFormation JSON or YAML template, set the value of StorageType to gp2. See the following examples:

JSON:

{
    "MySampleDB": {
        "Type": "AWS::RDS::DBInstance",
        "Properties": {
            "DBInstanceClass": "db.t2.small",
            "StorageType": "gp2",
            "Engine": "postgres",
            "EngineVersion": "9.5.12",
            ........
        }
    }
}

YAML:

MySampleDB:
  Type: 'AWS::RDS::DBInstance'
  Properties:
    DBInstanceClass: db.t2.small
    StorageType: gp2
    Engine: postgres
    EngineVersion: 9.5.12
    ......

Note: If you don't explicitly set the storage type of your DB instance to the General Purpose SSD (gp2), then AWS CloudFormation sets StorageType to standard by default. This default setting causes Amazon RDS to convert gp2 to standard. The conversion takes a long time and causes AWS CloudFormation to timeout. Then, AWS CloudFormation returns the "DBInstance x failed to stabilize" error during DB instance creation.

3.    Launch your AWS CloudFormation stack to create the DB instance.

Verify that your DB snapshots don't have invalid objects

If the DB snapshot that's used to create your DB instance has invalid objects, complete the following steps:

1.    Identify and fix the invalid objects in your existing databases.

For example, the following Oracle database query returns a list of invalid objects:

select owner,object_name,object_type,status from dba_objects where status='INVALID'

2.    Retake snapshots from your existing databases.

Important: Retake the DB snapshots only after you fixed or removed all the invalid objects from your databases.

3.    Launch your AWS CloudFormation stack to create the DB instance using the existing DB snapshot.


Did this article help you?

Anything we could improve?


Need more help?