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
base: | |
'somegrain*': | |
- match: grain | |
- foofoo |
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
# Automated AMI and Snapshot Deletion | |
# | |
# @author Robert Kozora <bobby@kozora.me> | |
# | |
# This script will search for all instances having a tag with "Backup" or "backup" | |
# on it. As soon as we have the instances list, we loop through each instance | |
# and reference the AMIs of that instance. We check that the latest daily backup | |
# succeeded then we store every image that's reached its DeleteOn tag's date for | |
# deletion. We then loop through the AMIs, deregister them and remove all the | |
# snapshots associated with that AMI. |
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
# Automated AMI Backups | |
# | |
# @author Robert Kozora <bobby@kozora.me> | |
# | |
# This script will search for all instances having a tag with "Backup" or "backup" | |
# on it. As soon as we have the instances list, we loop through each instance | |
# and create an AMI of it. Also, it will look for a "Retention" tag key which | |
# will be used as a retention policy number in days. If there is no tag with | |
# that name, it will use a 7 days default value for each AMI. | |
# |
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
AWS_TEMP_TOKEN_LAST_TOKEN=1559045147 | |
NOW_EPOCH=$(date +%s) | |
(( LAST_TOKEN_DIFF = $NOW_EPOCH - $AWS_TEMP_TOKEN_LAST_TOKEN )) | |
echo $LAST_TOKEN_DIFF | |
if [ $LAST_TOKEN_DIFF -ge 129600 ] ; | |
then | |
./aws-temp-token.sh | |
fi |
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
use mydb | |
db.getCollectionNames().forEach(function(x){print(x + ": " + db.getCollection(x).totalIndexSize()/(1024*1024*1024) + ", " + db.getCollection(x).dataSize()/(1024*1024*1024) + ", " + db.getCollection(x).totalSize()/(1024*1024*1024))}) |
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
databases = db.adminCommand( { listDatabases: 1 } ).databases; | |
var deleteCandidates = [] | |
databases.forEach( | |
function(database){ | |
if ((database.name != "admin") && (database.name != "config") && (database.name != "test")){ | |
print ("Connecting to: " + database.name); | |
conn = new Mongo(); | |
db = conn.getDB(database.name); | |
db.getCollectionNames().forEach(function(collection){ |