This is totaly work in progress ... not suitable for usage jet
Start it from cron and hope for the best :)
- get all instances with tag
backup
set totrue
- for each of above instance
- create AMI
- tag AMI with tags needed for recovery (ip, subnet, name ...)
- check instance
retention
tag - if there is a AMI that is older then number of days defined by
retention
and number of backups (AMIs) for this instance is grater thanretntion
- deregister it
- delete all snapshots belonging to this AMI
backup
(true | false
) - if set totrue
instance will be backupedretention
- define backup retention. If not setretention
from config file will be used
Name
- ami name in formatBACKUP
+instance_name
+date
created
- intime()
format (epoch)srcInstanceId
- source instance idsrcInstanceName
- source instanceName
tagsrcPrimaryIP
- source instance primary IP (for now)srcSubnetId
- source instance subnet idsrcSecurityGroupId
- source instance first (for now) security groupsrcInstanceType
- source instance type (m4.large, t2.medium, ...)
defaults:
retention: 7
log file path: "./brokenSpectre.log"
# [10,20,30,40,50]... higher number, less logs (https://docs.python.org/2/library/logging.html#logging-levels)
log level: 10
boto log level: 50
delete abandoned: False
aws account id: "1234567890"