Skip to content

Commit

Permalink
Add aurora cluster capacity back to aspects
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Jul 5, 2023
1 parent 7a2d025 commit 570afae
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions infrastructure/cdk/src/providers/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class UsersStack extends cdk.Stack {
dbSecurityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(5432))

/** Create a DB cluster */
new rds.DatabaseCluster(this, config.getFullStackResourceName(this.name, 'db-cluster'), {
const dbCluster = new rds.DatabaseCluster(this, config.getFullStackResourceName(this.name, 'db-cluster'), {
engine: rds.DatabaseClusterEngine.auroraPostgres({
version: rds.AuroraPostgresEngineVersion.VER_15_2
}),
Expand All @@ -67,9 +67,19 @@ export class UsersStack extends cdk.Stack {
subnetType: ec2.SubnetType.PUBLIC
}
},
port: 5432,
serverlessV2MinCapacity: 0.5,
serverlessV2MaxCapacity: 1
port: 5432
})

/** Add serverless V2 scaling configuration to DB cluster */
cdk.Aspects.of(dbCluster).add({
visit(node) {
if (node instanceof rds.CfnDBCluster) {
node.serverlessV2ScalingConfiguration = {
minCapacity: 0.5, // min capacity is 0.5 vCPU
maxCapacity: 1 // max capacity is 1 vCPU (default)
}
}
},
})

/** Create an ECS cluster */
Expand Down

0 comments on commit 570afae

Please sign in to comment.