Skip to content

Commit

Permalink
Updated aurora automated backup retention
Browse files Browse the repository at this point in the history
* This extends point-in-time (PIT) recovery objective (RPO) upto 7 days
  in production RDS aurora cluster. Staging and development maintain
  1 day RPO.
  • Loading branch information
victorskl committed Dec 9, 2024
1 parent da840b6 commit ee601c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/stacks/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const getDatabaseConstructProps = (stage: AppStage): ConfigurableDatabaseProps =
enhancedMonitoringInterval: Duration.seconds(60),
enablePerformanceInsights: true,
removalPolicy: RemovalPolicy.DESTROY,
backupRetention: Duration.days(1),
};
case AppStage.GAMMA:
return {
Expand All @@ -165,14 +166,18 @@ const getDatabaseConstructProps = (stage: AppStage): ConfigurableDatabaseProps =
enhancedMonitoringInterval: Duration.seconds(60),
enablePerformanceInsights: true,
removalPolicy: RemovalPolicy.DESTROY,
backupRetention: Duration.days(1),
};
case AppStage.PROD:
return {
...baseConfig,
numberOfInstance: 1,
minACU: 0.5,
maxACU: 16,
enhancedMonitoringInterval: Duration.seconds(60),
enablePerformanceInsights: true,
removalPolicy: RemovalPolicy.RETAIN,
backupRetention: Duration.days(7),
};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export type ConfigurableDatabaseProps = MonitoringProps & {
* The schedule (in Duration) that will rotate the master secret
*/
secretRotationSchedule: Duration;
/**
* RDS aurora automated backup retention (in Duration)
*/
backupRetention: Duration;
};

/**
Expand Down Expand Up @@ -161,6 +165,10 @@ export class DatabaseConstruct extends Construct {
writer: rds.ClusterInstance.serverlessV2('WriterClusterInstance', {
enablePerformanceInsights: props.enablePerformanceInsights,
}),

backup: {
retention: props.backupRetention,
},
});

new sm.SecretRotation(this, 'MasterDbSecretRotation', {
Expand Down

0 comments on commit ee601c9

Please sign in to comment.