Skip to content

Commit

Permalink
feat(rds): support local write forwarding for an aurora PostgreSQL cl…
Browse files Browse the repository at this point in the history
…uster (aws#31803)

### Issue # (if applicable)

Closes aws#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*
  • Loading branch information
go-to-k authored Oct 19, 2024
1 parent efbbddb commit a32436a
Show file tree
Hide file tree
Showing 11 changed files with 520 additions and 48 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,163 @@
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"DatabaseClusterPostgresqlSubnetsE0173DAA": {
"Type": "AWS::RDS::DBSubnetGroup",
"Properties": {
"DBSubnetGroupDescription": "Subnets for DatabaseClusterPostgresql database",
"SubnetIds": [
{
"Ref": "VPCPrivateSubnet1Subnet8BCA10E0"
},
{
"Ref": "VPCPrivateSubnet2SubnetCFCDAA7A"
}
]
}
},
"DatabaseClusterPostgresqlSecurityGroupEF4103D2": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "RDS security group",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"VpcId": {
"Ref": "VPCB9E5F0B4"
}
}
},
"DatabaseClusterPostgresqlSecretD2D9C157": {
"Type": "AWS::SecretsManager::Secret",
"Properties": {
"Description": {
"Fn::Join": [
"",
[
"Generated by the CDK for stack: ",
{
"Ref": "AWS::StackName"
}
]
]
},
"GenerateSecretString": {
"ExcludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\",
"GenerateStringKey": "password",
"PasswordLength": 30,
"SecretStringTemplate": "{\"username\":\"postgres\"}"
}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"DatabaseClusterPostgresqlSecretAttachment09D32DC9": {
"Type": "AWS::SecretsManager::SecretTargetAttachment",
"Properties": {
"SecretId": {
"Ref": "DatabaseClusterPostgresqlSecretD2D9C157"
},
"TargetId": {
"Ref": "DatabaseClusterPostgresql0775776E"
},
"TargetType": "AWS::RDS::DBCluster"
}
},
"DatabaseClusterPostgresql0775776E": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"CopyTagsToSnapshot": true,
"DBClusterParameterGroupName": "default.aurora-postgresql16",
"DBSubnetGroupName": {
"Ref": "DatabaseClusterPostgresqlSubnetsE0173DAA"
},
"EnableLocalWriteForwarding": true,
"Engine": "aurora-postgresql",
"EngineVersion": "16.4",
"MasterUserPassword": {
"Fn::Join": [
"",
[
"{{resolve:secretsmanager:",
{
"Ref": "DatabaseClusterPostgresqlSecretD2D9C157"
},
":SecretString:password::}}"
]
]
},
"MasterUsername": {
"Fn::Join": [
"",
[
"{{resolve:secretsmanager:",
{
"Ref": "DatabaseClusterPostgresqlSecretD2D9C157"
},
":SecretString:username::}}"
]
]
},
"Port": 5432,
"ServerlessV2ScalingConfiguration": {
"MaxCapacity": 2,
"MinCapacity": 0.5
},
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"DatabaseClusterPostgresqlSecurityGroupEF4103D2",
"GroupId"
]
}
]
},
"UpdateReplacePolicy": "Snapshot",
"DeletionPolicy": "Snapshot"
},
"DatabaseClusterPostgresqlwriterInstanceB16652DD": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBClusterIdentifier": {
"Ref": "DatabaseClusterPostgresql0775776E"
},
"DBInstanceClass": "db.serverless",
"Engine": "aurora-postgresql",
"PromotionTier": 0
},
"DependsOn": [
"VPCPrivateSubnet1DefaultRouteAE1D6490",
"VPCPrivateSubnet1RouteTableAssociation347902D1",
"VPCPrivateSubnet2DefaultRouteF4F5CFD2",
"VPCPrivateSubnet2RouteTableAssociation0C73D413"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"DatabaseClusterPostgresqlreaderInstance10798C6B0": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBClusterIdentifier": {
"Ref": "DatabaseClusterPostgresql0775776E"
},
"DBInstanceClass": "db.serverless",
"Engine": "aurora-postgresql",
"PromotionTier": 2
},
"DependsOn": [
"DatabaseClusterPostgresqlwriterInstanceB16652DD",
"VPCPrivateSubnet1DefaultRouteAE1D6490",
"VPCPrivateSubnet1RouteTableAssociation347902D1",
"VPCPrivateSubnet2DefaultRouteF4F5CFD2",
"VPCPrivateSubnet2RouteTableAssociation0C73D413"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
},
"Mappings": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a32436a

Please sign in to comment.