Created
June 6, 2020 12:34
-
-
Save krismorte/0c363086f177ca4c063c2c02b554852f 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(); | |
cluster.forEach(async (cluster)=>{ | |
var snaps = await rdsFunc.describeClustersAutomatedSnapshot(cluster.DBClusterIdentifier) | |
if(snaps){ | |
snaps.forEach(async (snap)=>{ | |
var copyDate = dateFunc.minusDaysFromToday(daysBefore); | |
var snapshotDate = dateFunc.removeTimeFromDate(snap.SnapshotCreateTime); | |
if (copyDate == snapshotDate) { | |
var copy = await rdsFunc.copyClusterSnapshot(snap.DBClusterSnapshotIdentifier) | |
console.log(copy+" Rds cluster snapshot cloned") | |
} | |
}) | |
} | |
}) | |
//RDS Instance | |
var instances = await rdsFunc.describeInstances(); | |
instances.forEach(async (instance)=>{ | |
var snaps = await rdsFunc.describeInstanceAutomatedSnapshot(instance.DBInstanceIdentifier) | |
if(snaps){ | |
snaps.forEach(async (snap)=>{ | |
var copyDate = dateFunc.minusDaysFromToday(daysBefore); | |
var snapshotDate = dateFunc.removeTimeFromDate(snap.SnapshotCreateTime); | |
if (copyDate == snapshotDate) { | |
var copy = await rdsFunc.copyInstanceSnapshot(snap.DBSnapshotIdentifier) | |
console.log(copy+" Rds instance snapshot cloned") | |
} | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment