Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request for multiple backup cycles #10

Closed
opswm opened this issue Nov 23, 2018 · 3 comments
Closed

Feature request for multiple backup cycles #10

opswm opened this issue Nov 23, 2018 · 3 comments

Comments

@opswm
Copy link

opswm commented Nov 23, 2018

Hello, is there any good way to implement the functions of multiple backup cycles?
For example, the first cycle is daily backup, and the expired AMI is deleted every week.
The second cycle is weekly backup, deleting expired AMIs every month.
The third cycle is monthly backup, deleting expired AMIs every year.
Looking forward to your reply.

@AndrewFarley
Copy link
Owner

@ChampionWolf This can already do what you ask for with the features that are already built in. You will need to do the following...

First, you'll need to deploy this same stack 3 different times, one for each "cycle". To do this, change the second line in serverless.yml to be the name of each cycle... eg:

# Change this...
service: daily-instance-snapshot
# To maybe one of these three (different for each stack)
service: daily-backup-week-expired
service: weekly-backup-month-expired
service: monthly-backup-year-expired

Second, you'll need to adjust how often this script runs. There's a (README hint here)[https://github.com/AndrewFarley/AWS-Automated-Daily-Instance-AMI-Snapshots#scheduling-backups-at-specific-start-times] that tells you how you can make this run however/whenever you'd like. This uses a cron type format (see the link for info). For the daily one you don't need to change this, but for the weekly/monthly one you will need to change this to the right cron format for a weekly or monthly cron job. If you can't figure this out, ask I can help further.

Third, on the weekly/monthly stacks, you will need to change the DEFAULT_RETENTION_TIME of the deployed lambda to be 31 on the weekly-backup-month-expired stack, and 365 on the monthly-backup-year-expired task.

That should do it! :) No changes (from my side) needed to support your usage pattern, just deploy it three different times with different settings for each. Cheers, and enjoy!

@AndrewFarley
Copy link
Owner

I will add a tutorial to the main README on how to do this, so others can enjoy it. I'll close this issue when I do so. :)

@AndrewFarley
Copy link
Owner

Enjoy, there's a working example, with copy/paste instructions. :) Enjoy @ChampionWolf you should be able to understand and modify the example to create a third stack to do the monthly/expire after a year feature you desire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants