Skip to content

Commit a32436a

Browse files
authored
feat(rds): support local write forwarding for an aurora PostgreSQL cluster (#31803)
### Issue # (if applicable) Closes #31802. ### Reason for this change Amazon Aurora PostgreSQL now supports local write forwarding: Whats new: https://aws.amazon.com/about-aws/whats-new/2024/10/amazon-aurora-postgresql-local-write-forwarding/ Reference: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-postgresql-write-forwarding.html The current CDK L2 construct only supports MySQL, but PostgreSQL needs to be supported as well. ### Description of changes Remove the validation that engineType is either aurora or aurora-mysql, and modify docs. ### Description of how you validated changes Both unit tests and an integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent efbbddb commit a32436a

11 files changed

+520
-48
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enable-local-write-forwarding.js.snapshot/EnableLocalWriteForwardingClusterStack.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enable-local-write-forwarding.js.snapshot/EnableLocalWriteForwardingClusterStack.template.json

+157
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,163 @@
670670
],
671671
"UpdateReplacePolicy": "Delete",
672672
"DeletionPolicy": "Delete"
673+
},
674+
"DatabaseClusterPostgresqlSubnetsE0173DAA": {
675+
"Type": "AWS::RDS::DBSubnetGroup",
676+
"Properties": {
677+
"DBSubnetGroupDescription": "Subnets for DatabaseClusterPostgresql database",
678+
"SubnetIds": [
679+
{
680+
"Ref": "VPCPrivateSubnet1Subnet8BCA10E0"
681+
},
682+
{
683+
"Ref": "VPCPrivateSubnet2SubnetCFCDAA7A"
684+
}
685+
]
686+
}
687+
},
688+
"DatabaseClusterPostgresqlSecurityGroupEF4103D2": {
689+
"Type": "AWS::EC2::SecurityGroup",
690+
"Properties": {
691+
"GroupDescription": "RDS security group",
692+
"SecurityGroupEgress": [
693+
{
694+
"CidrIp": "0.0.0.0/0",
695+
"Description": "Allow all outbound traffic by default",
696+
"IpProtocol": "-1"
697+
}
698+
],
699+
"VpcId": {
700+
"Ref": "VPCB9E5F0B4"
701+
}
702+
}
703+
},
704+
"DatabaseClusterPostgresqlSecretD2D9C157": {
705+
"Type": "AWS::SecretsManager::Secret",
706+
"Properties": {
707+
"Description": {
708+
"Fn::Join": [
709+
"",
710+
[
711+
"Generated by the CDK for stack: ",
712+
{
713+
"Ref": "AWS::StackName"
714+
}
715+
]
716+
]
717+
},
718+
"GenerateSecretString": {
719+
"ExcludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\",
720+
"GenerateStringKey": "password",
721+
"PasswordLength": 30,
722+
"SecretStringTemplate": "{\"username\":\"postgres\"}"
723+
}
724+
},
725+
"UpdateReplacePolicy": "Delete",
726+
"DeletionPolicy": "Delete"
727+
},
728+
"DatabaseClusterPostgresqlSecretAttachment09D32DC9": {
729+
"Type": "AWS::SecretsManager::SecretTargetAttachment",
730+
"Properties": {
731+
"SecretId": {
732+
"Ref": "DatabaseClusterPostgresqlSecretD2D9C157"
733+
},
734+
"TargetId": {
735+
"Ref": "DatabaseClusterPostgresql0775776E"
736+
},
737+
"TargetType": "AWS::RDS::DBCluster"
738+
}
739+
},
740+
"DatabaseClusterPostgresql0775776E": {
741+
"Type": "AWS::RDS::DBCluster",
742+
"Properties": {
743+
"CopyTagsToSnapshot": true,
744+
"DBClusterParameterGroupName": "default.aurora-postgresql16",
745+
"DBSubnetGroupName": {
746+
"Ref": "DatabaseClusterPostgresqlSubnetsE0173DAA"
747+
},
748+
"EnableLocalWriteForwarding": true,
749+
"Engine": "aurora-postgresql",
750+
"EngineVersion": "16.4",
751+
"MasterUserPassword": {
752+
"Fn::Join": [
753+
"",
754+
[
755+
"{{resolve:secretsmanager:",
756+
{
757+
"Ref": "DatabaseClusterPostgresqlSecretD2D9C157"
758+
},
759+
":SecretString:password::}}"
760+
]
761+
]
762+
},
763+
"MasterUsername": {
764+
"Fn::Join": [
765+
"",
766+
[
767+
"{{resolve:secretsmanager:",
768+
{
769+
"Ref": "DatabaseClusterPostgresqlSecretD2D9C157"
770+
},
771+
":SecretString:username::}}"
772+
]
773+
]
774+
},
775+
"Port": 5432,
776+
"ServerlessV2ScalingConfiguration": {
777+
"MaxCapacity": 2,
778+
"MinCapacity": 0.5
779+
},
780+
"VpcSecurityGroupIds": [
781+
{
782+
"Fn::GetAtt": [
783+
"DatabaseClusterPostgresqlSecurityGroupEF4103D2",
784+
"GroupId"
785+
]
786+
}
787+
]
788+
},
789+
"UpdateReplacePolicy": "Snapshot",
790+
"DeletionPolicy": "Snapshot"
791+
},
792+
"DatabaseClusterPostgresqlwriterInstanceB16652DD": {
793+
"Type": "AWS::RDS::DBInstance",
794+
"Properties": {
795+
"DBClusterIdentifier": {
796+
"Ref": "DatabaseClusterPostgresql0775776E"
797+
},
798+
"DBInstanceClass": "db.serverless",
799+
"Engine": "aurora-postgresql",
800+
"PromotionTier": 0
801+
},
802+
"DependsOn": [
803+
"VPCPrivateSubnet1DefaultRouteAE1D6490",
804+
"VPCPrivateSubnet1RouteTableAssociation347902D1",
805+
"VPCPrivateSubnet2DefaultRouteF4F5CFD2",
806+
"VPCPrivateSubnet2RouteTableAssociation0C73D413"
807+
],
808+
"UpdateReplacePolicy": "Delete",
809+
"DeletionPolicy": "Delete"
810+
},
811+
"DatabaseClusterPostgresqlreaderInstance10798C6B0": {
812+
"Type": "AWS::RDS::DBInstance",
813+
"Properties": {
814+
"DBClusterIdentifier": {
815+
"Ref": "DatabaseClusterPostgresql0775776E"
816+
},
817+
"DBInstanceClass": "db.serverless",
818+
"Engine": "aurora-postgresql",
819+
"PromotionTier": 2
820+
},
821+
"DependsOn": [
822+
"DatabaseClusterPostgresqlwriterInstanceB16652DD",
823+
"VPCPrivateSubnet1DefaultRouteAE1D6490",
824+
"VPCPrivateSubnet1RouteTableAssociation347902D1",
825+
"VPCPrivateSubnet2DefaultRouteF4F5CFD2",
826+
"VPCPrivateSubnet2RouteTableAssociation0C73D413"
827+
],
828+
"UpdateReplacePolicy": "Delete",
829+
"DeletionPolicy": "Delete"
673830
}
674831
},
675832
"Mappings": {

packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enable-local-write-forwarding.js.snapshot/EnableLocalWriteForwardingClusterStackIntegDefaultTestDeployAssertFA53AD26.assets.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enable-local-write-forwarding.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enable-local-write-forwarding.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enable-local-write-forwarding.js.snapshot/manifest.json

+52-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)