Skip to main content

AWS Cognito

With this integration you can engage customers with flexible authentication, manage B2B identities, secure machine-to-machine authentication or get role-based access to AWS resources.


Credential configuration

To configure this credential, you need the Access key ID and the Secret Access Key of the Programatic Access user you want to use. Ensure that this user has the necessary permissions to access Lambda for proper funtionality. If you need to create the user, follow the instructions provided here.

In the extra options field, you can include any additional parameters found here.

Here is an example of a filled credential configuration form in YepCode:

AWS Lambda snippets available in YepCode editor


The title is the triggering text for YepCode to autocomplete the script.


New integration from credential
const awsCognitoClient = yepcode.integration.awsCognito("credential-slug");
New integration from plain authentication data
const { CognitoIdentityProviderClient } = require("@aws-sdk/client-cognito-identity-provider");

const awsCognitoClient = new CognitoIdentityProviderClient({
credentials: {
accessKeyId: "accessKeyId",
secretAccessKey: "secretAccessKey",

Create Identify Provider

Create identify provider
const { CreateIdentityProviderCommand } = require('@aws-sdk/client-cognito-identity-provider)
const input = {
UserPoolId: userPoolId,
ProviderName: providerName,
ProviderType: providerType,
ProviderDetails: {
keys: providerDetails,
const command = new CreateIdentityProviderCommand(input);
const response = await awsCognitoClient.send(command);

Create User Pool

Create user pool
const { CreateUserPoolCommand } = require("@aws-sdk/client-cognito-identity-provider");

const input = {
PoolName: poolName
LambdaConfig: {
CustomSMSSender: {
LambdaVersion: lambdaVersion,
LambdaArn: lambdaArn,
CustomEmailSender: {
LambdaVersion: lambdaVersion,
LambdaArn: lambdaArn,
SmsConfiguration: {
SnsCallerArn: snsCallerArn,
UsernameConfiguration: {
CaseSensitive: caseSensitive,
AccountRecoverySetting: {
RecoveryMechanisms: [
Priority: Number(recoveryMechanismsPriority),
Name: recoveryMechanismsName,
const command = new CreateUserPoolCommand(input);
const response = await awsCognitoClient.send(command);

List Identity Providers

List identify providers
const { ListIdentityProvidersCommand } = require("@aws-sdk/client-cognito-identity-provider");
const input = {
UserPoolId: userPoolId
const command = new ListIdentityProvidersCommand(input);
const response = await awsCognitoClient.send(command);
for(const provider of response.Providers) {