How do I create an RDS option group then reference that group for the RDS instance in Cloud Formation?

0

I am creating a cloud formation script that creates a ec2 instance as a bastion host, a RDS option group to allow for S3 backup and restoring, and a RDS db instance. In that script, I want to make an option group then immediately use it on the RDS instance. However, I get this error "Specified OptionGroupName: rdsoptiongrouprestore not found.

The formation template looks likes this:

"RdsDbCcw": {
            "Type": "AWS::RDS::DBInstance",
            "Properties": {
                "DBInstanceClass": {
                    "Ref": "DBInstanceClass"
                },
                "Engine": {
                    "Ref": "DBEngine"
                },
                "MasterUserPassword": {
                    "Ref": "DBAdminPassword"
                },
                "MasterUsername": "admin",
                "MultiAZ": false,
                "PubliclyAccessible": false,
                "StorageType": "gp2",
                "DBSubnetGroupName": {
                    "Ref": "SubnetGroupID"
                },
                "AllocatedStorage": 20,
		"OptionGroupName": "RDSoptiongroupRestore"
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "e52423ae-26df-4293-b4d3-073271c85ec0"
                }
            },
            "DependsOn": [
                "ec2Bastion",
                "appServer",
                "RDSoptiongroupRestore"
            ]
        },
        "RDSoptiongroupRestore": {
            "Type": "AWS::RDS::OptionGroup",
            "Properties": {
                "EngineName": {
                    "Ref": "DBEngine"
                },
                "MajorEngineVersion": "15.00",
                "OptionConfigurations": [
                    {
                        "OptionName": "SQLSERVER_BACKUP_RESTORE",
                        "OptionSettings": [
                            {
                                "Name": "IAM_ROLE_ARN",
                                "Value": "arn....."
                            }
                        ]
                    }
                ],
                "OptionGroupDescription": "For Restoring bakups from s3 bucket"
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "ce0de1d7-6e19-43c0-9df9-230562178612"
                }
            }
        }
    }

Do I need to create a delay or way to say to cloud formation that I just made this option group, so that that?

1 Answer
0
Accepted Answer

Try using the intrinsic function Ref.

"OptionGroupName": {
    "Ref": "RDSoptiongroupRestore"
},
profile picture
hayao-k
answered 2 years ago
  • How does it know which property of Optiongroup to assign?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions