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개 답변
0
수락된 답변

Try using the intrinsic function Ref.

"OptionGroupName": {
    "Ref": "RDSoptiongroupRestore"
},
profile picture
hayao-k
답변함 2년 전
  • How does it know which property of Optiongroup to assign?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠