{"id":19695425,"url":"https://github.com/tanis2000/ec2backup","last_synced_at":"2025-02-27T10:50:59.054Z","repository":{"id":138035222,"uuid":"63347636","full_name":"tanis2000/ec2backup","owner":"tanis2000","description":"Simple AWS EC2 backup command line application for MacOS, Windows and Linux","archived":false,"fork":false,"pushed_at":"2018-03-05T13:22:43.000Z","size":398,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-10T09:33:51.823Z","etag":null,"topics":["amazon-api","aws","aws-ec2","backup","snapshot"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanis2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-14T15:22:05.000Z","updated_at":"2017-03-06T11:12:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef287bad-2ad5-49a2-9305-0152eba44a12","html_url":"https://github.com/tanis2000/ec2backup","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fec2backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fec2backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fec2backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fec2backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanis2000","download_url":"https://codeload.github.com/tanis2000/ec2backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241005763,"owners_count":19892859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-api","aws","aws-ec2","backup","snapshot"],"created_at":"2024-11-11T19:27:50.655Z","updated_at":"2025-02-27T10:50:59.034Z","avatar_url":"https://github.com/tanis2000.png","language":"Go","readme":"# ec2backup\n\n[![Build Status](https://img.shields.io/travis/tanis2000/ec2backup.svg)](https://travis-ci.org/tanis2000/ec2backup)\n\nA simple Go application to automate backup of Amazon EC2 volumes.\n\nIt scans all your instances and performs backups of the attached volumes.\n\nIt supports a few options to help keeping backups under control.\n\n# Building\n\nJust clone this repository in your $GOPATH and run the following lines:\n\n```\ngo get gopkg.in/alecthomas/kingpin.v2\ngo get github.com/aws/aws-sdk-go/aws\ngo build\n```\n\n# Usage\n\n```\nusage: ec2backup [\u003cflags\u003e] \u003cregion\u003e\n\nFlags:\n      --help                Show context-sensitive help (also try --help-long and --help-man).\n  -v, --verbose             Verbose mode.\n  -t, --tagged              Backup only volumes tagged with the Backup=true tag\n  -p, --purge               Purge old backups\n  -a, --purgeauto           Purge automated backups only. Will ignore manual backups\n  -d, --dryrun              Simulates creation and deletion of snapshots.\n  -b, --backup              Perform backup\n  -x, --nonexistingvolumes  Purge snapshots of no longer existing volumes\n  -n, --notusedvolumes      Purge snapshots of volumes no longer attached to instances\n      --version             Show application version.\n\nArgs:\n  \u003cregion\u003e  AWS region.\n```\n\n# Retention policy\n\nWe currently support only one retention policy at the moment. This is something that could be expanded on. Pull requests are welcome!\n\nThe current policy is as follows:\n\n- Keep last 30 days\n- Keep first day of each month\n- Keep first day of each year\n\nEverything else is being deleted.\n\n# Requirements\n\nJust like every application using the AWS SDK, we have a few requirements.\n\n## IAM User with the correct policies\n\nThis application requires an **IAM user** that can interact with Instances, Volumes and Snapshots.\nHere's an example of the IAM security policy required:\n\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Stmt1426256275000\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"ec2:CreateSnapshot\",\n                \"ec2:CreateTags\",\n                \"ec2:DeleteSnapshot\",\n                \"ec2:DescribeSnapshots\",\n                \"ec2:DescribeVolumes\",\n                \"ec2:DescribeInstances\"\n            ],\n            \"Resource\": [\n                \"*\"\n            ]\n        }\n    ]\n}\n```\n\n## AWS credentials\n\nYou should put the credentials of the IAM user that you're using to run this application in the correct configuration file.\nPlease refer to [Configuring Credentials](https://github.com/aws/aws-sdk-go#configuring-credentials)\n\n# Manually selecting the volumes to backup\n\nYou can select manually which volumes to backup by adding a new tag called **Backup** and setting it to the value **true** on the volume that you want to backup.\nYou will then need to run ec2backup with the **-t** flag. This way it will only pick up those volumes that have the **Backup** tag set to **true**.\n\n# Purging old backups\n\nBy default this application doesn't purge old backups.\nYou can turn it on by adding the **-p** flag.\nThe old backups will be purged based on the default retention policy.\nPlease note that all old snapshots will be checked, not just those created by this application.\nIf you want to delete only those created by this application, you have to add the **-a** flag. This way it will only delete those snapshots that have the **CreatedBy** tag set to **AutomatedBackup** which is set by this applicaton when the new snapshots are created.\n\n# Purging backups of no longer existing volumes\n\nYou can remove all the snapshots of volumes that no longer exist by adding the **-x** flag.\nThe old backups will be purged based on the default retention policy.\nPlease note that all old snapshots will be checked, not just those created by this application.\nIf you want to delete only those created by this application, you have to add the **-a** flag. This way it will only delete those snapshots that have the **CreatedBy** tag set to **AutomatedBackup** which is set by this applicaton when the new snapshots are created.\n\n# Purging backups of volumes no longer attached\n\nYou can remove all the snapshots of volumes that are no longer attached to instances by adding the **-n** flag.\nThe old backups will be purged based on the default retention policy.\nPlease note that all old snapshots will be checked, not just those created by this application.\nIf you want to delete only those created by this application, you have to add the **-a** flag. This way it will only delete those snapshots that have the **CreatedBy** tag set to **AutomatedBackup** which is set by this applicaton when the new snapshots are created.\n\n# Simulating\n\nThe **-d** flag can be added to simulate the creation and deletion of snapshots. This is useful to check that you're actually passing the correct parameters and that everything is fine.\n\n# Changelog\n\n## 0.2.0\n- Added the -x switch to remove backups of no longer existing volumes\n- Added the -n switch to remove backups of no volumes that are no longer attached to instances\n\n## 0.1.2\n\n- Added a 200ms delay between requests to AWS API to avoid being blocked by the rate limiter\n- Added the -b switch to run the backup so that we can just run a purge pass if needed\n\n## 0.1.1\n\n- First release\n\n# License\n\nThis application is distributed under the\n[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),\nsee LICENSE.txt and NOTICE.txt for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanis2000%2Fec2backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanis2000%2Fec2backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanis2000%2Fec2backup/lists"}