Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable write forwarding for Aurora MySQL secondary clusters #749

Merged
merged 1 commit into from Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions db/shared-apps-aurora-mysql/database-cluster.yml
Expand Up @@ -78,12 +78,32 @@ Conditions:
HasMasterUserCredentials: !And [!Condition HasMasterUsername, !Condition HasMasterUserPassword]

Resources:
DbClusterParameterGroup:
Type: AWS::RDS::DBClusterParameterGroup
Properties:
Description: !Sub ${AWS::StackName} cluster parameters
Family: aurora-mysql8.0
Parameters:
# https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-write-forwarding-ams.html#aurora-global-database-write-forwarding-params-ams
aurora_replica_read_consistency: GLOBAL
Tags:
- { Key: Name, Value: !Sub "${AWS::StackName}_shared-mysql-aurora" }
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
- { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
- { Key: prx:ops:environment, Value: !Ref EnvironmentType }
- { Key: prx:dev:application, Value: Common }

DbCluster:
Type: AWS::RDS::DBCluster
DeletionPolicy: Retain
UpdateReplacePolicy: Retain
Properties:
# BackupRetentionPeriod
DBClusterParameterGroupName: !If
- HasGlobalClusterIdentifier # indicates a secondary cluster
- !Ref DbClusterParameterGroup
- !Ref AWS::NoValue
DBSubnetGroupName: !Ref DbSubnetGroup
DeletionProtection: true
EnableCloudwatchLogsExports:
Expand All @@ -97,6 +117,10 @@ Resources:
- HasGlobalClusterIdentifier
- !Ref GlobalClusterIdentifier
- !Ref AWS::NoValue
EnableGlobalWriteForwarding: !If
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We trying this in staging first, or fairly safe to just change everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are deployed manually, so I would do staging first

- HasGlobalClusterIdentifier # indicates a secondary cluster
- true
- false
MasterUsername: !If
- HasMasterUserCredentials
- !Ref DbClusterMasterUsername
Expand Down