You can perform a manual backup of active Starter and Pro Integration environments at any time using the Snapshots button in the Project Web Interface or using the magento-cloud snapshot:create
command.
A snapshot is a complete backup of environment data that includes all persistent data from running services (MySQL database) and any files stored on the mounted volumes (var, pub/media, app/etc). The snapshot does not include code, since the code is already stored in the Git-based repository. You cannot download a copy of a snapshot.
The snapshots feature does not apply to the Pro Staging and Production environments. The Pro Staging and Production environments receive regular backups for disaster recovery purposes by default, see Pro Backup & Disaster Recovery. Unlike the automatic live backups on the Pro Staging and Production environments, snapshots are not automatic. It is your responsibility to manually create a snapshot or set up a cron job to periodically take snapshots of your Starter or Pro Integration environments.
You must have an Admin role for the environment.
To create a snapshot using the Project Web Interface:
To create a snapshot using the magento-cloud
CLI:
On your local workstation, change to your project directory.
Check out the environment branch to snapshot.
Create the snapshot.
magento-cloud snapshot:create --live
Alternatively, you can use the magento-cloud backup
short command. The --live
option leaves the environment running to avoid downtime. For a full list of options, enter magento-cloud snapshot:create --help
.
Sample response:
Creating a snapshot of develop-branch
Waiting for the activity ID (User created a backup of develop-branch):
Creating backup of develop-branch
Created backup my-snapshot
[============================] 45 secs (complete)
Activity ID succeeded
Snapshot name: my-snapshot
Verify the most recent snapshots.
magento-cloud snapshot:list
The list returns information about the snapshot status:
Snapshots on the project (project-id), environment develop-branch (type: development):
+---------------------------+----------------------+------------+
| Created | Snapshot ID | Restorable |
+---------------------------+----------------------+------------+
| 2023-03-08T17:07:01+00:00 | my-snapshot | true |
+---------------------------+----------------------+------------+
You must have Admin access to the environment. You have up to seven days to restore a snapshot. Restoring a snapshot does not change the code of the current git branch. Restoring a snapshot in this manner does not apply to Pro staging and production environments; see Pro Backup & Disaster Recovery.
Restoration times vary depending on the size of your database:
Restoring without a snapshot:
To restore a snapshot using the Project Web Interface:
To restore a snapshot using the Cloud CLI:
On your local workstation, change to your project directory.
Check out the environment branch to restore.
List all available snapshots.
magento-cloud snapshot:list
The list returns information about the available snapshots:
Snapshots on the project (project-id), environment develop-branch (type: development):
+---------------------------+----------------------+------------+
| Created | Snapshot ID | Restorable |
+---------------------------+----------------------+------------+
| 2023-03-08T17:07:01+00:00 | my-snapshot | true |
+---------------------------+----------------------+------------+
Restore a snapshot using the snapshot ID from the list.
magento-cloud snapshot:restore <snapshot-id>
Snapshots do not include a copy of your code. Your code is already stored in the Git-based repository, so you can use Git-based commands to roll back (or revert) code. For example, use git log --oneline
to scroll through previous commits; then use git revert
to restore code from a specific commit.
Also, you can choose to store code in an inactive branch. Use git commands to create a branch instead of using magento-cloud
commands. See about Git commands in the Cloud CLI topic.