Navigation

mongocli atlas backup restore start

The backup restore start command restores a deployment using the snapshot or point in time of a cluster. You can also restore a deployment using the Atlas UI or API.

mongocli atlas backup restore start <restore-job-type>
--clusterName <cluster-name>
[ --output|-o <output-format> ]
[ --oplogInc <oplog-Inc> ]
[ --oplogTs <oplog-timestamp> ]
[ --pointInTimeUTCMillis <pointInTime-UTC-ms> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]
--snapshotId <snapshot-ID>
[ --targetClusterName <cluster-name> ]
[ --targetProjectId <project-ID> ]
Note

Use -h or --help to view the command-line help for this command.

Warning

If you create an automated or pointInTime restore job, Atlas removes all existing data on the target cluster prior to the restore.

Specify the type of restore job with one of the following arguments:

Argument
Description
automated
Atlas restores the snapshot corresponding to snapshotId to the Atlas cluster and project specified by targetClusterId and targetGroupId.
pointInTime
download

Atlas generates and displays a URL to download a .tar.gz of the snapshot corresponding to the snapshotId. The contents of the tar.gz archive contain the data files for your Atlas cluster.

Tip
See also:

To learn more about manually restoring the downloaded data files, see Manual Restore One Snapshot.

Note
Download Limitations

Each cloud backup can have one download at a time, and each project can have a maximum of 20 downloads at a time.

The options required by or available for the command depend on the type of restore job:

Option
Type
Description
Required?
--clusterName
string
Name of the cluster that the job represents.
yes
--profile, -P
string
Name of the profile where the project ID and the Programmatic API Keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.
no
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

If omitted, the command returns output in the default format.

no
--projectId
string

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.

no
--snapshotId
string
Unique identifier of the snapshot to use for restore.
yes
--targetClusterId
string
Unique identifier of the target cluster to restore.
yes
--targetProjectId
string
Unique identifier of the project that contains the destination cluster for the restore job
yes

The command prints the following fields in the specified format to the terminal if the command succeeds. If the command returns an error, see Troubleshooting for recommended solutions.

Name
Type
Description
cancelled
boolean
Flag indicating whether the restore job was canceled.
createdAt
string
Timestamp in ISO 8601 date and time format in UTC when Atlas created the restore job.
deliveryType
string
Type of restore job to create.
expired
boolean
Flag indicating whether the restore job expired.
expiresAt
integer
Timestamp in ISO 8601 date and time format in UTC when the restore job expires.
finishedAt
integer
Timestamp in ISO 8601 date and time format in UTC when the restore job completed.
id
string
Unique identifier of the restore job.
links
array of objects

One or more links to sub-resources and/or related resources.

snapshotId
string
Unique identifier of the source snapshot ID of the restore job.
target
GroupId
string
Name of the target Atlas project of the restore job.
target
ClusterName
string
Name of the target Atlas cluster to which the restore job restores the snapshot.
timestamp
string
Timestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.

The following example uses the mongocli atlas backup restore start automated command to restore a deployment. The command uses the default profile where the project ID and the Programmatic API Keys for the source cluster are stored.

mongocli atlas backup restore start automated \
--clusterName myDemo \
--snapshotId 5e7e00128f8ce03996a47179 \
--targetClusterId 5e2f56937a3e5a26326a5ee8 \
--targetProjectId 1a2345b67c8e9a12f3456de7 \
--output json

The previous command prints the following fields to the terminal. To learn more about these fields, see Output.

{
"cancelled": false,
"deliveryType": "automated",
"expired": false,
"expiresAt": "2020-05-04T16:25:01Z",
"id": "5e7e207f6b77fc028bee5e2d",
"links": [
{
"href": "https://example.mongodb.com/api/atlas/v1.0/groups/5e3f04ecf10fab66c7d4072d/clusters/myCluster/backup/restoreJobs/5e7e207f6b77fc028bee5e2d",
"rel": "self"
},
{
"href": "https://example.mongodb.com/api/atlas/v1.0/groups/5e3f04ecf10fab66c7d4072d/clusters/myCluster/backup/snapshots/5e7e00128f8ce03996a47179",
"rel": "http://example.mongodb.com/snapshot"
},
{
"href": "https://example.mongodb.com/api/atlas/v1.0/groups/5e3f04ecf10fab66c7d4072d/clusters/myCluster",
"rel": "http://example.mongodb.com/cluster"
},
{
"href": "https://example.mongodb.com/api/atlas/v1.0/groups/5e3f04ecf10fab66c7d4072d",
"rel": "http://example.mongodb.com/group"
}
],
"snapshotId": "5e7e00128f8ce03996a47179",
"targetClusterName": "Cluster1",
"targetGroupId": "1a2345b67c8e9a12f3456de7",
"timestamp": "2020-05-03T16:25:01Z"
}
Give Feedback