# Backup and Restore of cloud DQL database

**URL:** <https://discuss.dgraph.io/t/backup-and-restore-of-cloud-dql-database/16208>\
**Category:** Dgraph Cloud\
**Tags:** backup-and-restore, cloud\
**Created:** [December 2, 2021, 12:57am UTC](https://discuss.dgraph.io/t/backup-and-restore-of-cloud-dql-database/16208 "2021-12-02T00:57:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![duyker](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/duyker/32/7631_2.png) [@duyker](https://discuss.dgraph.io/u/duyker)\
**Post date:** [December 2, 2021, 12:57am UTC](https://discuss.dgraph.io/t/backup-and-restore-of-cloud-dql-database/16208/1 "2021-12-02T00:57:27Z")

</div>

## Background

I am using a dedicated cloud instance with DQL database/schema because I need to use facets.

## Goal

- Use a script to backup production database from command line (or download existing backup?)
- Use the backup that has been downloaded to run on local version of dgraph docker for development

## Whats not working

I can’t seem to work out the first step of backup/download

## What I have tried

I have been struggling with the cloud documentation, but after jumping between [Backup - Cloud API](https://dgraph.io/docs/cloud/cloud-api/backup/) and [Importing and Exporting data from Dgraph Cloud](https://dgraph.io/docs/cloud/admin/import-export/) I worked out the below commands.

But the issue is that they run… but don’t seem to do anything (I am assuming that `signedUrls` should have values in it?).

Any help with this would be great.

```auto
# create backup - REQ

curl 'https://<some-url>/admin/slash' \
  -H 'X-Auth-Token: <admin_token_from_ui>' \
  -H 'Content-Type: application/graphql' \
  --data-binary 'mutation {
  export {
    response { code message }
    exportId
    taskId
  }
}'

# create backup - RES

{
  "data": {
    "export": {
      "exportId": "exports/2021-12-02/0x26d673b-1006229647",
      "response": {
        "code": "Success",
        "message": "Export queued with ID 0x1bd686d8f"
      },
      "taskId": "0x1bd686d8f"
    }
  }
}

# check status of backup - REQ

curl 'https://<some-url>/admin/slash' \
  -H 'X-Auth-Token: <admin_token_from_ui>' \
  -H 'Content-Type: application/graphql' \
  --data-binary 'query {
  exportStatus (
    exportId:"0x1bd686d8f"
    taskId: "0x1bd686d8f"
  ){
    kind
    lastUpdated
    signedUrls
    status
  }
}'

# check status of backup - RES

{
  "data": {
    "exportStatus": {
      "kind": "Export",
      "lastUpdated": "2021-12-02T00:26:42Z",
      "signedUrls": [],
      "status": "Success"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![dmai](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/dmai/32/1254_2.png) [@dmai](https://discuss.dgraph.io/u/dmai)\
**Post date:** [December 2, 2021, 1:52am UTC](https://discuss.dgraph.io/t/backup-and-restore-of-cloud-dql-database/16208/2 "2021-12-02T01:52:25Z")

</div>

In your `exportStatus` query, the `exportId` argument should be `"exports/2021-12-02/0x26d673b-1006229647"`:

```auto
query ExportStatus {
  exportStatus(
    exportId: "exports/2021-12-02/0x26d673b-1006229647",
    taskId: "0x1bd686d8f"
  ) {
    kind
    lastUpdated
    signedUrls
    status
  }
}

```

---

<div class="post-metadata">

**Author:** ![duyker](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/duyker/32/7631_2.png) [@duyker](https://discuss.dgraph.io/u/duyker)\
**Post date:** [December 2, 2021, 2:25am UTC](https://discuss.dgraph.io/t/backup-and-restore-of-cloud-dql-database/16208/3 "2021-12-02T02:25:01Z")

</div>

> [@duyker](#):
>
> `"exports/2021-12-02/0x26d673b-1006229647"`

thanks so much, a typo 🙃 😭
