cloud-report
Version:
Collects and analyzes cloud resources
45 lines (44 loc) • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("../../../types");
const base_1 = require("../../base");
class RdsAutomatedBackupsEnabledAnalyzer extends base_1.BaseAnalyzer {
analyze(params, fullReport) {
const allInstances = params.instances;
if (!allInstances) {
return undefined;
}
const automated_backups_enabled = { type: types_1.CheckAnalysisType.Reliability };
automated_backups_enabled.what = "Is Automated backup enabled for RDS instances?";
automated_backups_enabled.why = `It is important to enabled automated backups so that incase of
hardware failures and accidental data loss, we can recover data.`;
automated_backups_enabled.recommendation = "Recommended to enable automated backups for all RDS instances.";
automated_backups_enabled.benchmark = ['all'];
const allRegionsAnalysis = {};
for (const region in allInstances) {
const regionInstances = allInstances[region];
allRegionsAnalysis[region] = [];
for (const instance of regionInstances) {
const instance_analysis = {};
instance_analysis.resource = instance;
instance_analysis.resourceSummary = {
name: "DBInstance",
value: instance.DBInstanceIdentifier,
};
if (instance.BackupRetentionPeriod > 0) {
instance_analysis.severity = types_1.SeverityStatus.Good;
instance_analysis.message = "Automated backup is enabled";
}
else {
instance_analysis.severity = types_1.SeverityStatus.Failure;
instance_analysis.message = "Automated backup is not enabled";
instance_analysis.action = "Enable Automated backup";
}
allRegionsAnalysis[region].push(instance_analysis);
}
}
automated_backups_enabled.regions = allRegionsAnalysis;
return { automated_backups_enabled };
}
}
exports.RdsAutomatedBackupsEnabledAnalyzer = RdsAutomatedBackupsEnabledAnalyzer;