Created
June 6, 2020 12:36
-
-
Save krismorte/39fde36aa27b47e721bfa2bb0d943440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = await rdsFunc.describeClusters(); | |
for (i=0;i<cluster.length;i++){ | |
var snaps = await rdsFunc.describeClustersAutomatedSnapshot(cluster[i].DBClusterIdentifier) | |
if(snaps){ | |
snaps.forEach(async (snap)=>{ | |
AWS.config.update({ | |
region: process.env.copyRegion | |
}) | |
var rdsFuncOtherRegion = new RDSFunc(AWS) | |
var copyDate = dateFunc.minusDaysFromToday(daysBefore); | |
var snapshotDate = dateFunc.removeTimeFromDate(snap.SnapshotCreateTime); | |
if (copyDate == snapshotDate) { | |
var copy = await rdsFuncOtherRegion.copyClusterSnapshot(snap.DBClusterSnapshotArn,process.env.mainRegion) | |
console.log(copy+" Rds cluster snapshot cloned") | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment