Skip to content

Instantly share code, notes, and snippets.

View michaelalber's full-sized avatar

Michael K. Alber michaelalber

View GitHub Profile
@michaelalber
michaelalber / lambdaAMICleanup.py
Created August 17, 2017 19:15 — forked from bkozora/lambdaAMICleanup.py
AWS Lambda Function to Delete AMIs and Snapshots
# 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.
@michaelalber
michaelalber / lambdaAMIBackups.py
Created August 17, 2017 19:16 — forked from bkozora/lambdaAMIBackups.py
AWS Lambda AMI Backups
# 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.
#
@michaelalber
michaelalber / cloudtechs.sh
Last active January 3, 2019 07:23
Create an AWS IAM Group, including PowerUserAccess, AWSCodeCommitPowerUser policies and a custom policy to allow self management of MFA
#!/bin/bash
# Apache License
# Version 2.0, January 2004
# http://www.apache.org/licenses/LICENSE-2.0
# Copyright 2019 Michael K. Alber <michael@interactplatform.io>
# Example: ./cloudtech.sh myprofile us-east-1
PROFILE=$1