Skip to content

Commit

Permalink
feat: add production quality features to rds db
Browse files Browse the repository at this point in the history
  • Loading branch information
wolverian committed Dec 2, 2024
1 parent 287f777 commit 30b451f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions infra/lib/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface EnvironmentConfig {
}
domainName: string
databaseName: string
productionQuality: boolean
}

// CIDR allocation strategy:
Expand All @@ -24,6 +25,7 @@ export const deploymentAccounts = {
},
domainName: "kios.untuvaopintopolku.fi",
databaseName: "kios",
productionQuality: false,
},
test: {
name: "qa",
Expand All @@ -35,6 +37,7 @@ export const deploymentAccounts = {
},
domainName: "kios.testiopintopolku.fi",
databaseName: "kios",
productionQuality: false,
},
prod: {
name: "prod",
Expand All @@ -46,6 +49,7 @@ export const deploymentAccounts = {
},
domainName: "kios.opintopolku.fi",
databaseName: "kios",
productionQuality: true,
},
}

Expand Down
6 changes: 6 additions & 0 deletions infra/lib/db-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Construct } from "constructs"
export interface DbStackProps extends cdk.StackProps {
databaseName: string
vpc: aws_ec2.IVpc
productionQuality: boolean
}

export class DbStack extends cdk.Stack {
Expand All @@ -22,6 +23,11 @@ export class DbStack extends cdk.Stack {
storageEncrypted: true,
defaultDatabaseName: props.databaseName,
enableDataApi: true,
...(props.productionQuality && {
readers: [aws_rds.ClusterInstance.serverlessV2("reader")],
deletionProtection: true,
enablePerformanceInsights: true,
}),
})
}
}
1 change: 1 addition & 0 deletions infra/lib/environment-stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class EnvironmentStage extends Stage {
env,
vpc: networkStack.vpc,
databaseName: environmentConfig.databaseName,
productionQuality: environmentConfig.productionQuality,
})

connectionsStack.databaseSG = dbStack.cluster.connections.securityGroups[0]
Expand Down

0 comments on commit 30b451f

Please sign in to comment.