Check & Fetch the user if exists

233 Views Asked by At

When using AWS Appstream API, How do we check if a username(email) exists? And on a similar note how do we fetch that user by username?

I tried searching here on the official docs and while there are methods for creation, deletion, enabling, disabling users but there seems to be no specific method provided to fetch a user from the user pool.

1

There are 1 best solutions below

0
On BEST ANSWER

Update: As of now we have a DescribeUsers method, but again this is for fetching all (filterable) users but still we shall have to process all of the results to confirm a user is present or not.

==================================================

For the time being it seems the only band-aid solution is to fire a createUser() request with that username and look for the exception named ResourceAlreadyExistsException. But for all intents and purposes this feels tacky.

So for want of better alternative this is the solution, once we have something better, I'll mark that answer as selected, or maybe even update this answer if I get it before others.