Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbelien/ovh-cloud-snapshot
Create snapshots of your OVH Cloud instances and volumes via OVH API
https://github.com/jbelien/ovh-cloud-snapshot
cloud ovh ovh-api php
Last synced: about 2 months ago
JSON representation
Create snapshots of your OVH Cloud instances and volumes via OVH API
- Host: GitHub
- URL: https://github.com/jbelien/ovh-cloud-snapshot
- Owner: jbelien
- License: gpl-3.0
- Created: 2017-06-14T09:00:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T15:57:31.000Z (over 1 year ago)
- Last Synced: 2024-04-15T00:02:40.833Z (9 months ago)
- Topics: cloud, ovh, ovh-api, php
- Language: PHP
- Homepage: https://api.ovh.com
- Size: 135 KB
- Stars: 28
- Watchers: 6
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![Latest Stable Version](https://poser.pugx.org/jbelien/ovh-cloud-snapshot/v/stable)](https://packagist.org/packages/jbelien/ovh-cloud-snapshot)
[![Total Downloads](https://poser.pugx.org/jbelien/ovh-cloud-snapshot/downloads)](https://packagist.org/packages/jbelien/ovh-cloud-snapshot)
[![Monthly Downloads](https://poser.pugx.org/jbelien/ovh-cloud-snapshot/d/monthly.png)](https://packagist.org/packages/jbelien/ovh-cloud-snapshot)# OVH Cloud Automated Snapshot
## Requirements
* [PHP](https://www.php.net/)
* [Composer](https://getcomposer.org/)## Installation
```shell
composer create-project jbelien/ovh-cloud-snapshot
```## Configuration
### First step
Create credentials by clicking [here](https://api.ovh.com/createToken/index.cgi?POST=/cloud/project/*/instance/*/snapshot&POST=/cloud/project/*/volume/*/snapshot&GET=/cloud/project/*/snapshot&GET=/cloud/project/*/volume/snapshot&DELETE=/cloud/project/*/snapshot/*&DELETE=/cloud/project/*/volume/snapshot/*) !
- POST: `/cloud/project/*/instance/*/snapshot`
- POST: `/cloud/project/*/volume/*/snapshot`
- GET: `/cloud/project/*/snapshot`
- GET: `/cloud/project/*/volume/snapshot`
- DELETE: `/cloud/project/*/snapshot/*`
- DELETE: `/cloud/project/*/volume/snapshot/*`### Second step
Create `snapshot.yml` in root directory with your credentials and the list of your instances/volumes :
```yaml
---
applicationKey:
applicationSecret:
consumerKey:duration:
projects:
- id: ""
instances:
- &myinstance
id: ""
name: "My Instance"
volumes:
- &myvolume
id: ""
name: "My Volume"
protected:
instances:
- ""
volumes:
- id: ""
instances:
...
volumes:
...
protected:
instances:
volumes:
...
```#### Configure `duration`
To determine after how many days/weeks/months/... you want snapshots to be delete, use `duration` option.
This option uses PHP `DateInterval` format :The format starts with the letter P, for "period." Each duration period is represented by an integer value followed by a period designator. If the duration contains time elements, that portion of the specification is preceded by the letter T.
Here are some simple examples. Two days is `P2D`. Two seconds is `PT2S`. Six years and five minutes is `P6YT5M`.
You can protect snapshots from deletion by setting its id in `protected.instances` or `protected.volumes`.
## Run
php snapshot.php
Dry-run mode (simulates the query) :
php snapshot.php --dry-run
## Crontab
You can automate the snapshot creation by creating a crontab making a call to this tool.