We are well down the path of implementing a solution that is built around Cognito as the identity provider. No one looked at the ability to recover the information stored Cognito, and apparently there isn’t any mechanism available to do so? WTH, Amazon?
I did find a reference architecture that partially covers how to build something to handle this, but it does not support MFA enabled pools, which is a hard requirement for us.
Was wondering how you all are handling this. Did you have to write something in-house to handle exporting user profiles? We do have a developer working full time on our project, but this would be out of his scope, and would be a significant curve for me to write something myself, I’m hoping I won’t have to McGyver something out of paperclips and bubble gum.
Some people argue that AWS already handles DR scenarios with cognito user pool data. That obviously leaves a giant accidental deletion or overwrite shaped hole in the backup strategy.
I’m not exactly sure how code gives control over to Cognito, but maybe you could create a duplicate entry for a user in another authentication service after a successful response from Cognito. Depending on what the code looks like the flow could be: user enters credentials → application authenticates with Cognito → if successful response from Cognito, create account with third part auth service.
I’m not sure how many authentication providers offer this, but the one I use gives the option of a self hosted database. Might help alleviate some of this complexity in the future.
I don’t think I’m exactly following you here, but I’m assuming you’re talking about passwords? AWS doesn’t give a way to back all your basic data up because frankly it’s a garbage product. And they don’t give ways to backup passwords specifically because yes, that would be a security concern.
Agree, we backup users so at least if worst happens we can restore and force a password reset to re-enable them - but this is one of a number of Cognito maturity limitations which means I can only recommend avoiding it for now unless you’re building a quick product proof of concept (ie something that’s built to prove business value but which would be redesigned and built from the ground up if it ever was to make it to production)
Sounds familiar! From an operations perspective, we also found Cognito to be a big of a black box when it came to observability, perhaps it’s improved in a year since i last looked, but the CloudWatch metrics/logs were severely lacking for an apparently enterprise-grade solution - everything else in our stack had all key metrics closely monitored, however we found we had to deduce the result of calls to Cognito using our application logs instead of Cognito itself (“our app responded 403 to /login? Maybe a failed login attempt” instead of " Cognito logs and metrics pointed out a brief uptick in failed logins. This specific account was the target"
Please excuse the spelling/formatting, typing on my phone…
yeah. In our pool it is enabled but set as optional, and a lot of our users utilize it.
However… When I look at the backup’s export, the resulting data doesn’t save any of the MFA info. Like, it would probably have to be reconfigured per-user in the event of a rebuild.
If you want to see an example of the output this script spits out, here is a redacted user from the file that it creates:
Ooo… Cognito… I’ve been working with this tragedy since 2017, and here are some things that I learned over the years, talking to AWS, fixing their SDK, and having multi year discussion on GitHub.
To backup you users, you just have to store their emails in a database when they sing in, this way if the Cognito DB disappears for whatever reason, you can write a script that will reset their password to a default one, and email them the new temporary password - I’m not joking, this is the AWS logic here at work.
Same with MFA, you loop over all the accounts, disable the feature as an admin, and the user can setup the MFA again - again, not joking, AWS logic.
Not to mention, that for the user to disable MFA, no re-verification is needed at all, you just have to have an active session.
What would be some good alternatives if we wanted to stick with Cognito for identity pool? We aren’t ever going to federate with Facebook, Google, etc, and don’t want to resort to using any of our on-prem ID providers.
We don’t need fancy, but we do need a secure product that supports TOTP via text and email and we need to be able back up our configuration.
Auth0 data backup is at the same level as Cognito.
Auth0 offers an endpoint named “users-exports”. The Cognito equivalent is Cognito.ListUsers in your choice of API library.
Neither one provides hashes or MFA tokens, so you’re going to be sending out mass password reset emails if your Auth-as-a-Service dies for some reason.
Hmmm. Without getting into too many details, I’ll just tell you some high level points.
As an IAM solution, it is very often necessary to scale out the backend features (like user attributes, more groups, etc) as your business grows. Cognito is famously awful for not allowing many changes to your user pools unless you wipe and rebuild the whole thing, which would at best require you to rebuild all your users’ MFA and reset their passwords.
Their MFA implementation has a ton of quirks and oddities you have to work around.
OP mentioned the reference architecture, which essentially shows by itself how much hacky infrastructure is required for some basic functionality other auth providers have out of the box.
The amount of work you have to whip up yourself just for it to support multiple regions is a nightmare. At that point, you might as well host your own solution.
Let’s talk about OAuth. Only three grants are supported (two if you disregard the one with glaring security holes) and even then, they are awfully implemented and missing a lot of features. Want to use a lambda with Client Credentials? Haha, sucks for you. Essentially, they had to create the ability for customers to intercept every step of the flow and lfiecycle processes with lambdas because that was the only way to get some basic features implemented in the first place.
Federated identities that use read-only mapped attributes do not work with the default configuration of Cognito. So if you followed AWS’s instructions like a good devops engineer, then you’ll have to make a change to the user pool. No big deal right? Wrong, you have to wipe the whole damned thing and start from scratch
Cognito is my most critical infrastructure I support because I can’t properly back it up, I can barely change it, I can’t easily make it resistant to region downtime, I can’t optimize for different geographic locations, and all of my customers’ data is stored on it.
I have a special bottle of scotch in the cabinet I’m saving for the day we toss this headache to the curb.