Adding a Cognito user to a Group automatically on signup

Is the easiest way to add a cognito user to a group, automatically, on sign up to have a lambda trigger on “Post Authentication Trigger”? All users will be sent into a group called “Public”. Even though it seems dumb to add all users to a default group, I need that group to enable authentication strategies in other areas of AWS that require a cognito group to determine access levels. Can I specify a group in the Sign Up request instead?


Related discussions:

I don’t think you can specify it, couldn’t find an option myself. I ended up using the post Auth hook for it. Make sure you check if the user is already in the group first, to not add it at every login

Is Post Auth better than Post Confirmation?

That way you don’t call it every login, just on sign up:

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html

Sorry, “postConfirmation”. Got confused because I’m having one in “pre Auth” (another mistake there) as well because at the moment we use our old API in combination with cognito and if some role changes there I need it updated in cognito as well, until we move everything to cognito. That’s why I needed it checked and I mentioned it.

Thanks for the insight! That’s what I’ll go with