Skip to main content

AWS Cognito ExecModule

Overview

AwsCognitoModule brings governed Amazon Cognito user-pool administration into ValkyrAI workflows. It covers the user, group, membership, and user-pool operations in n8n's AWS Cognito node while adding verified IntegrationAccount enforcement, exact region and pool scoping, bounded attributes and pagination, read-only retry, single-attempt mutations, explicit permanent-delete confirmation, normalized output, credential redaction, and annotation-backed Workflow Studio discovery.

The connector implements thirteen operations:

  • list_groups, get_group, create_group, update_group, and confirmed delete_group.
  • list_users, get_user, create_user, update_user, and confirmed delete_user.
  • add_user_to_group and remove_user_from_group.
  • get_user_pool for reviewed pool discovery.

The module operates only on an existing user pool. It does not create pools, configure hosted UI domains, issue tokens, authenticate end users, manage app clients, reset passwords, or change MFA and security policy.

Usage

  1. Create a dedicated AWS IAM principal restricted to the exact Cognito user pool and operations the workflow needs.
  2. Store its access key ID and secret access key in an AWS IntegrationAccount, verify the account, and keep it in READY status.
  3. Add AwsCognitoModule to a workflow and bind the account through ExecModuleConfig.authConfig.integrationAccount.
  4. Select an exact AWS region and a userPoolId beginning with that region.
  5. Supply username, groupName, attributes, or pagination fields only when the chosen operation accepts them.
  6. Require human or policy review before identity creation, attribute changes, membership changes, or deletion.

Never place AWS credentials, end-user passwords, access tokens, ID tokens, refresh tokens, client secrets, or session tokens in module input. Credential-like input fields are rejected before provider access. A temporary password can be supplied only to create_user; it is not returned or logged.

Inputs

NameTypeRequired forDefaultConstraints
operationstringEvery executionNoneOne of the thirteen documented operations.
regionstringEvery executionNoneAWS region such as us-west-2; custom endpoints are not accepted.
userPoolIdstringEvery executionNoneCognito pool syntax such as us-west-2_example123; the prefix must match region.
usernamestringUser and membership operationsNoneNon-blank, no whitespace/control characters, at most 128 characters.
groupNamestringGroup and membership operationsNoneNon-blank, no whitespace/control characters, at most 128 characters.
attributesobjectRequired for update_user; optional for create_user{}One to 50 flat string pairs; names at most 64 and values at most 2,048 characters.
temporaryPasswordstringOptional for create_userCognito policyAt most 256 characters; never returned.
suppressMessagebooleanOptional for create_userfalseWhen true, asks Cognito not to send its invitation message.
forceAliasCreationbooleanOptional for create_userfalseCan move a verified email/phone alias under Cognito rules; review carefully.
filterstringOptional for list_usersNoneOne Cognito filter expression, at most 256 characters.
paginationTokenstringOptional for list operationsNoneOpaque token, at most 2,048 characters; use only with unchanged list criteria.
maxResultsintegerOptional for list operations60From 1 through 60. The connector returns one provider page per execution.
descriptionstringOptional for group create/updateNoneAt most 2,048 characters.
precedenceintegerOptional for group create/updateNoneFrom 0 through 1,000.
roleArnstringOptional for group create/updateNoneIAM role ARN for the Cognito group.
confirmbooleandelete_user, delete_groupfalseMust be exactly true before permanent deletion.

Operation-specific fields fail closed. For example, filter is rejected outside list_users, pagination fields are rejected outside list operations, attributes are rejected outside user create/update, and group configuration is rejected outside group create/update.

Outputs

Every execution returns stable status, operation, and attempts fields.

NameTypeWhen presentDescription
statusstringAlwayssuccess or error.
operationstringAlwaysNormalized operation.
attemptsintegerAlwaysProvider calls. Reads use at most three; mutations use exactly one.
resultTypestringSuccessusers, user, groups, group, userPool, membership, or mutation.
itemsarrayList successBounded normalized users or groups.
countintegerList successNumber of returned items.
paginationTokenstringAnother page existsOpaque Cognito continuation token.
dataobjectNon-list successNormalized resource or mutation receipt.
requestIdstringAWS supplies oneBounded provider reference for reconciliation and support.
errorobjectFailureSafe {code, message, httpStatus?, retryable} details.

User output can contain username, status, enabled, timestamps, and up to 50 normalized attributes. Group output can contain its name, description, role ARN, precedence, and timestamps. User-pool output is deliberately limited to identity, name, ARN, state, domains, MFA mode, deletion protection, timestamps, and estimated user count.

IntegrationAccount Requirements

Bind one AWS IntegrationAccount through the normalized ExecModule authentication relationship:

FieldRequirement
ProviderAmazon Web Services / Cognito User Pools
statusMust be READY.
verifiedMust be true.
apiKey SecureFieldAWS access key ID.
password SecureFieldAWS secret access key.

Grant only the actions enabled in the workflow:

  • Read: cognito-idp:ListUsers, ListGroups, AdminGetUser, GetGroup, and DescribeUserPool.
  • User lifecycle: cognito-idp:AdminCreateUser, AdminUpdateUserAttributes, and AdminDeleteUser.
  • Group lifecycle: cognito-idp:CreateGroup, UpdateGroup, and DeleteGroup.
  • Membership: cognito-idp:AdminAddUserToGroup and AdminRemoveUserFromGroup.

Scope resource-level grants to the exact user-pool ARN when AWS supports it. The current connector supports a long-lived access-key pair. Temporary session credentials, STS role assumption, workload identity, VPC endpoint overrides, and custom AWS partitions beyond standard, GovCloud, and China region syntax are deferred.

Configuration

The awsAccount relationship is the only credential configuration. Operation, pool, region, and identity fields belong in mapped input or module parameters.

{
"version": "1.0.0",
"authConfig": {
"authStrategy": 1,
"integrationAccount": "integration-account:aws-cognito-production"
},
"payloadConfig": {
"parameters": "{\"operation\":\"list_users\",\"region\":\"us-west-2\",\"userPoolId\":\"us-west-2_example123\",\"maxResults\":25}"
}
}

The relationship value is illustrative. Persisted workflows bind the generated IntegrationAccount relationship, never plaintext credentials.

Operations

OperationProvider behaviorSide effect and retry behavior
list_groupsReturns one bounded page of groups.Read-only; retries retryable failures up to three attempts.
get_groupRetrieves one exact group.Read-only; bounded retry.
create_groupCreates a group with optional description, precedence, and role.Single attempt; reconcile the exact group name before replay.
update_groupReplaces supplied group fields.Single attempt; reconcile with get_group before replay.
delete_groupPermanently deletes one group after confirm=true.Destructive, single attempt, no automatic replay.
list_usersReturns one bounded filtered page of users.Read-only; bounded retry.
get_userRetrieves one exact user.Read-only; bounded retry.
create_userCreates one administrative user and optional attributes.Single attempt; can send an invitation unless suppressed.
update_userWrites one or more user attributes.Single attempt; reconcile with get_user before replay.
delete_userPermanently deletes one user after confirm=true.Destructive, single attempt, no automatic replay.
add_user_to_groupAdds an existing user to an existing group.Single attempt; reconcile membership before replay.
remove_user_from_groupRemoves an existing user from a group.Single attempt; reconcile membership before replay.
get_user_poolReturns bounded user-pool metadata.Read-only; bounded retry.

Errors and Failure Modes

CodeTypical causeRetryableResolution
VALIDATION_ERRORMissing/malformed pool, region, identity, attribute, pagination, group option, or confirmation; unexpected operation field.NoCorrect the named input; no provider request was sent.
UNSUPPORTED_OPERATIONUnknown operation.NoSelect a documented operation.
INTEGRATION_ACCOUNT_ERRORAccount missing, unverified, not READY, or missing key material.NoRepair and bind the AWS account.
AWS_COGNITO_HTTP_400Invalid pool/resource, alias conflict, password policy, immutable attribute, or Cognito constraint.Usually noInspect the operation, exact identity state, and current pool policy.
AWS_COGNITO_HTTP_403IAM denies the selected action or user pool.NoGrant only the missing action on the intended pool.
AWS_COGNITO_HTTP_404User, group, or pool no longer exists.NoReconcile identifiers before deciding whether to create or stop.
AWS_COGNITO_HTTP_429 / 500 / 503Throttle or transient provider pressure.Reads retry; mutations report ambiguityReconcile mutation state using a read before any replay.
NETWORK_ERRORDNS, TLS, timeout, or connectivity failure.Reads retry; mutations report ambiguityTreat acceptance as unknown and inspect AWS state before replay.
EXECUTION_ERRORUnexpected bounded runtime failure.No automatic replayPreserve the operation, pool, identity, and request evidence.

Provider exception text is never copied into output, preventing credentials, temporary passwords, aliases, or unbounded provider payloads from leaking through workflow errors.

Example

Create a reviewed support identity without sending Cognito's automatic invitation:

{
"operation": "create_user",
"region": "us-west-2",
"userPoolId": "us-west-2_example123",
"username": "support-agent-1042",
"attributes": {
"email": "agent@example.com",
"email_verified": "true",
"custom:team": "support"
},
"temporaryPassword": "provided-through-an-approved-secret-step",
"suppressMessage": true,
"forceAliasCreation": false
}

Expected result shape:

{
"status": "success",
"operation": "create_user",
"attempts": 1,
"resultType": "user",
"data": {
"username": "support-agent-1042",
"status": "FORCE_CHANGE_PASSWORD",
"enabled": true,
"attributes": {
"email": "agent@example.com",
"email_verified": "true",
"custom:team": "support"
}
},
"requestId": "aws-request-reference"
}

The temporary password is deliberately absent from output. A separate reviewed workflow can assign the user to a group after verifying the create receipt.

Notes

  • Pagination: list_users and list_groups return one Cognito page. Preserve the returned token with the same pool, filter, and page size; tokens are opaque and may expire.
  • Rate limits: Cognito quotas vary by category, account, and region. Read calls use at most three attempts with short bounded backoff. Mutations never retry automatically.
  • API limits: ValkyrAI caps each list page at 60, each attribute map at 50 entries, and output to the provider's single bounded page. These constraints are intentionally conservative.
  • Idempotency: reads are replay-safe. User/group creation, updates, membership changes, message delivery, alias movement, and deletion can have side effects and are single-attempt.
  • Ambiguous writes: if transport fails after AWS accepts a mutation, reconcile the exact username/group through a read or audited AWS event before replaying.
  • Destructive behavior: delete_user and delete_group permanently remove identity resources and require confirm=true. The connector does not delete user pools.
  • Messaging: create_user may send Cognito's configured invitation. Set suppressMessage=true only when another approved onboarding channel owns delivery.
  • Alias movement: forceAliasCreation=true can transfer a verified email or phone alias from another user. Treat it as an identity-impacting change requiring review.
  • Security: returned attributes can contain personal data. Keep output within an ACL-scoped workflow and avoid logging entire records.
  • Provider verification boundary: deterministic tests cover validation, exact region/pool scope, all operation families, pagination, attribute normalization, password non-echo, retry boundaries, deletion confirmation, provider-error redaction, registration, and metadata. Live AWS behavior remains unverified until an authorized Cognito credential and reviewed test pool are supplied.
  • Functional reference: n8n's AWS Cognito node exposes group create/get/list/update/delete, user create/get/list/update/delete, membership add/remove, and user-pool get. ValkyrAI preserves that surface with stronger account, scope, replay, output, and deletion controls.
  • Runtime boundary: merged source and published documentation do not update the deployed Workflow Studio catalog until a ValkyrAI backend release exposes AwsCognitoModule through /v1/modules/metadata.