Amazon Cognito user invite


Hi Guys, I am trying to send invite email to a user with a link that user can click and enter password so that I can create user. Do I need to use Lambda for this? Any documentation will be helpful

asked 23 days ago29 views
1 Answer


You can create a new user the specified user pool through the Amazon Cognito API's. Refer here for the API details :

If you are using the AWS SDK, then the guidance on how to do this is here: (This is JS, you can browse for the SDK for the programming language of your choice)

For Lambda, as you've mentioned above, if you want to create an user - then the sample is as provided below,

const AWS = require('aws-sdk');

const userPoolId = 'YOUR_USER_POOL_ID';
const clientId = 'YOUR_APP_CLIENT_ID';
const region = 'YOUR_REGION';

const cognito = new AWS.CognitoIdentityServiceProvider({ region });

const params = {
  UserPoolId: userPoolId,
  Username: 'NEW_USER_USERNAME',
  DesiredDeliveryMediums: ['EMAIL'],
  UserAttributes: [
      Name: 'email',
      Value: 'NEW_USER_EMAIL',
      Name: 'name',
      Value: 'NEW_USER_NAME',
      Name: 'custom_attribute',
      Value: 'CUSTOM_VALUE',
  TemporaryPassword: 'TEMP_PASSWORD',
  MessageAction: 'SUPPRESS',

cognito.adminCreateUser(params, (err, data) => {
  if (err) {
    console.log(err, err.stack);
  } else {

Please refer and create the user pools and the necessary user attribute settings

Hope this helps

answered 22 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions