sample Lambda for Cognito triggers Lambda

» Node.js

const AWS = require('aws-sdk');
const cognitoIdentityServiceProvider = new AWS.CognitoIdentityServiceProvider({ region: process.env.region });

exports.handler = async (event, context) => {
  const getUserParams = {
    UserPoolId: process.env.userPoolID,
    Username: event.request.userAttributes['email'] 
  const userData = await cognitoIdentityServiceProvider.adminGetUser(getUserParams).promise();
  return event

» Python

import os
import boto3

region = os.environ['region']
user_pool_id = os.environ['userPoolID']

cognito_identity_service_provider = boto3.client('cognito-idp', region_name=region)

def lambda_handler(event, context):
    get_user_params = {
        'UserPoolId': user_pool_id,
        'Username': event['request']['userAttributes']['email']
    user_data = cognito_identity_service_provider.admin_get_user(**get_user_params)
    return event

Note: You can get other attribute like phone number by changing 'email' to 'phone_number'.

get specified user by email cognito get client id from user pool id cognito Update specific user attributes Cognito
You need to login to do this manipulation!