AWS Auto AMI(Instance) backup across all region
Simple Easy way AWS auto AMI backup(snapshot + image backup of ec2) across all region or cross region using lambda (node js)
Note : It will delete previous backups everyday before taking new snapshot & new image ami backup.
Link For Code https://github.com/harsh4870/AWS-auto-ami-backup-across-all-region
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Prerequisites
What things you need
AWS Lambda AWS Sdk
Installing
A step by step series of examples that tell you how to get a development env running
- Make AWS Policy Using File
iam-policy.json
- Make AWS Role Using File
role-trust-policy.json
- Assign or attach policy to Role
Create Two New Lambda Function And Assign Role That you have made
- Use Code From File for Lambda Functions
1. Create_AMI.js 2. Delete_AMI.js
Running the tests
Run Lambda Function And Check For Snap Shot and AMI
Full Automation Using Cloud Watch
Use Cloud Watch Event as Trigger To Make Full Automation of Backup System
From Lambda Trigger Choose Cloud Watch Event
Cron job cloud watch
Cloud Watch Cron Job Expression
Cron Expression :- cron(fields) Example: The first example creates a rule that is triggered every day at 12:00pm UTC. cron(0 12 * * ? *) The next example creates a rule that is triggered every day, at 5 and 35 minutes past 2:00pm UTC. cron(5,35 14 * * ? *) Rate Expression :- rate(value unit) Example : The first example creates a rule that is triggered every 5 minutes. rate(5 minutes) The next example creates a rule that is triggered every 1 hour. rate(1 hour)
Code available at : GitHub