Creating SQL RDS instance in CloudFormation

2019-09-17 11:28发布

问题:

I can't find any examples on creating a SQL Server RDS instance in CloudFormation, so I took an educated guess using an example for MySQL. Here's what I came up with:

{
    "AWSTemplateFormatVersion" : "2010-09-09",

    "Resources" : {
        "DBInstance" : {
            "Type": "AWS::RDS::DBInstance",
            "Properties": {
                "DBInstanceIdentifier"  : "test-db",
                "Engine"                : "sqlserver-ex",
                "Port"                  : "1433",
                "DBInstanceClass"       : "db.t1.micro",
                "AllocatedStorage"      : "30",
                "MasterUsername"        : "sa",
                "MasterUserPassword"    : "password"
            }
        }
    }
}

Unfortunately this doesn't work (CREATE_FAILED). Can anyone tell me why?

回答1:

In addition to Peter H's response... DBInstanceIdentifier is not a supported property. I would consult the cloudformation docs for which properties are and are not supported as well as the required properties. http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html

Also... CloudFormation will tell you the reason it fails in the "Events" tab. One thing CloudFormation is really good at is telling you exactly why it failed.



回答2:

You are missing EngineVersion - "EngineVersion" : "11.00.2100.60.v1",

Also - you'll need DBSecurityGRoups to be added.