w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
how to construct a string of physical subnet ids to create db subnet group on the fly in a cloudformation script?

I run into the same issue, after working with AWS support I understood that List of String does not mean what we initially thought. Also, if you want to place the DB inside a VPC you must not use AWS::RDS::DBSecurityGroup objects.

Here is a full sample, it took me a while to get it working:

"dbSubnetGroup" : {
        "Type" : "AWS::RDS::DBSubnetGroup",
        "Properties" : {
            "DBSubnetGroupDescription" : "Availability Zones for RDS DB",
            "SubnetIds" : [ { "Ref" : "subnetPrivate1" },
                            { "Ref" : "subnetPrivate2" } ]
        }
},
"dbInstance" : {
        "Type" : "AWS::RDS::DBInstance",
        "Properties" : {
            "DBInstanceIdentifier" : { "Fn::Join" : [ "",
                                                    [ { "Ref" :
"AWS::StackName" },
                                                      "DB" ] ] },
            "DBName" : "dbname",
            "DBSubnetGroupName" : { "Ref" : "dbSubnetGroup" },
            "MultiAZ" : "true",
            "AllocatedStorage" : "8",
            "BackupRetentionPeriod" : "0",
            "DBInstanceClass" : "db.m1.medium",
            "Engine" : "postgres",
            "MasterUserPassword" : "masteruserpassword",
            "MasterUsername" : "masterusername",
            "VPCSecurityGroups" : [ { "Ref" : "sgVpc" }, { "Ref" : "sgDB" }
]
     }
},




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.