1

For the last few years, I've built a PHP and MySQL based website where users can submit reprographics and IT requests. I'm hoping to make this cloud-based rather than running it from a local webserver. My initial idea was to have an EC2 instance running as a web server for each company which uses my system, but as the system is PHP session based I'm assuming the security would not be great so I think I need to move towards more of an AWS system using Cognito for user management and the API Gateway with Lambda to do the job of getting the data from the databases. My question is, my current system has an admin console where the admin user can access the lists of users, and assign them permissions (session variables) which allows them access to specific pages. How would I make a webpage where users can manage the users in a Cognito user pool without giving them access to the AWS console.

2
  • Have you considered using CLI and invoking AWS Cognito API's such as update-user-pool? As long as your designated users have access to CLI. Commented Oct 9, 2019 at 8:49
  • I haven't, what I want to make is a user management portal where the company's system administrator can go in and view all users (probably based on a custom attribute so I can use one user pool for all my customer's accounts) and add them to groups etc to give them permissions to different sections of the system, as well as create new users obviously.
    – Matt M
    Commented Oct 9, 2019 at 10:24

1 Answer 1

2

Implement a Cognito AdminAddUserToGroup operation in your Lambda function for admin users to manage what Cognito Groups your users belong to. Your admins will be the only ones that are able to invoke the API call to the Lambda function because they'll be included in the Cognito Admin Group with appropriate permissions to invoke the Lambda function that you specified as the developer.

Specify permissions of what each Congito Group has access to by assigning roles for each Cognito Group.

You can also decode the jwt on the backend to determine what Cognito Group the user belongs to that made the request and use Amplify on the FrontEnd to manage the FrontEnd's display of content based on the Group (links, etc). More info about that can be found in this thread: How do I access the group for a Cognito User account?

I do not have enough points to comment on the CLI update-user-pool suggestion, but wanted you to know that wouldn't work because 1.) It would impact the entire user pool and affect ALL users in the user pool and 2.) It would make no difference in regards to what your users were able to have permission to access in your application.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.