<p>Amazon has released a <a href="https://docs.aws.amazon.com/solutions/latest/cognito-user-profiles-export-reference-architecture/welcome.html" rel="nofollow noreferrer">Cognito User Profiles Export Reference Architecture</a> for exporting/importing users from a user pool. There are <a href="https://docs.aws.amazon.com/solutions/latest/cognito-user-profiles-export-reference-architecture/solution-components.html" rel="nofollow noreferrer">limitations</a>:</p>
<ul>
<li>Passwords not backed up; users will need to reset</li>
<li>Pools using MFA are not supported</li>
<li>Cognito sub attributes will be new, so if the system depends on them, they need to be copied to a custom user attribute</li>
<li>Federated users also pose challenges wrt sub</li>
<li>Advanced security - no user history is exported</li>
<li>No support for pools that allow the option of either phone or email usernames</li>
<li>No support for tracked devices</li>
</ul>

CC BY-SA 4.0
2020-10-15T18:29:27.803Z
2020-10-15T18:29:27.803Z
ggriffin
<p>As said in other answers, there are two main packages used for this purpose.</p>
<ul>
<li><a href="https://www.npmjs.com/package/cognito-backup-restore" rel="nofollow noreferrer">cognito-backup-restore</a></li>
<li><a href="https://www.npmjs.com/package/cognito-backup" rel="nofollow noreferrer">cognito-backup</a></li>
</ul>
<p>None of them seems to have maintainance at this time, but I recommend to use the first one as it has more functionalities implemented. It allows to use the cli and to import the npm package to be used in your own code.</p>
<p>One thing to have in mind is that both of them only allow to export users from a UserPool, but don't allow to export groups. In the case of <a href="https://www.npmjs.com/package/cognito-backup-restore" rel="nofollow noreferrer">cognito-backup-restore</a>, there is an <a href="https://github.com/rahulpsd18/cognito-backup-restore/issues/10" rel="nofollow noreferrer">issue open</a> and a <a href="https://github.com/rahulpsd18/cognito-backup-restore/pull/37" rel="nofollow noreferrer">pull request</a> with changes that implements that functionality, but it is not merged.</p>

CC BY-SA 4.0
2022-02-12T08:41:19.633Z
2022-02-12T13:40:57.430Z
2022-02-12T13:40:57.430Z
Gigi_men
<p>To backup Cognito, we use AWS Glue.</p>

CC BY-SA 4.0
2020-09-10T07:22:25.387Z
Hi, could you please provide a bit more context to your answer? What is AWS Glue, why should it be used here, etc? Perhaps some links to the documentation? thanks
Bruce Becker
CC BY-SA 4.0
2020-09-09T20:17:05.123Z
2020-09-09T20:17:05.123Z
Tony Vickers
<p>The Amazon Cognito streams feature can be used to backup data.</p>

<p>Currently, Amazon does not provide a solution to backup their Cognito user Pools. You can use the following NPM package called "<strong>cognito-backup</strong>":</p>

<h2>Install:</h2>

<pre><code>npm install -g cognito-backup
</code></pre>

<h2>Usage</h2>

<pre><code>cognito-backup backup-users &lt;user-pool-id&gt; &lt;options&gt;  Backup all users in a single user pool
cognito-backup backup-all-users &lt;options&gt;  Backup all users in all user pools for this account
</code></pre>

<h2>Examples</h2>

<pre><code>cognito-backup backup-users eu-west-1_1_12345
cognito-backup backup-users eu-west-1_1_12345 --region eu-west-1 --file mypool.json
cognito-backup backup-all-users eu-west-1_1_12345 --region eu-west-1 --dir output
</code></pre>

<p>Source: <a href="https://www.npmjs.com/package/cognito-backup" rel="noreferrer">https://www.npmjs.com/package/cognito-backup</a></p>

CC BY-SA 3.0
2018-03-11T23:52:59.507Z
Just a word of warning... Read to the bottom of those docs before you start using cognito-backup: "Todo: Implement restore".  LOL
Chris Jaynes
CC BY-SA 4.0
2018-10-17T01:26:09.527Z
Ability to restore the json file is already available: `cognito-backup restore-users eu-west-1_12345 Abcd.1234 --file eu-west-1_12345.json`
schystz
CC BY-SA 4.0
2021-03-23T06:47:10.103Z
You can also pass --profile (which isn't in the documentation) to specify which account to back up.
tschumann
CC BY-SA 4.0
2018-12-14T18:32:09.133Z
The passwords won't be in the backup, so I suppose the restore will require all the users to reset their password.
benji
CC BY-SA 3.0
2017-04-16T09:15:52.640Z
2017-12-16T09:10:44.713Z
2017-12-16T09:10:44.713Z
Kyle Steenkamp
<p><a href="https://aws.amazon.com/cognito/" rel="noreferrer">Amazon Cognito</a> is a user management and authentication service provided by Amazon through Amazon Web Services:</p>

<blockquote>
  <p>Amazon Cognito lets you easily add user sign-up and sign-in to your mobile and web apps. With Amazon Cognito, you also have the options to authenticate users through social identity providers such as Facebook, Twitter, or Amazon, with SAML identity solutions, or by using your own identity system. In addition, Amazon Cognito enables you to save data locally on users devices, allowing your applications to work even when the devices are offline. You can then synchronise data across users devices so that their app experience remains consistent regardless of the device they use.</p>
</blockquote>

<p>What you are effectively doing is storing your customer data in a closed system hosted by Amazon.  If you are a company, such as a social network, who's data represents a significant asset within your organisation how to you ensure that this data is protected from:</p>

<ul>
<li>Amazon Cognito being shut down unexpectedly, i.e. at request from a law enforcement or government agency.</li>
<li>Your access keys being compromised and some or all records being corrupted.</li>
<li>The relationship between your organisation and Amazon breaking down to the point Amazon withdraws all services with immediate effect.</li>
</ul>

<p>Amazon Cognito is a huge benefit to organisations and developers as it takes a particularly hard piece of software and makes it easy to implement; from a service operability perspective, we need to find ways to mitigate, remediate or accept risks to the companies assets at all times.</p>

CC BY-SA 3.0
2017-04-13T09:01:14.367Z
From a quick look to doc, I'd go with [cognito streams](http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-streams.html) to get a redshift backup usable elsewhere.
Tensibai
<amazon-web-services>
How to backup Amazon Cognito?
Richard Slater
# How to backup Amazon Cognito?

(Asked by: username_0 on 2017-04-12)

[Amazon Cognito](https://aws.amazon.com/cognito/) is a user management and authentication service provided by Amazon through Amazon Web Services:

> Amazon Cognito lets you easily add user sign-up and sign-in to your mobile and web apps. With Amazon Cognito, you also have the options to authenticate users through social identity providers such as Facebook, Twitter, or Amazon, with SAML identity solutions, or by using your own identity system. In addition, Amazon Cognito enables you to save data locally on users devices, allowing your applications to work even when the devices are offline. You can then synchronise data across users devices so that their app experience remains consistent regardless of the device they use.

What you are effectively doing is storing your customer data in a closed system hosted by Amazon. If you are a company, such as a social network, who's data represents a significant asset within your organisation how to you ensure that this data is protected from:

* Amazon Cognito being shut down unexpectedly, i.e. at request from a law enforcement or government agency.
* Your access keys being compromised and some or all records being corrupted.
* The relationship between your organisation and Amazon breaking down to the point Amazon withdraws all services with immediate effect.

Amazon Cognito is a huge benefit to organisations and developers as it takes a particularly hard piece of software and makes it easy to implement; from a service operability perspective, we need to find ways to mitigate, remediate or accept risks to the companies assets at all times.

**Tags:** amazon-web-services

> **Comments:**
> **username_1**: From a quick look to doc, I'd go with [cognito streams](http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-streams.html) to get a redshift backup usable elsewhere.  

---

## 4 answers

### Answer by username_6 on 2017-04-16. Score: 12 | Accepted answer

The Amazon Cognito streams feature can be used to backup data.
Currently, Amazon does not provide a solution to backup their Cognito user Pools. You can use the following NPM package called "cognito-backup":
Install:
npm install -g cognito-backup

Usage
cognito-backup backup-users    Backup all users in a single user pool
cognito-backup backup-all-users   Backup all users in all user pools for this account

Examples
cognito-backup backup-users eu-west-1_1_12345
cognito-backup backup-users eu-west-1_1_12345 --region eu-west-1 --file mypool.json
cognito-backup backup-all-users eu-west-1_1_12345 --region eu-west-1 --dir output

Source: https://www.npmjs.com/package/cognito-backup

> **Comments:**
> **username_7**: Just a word of warning... Read to the bottom of those docs before you start using cognito-backup: "Todo: Implement restore".  LOL  
> **username_8**: Ability to restore the json file is already available: `cognito-backup restore-users eu-west-1_12345 Abcd.1234 --file eu-west-1_12345.json`  
> **username_10**: The passwords won't be in the backup, so I suppose the restore will require all the users to reset their password.  
> **username_9**: You can also pass --profile (which isn't in the documentation) to specify which account to back up.  

---

### Answer by username_2 on 2020-10-15. Score: 1

Amazon has released a [Cognito User Profiles Export Reference Architecture](https://docs.aws.amazon.com/solutions/latest/cognito-user-profiles-export-reference-architecture/welcome.html) for exporting/importing users from a user pool. There are [limitations](https://docs.aws.amazon.com/solutions/latest/cognito-user-profiles-export-reference-architecture/solution-components.html):

* Passwords not backed up; users will need to reset
* Pools using MFA are not supported
* Cognito sub attributes will be new, so if the system depends on them, they need to be copied to a custom user attribute
* Federated users also pose challenges wrt sub
* Advanced security - no user history is exported
* No support for pools that allow the option of either phone or email usernames
* No support for tracked devices


---

### Answer by username_3 on 2022-02-12. Score: 0

As said in other answers, there are two main packages used for this purpose.

* [cognito-backup-restore](https://www.npmjs.com/package/cognito-backup-restore)
* [cognito-backup](https://www.npmjs.com/package/cognito-backup)

None of them seems to have maintainance at this time, but I recommend to use the first one as it has more functionalities implemented. It allows to use the cli and to import the npm package to be used in your own code.

One thing to have in mind is that both of them only allow to export users from a UserPool, but don't allow to export groups. In the case of [cognito-backup-restore](https://www.npmjs.com/package/cognito-backup-restore), there is an [issue open](https://github.com/rahulpsd18/cognito-backup-restore/issues/10) and a [pull request](https://github.com/rahulpsd18/cognito-backup-restore/pull/37) with changes that implements that functionality, but it is not merged.


---

### Answer by username_4 on 2020-09-09. Score: 0

To backup Cognito, we use AWS Glue.

> **Comments:**
> **username_5**: Hi, could you please provide a bit more context to your answer? What is AWS Glue, why should it be used here, etc? Perhaps some links to the documentation? thanks  

---

