Skip to content

User

Source: src/AWS/Cognito/User.ts

A user within an Amazon Cognito user pool, created administratively via AdminCreateUser. The invitation message is always suppressed (MessageAction: SUPPRESS) — declaratively managed users never trigger invite emails/SMS; set a permanent password to make the account usable immediately.

Basic User

import * as Cognito from "alchemy/AWS/Cognito";
const pool = yield* Cognito.UserPool("Users", {});
const user = yield* Cognito.User("Admin", {
userPoolId: pool.userPoolId,
attributes: { email: "admin@example.com", email_verified: "true" },
});

Confirmed User with a Permanent Password

import * as Redacted from "effect/Redacted";
const user = yield* Cognito.User("ServiceAccount", {
userPoolId: pool.userPoolId,
username: "service-account",
password: Redacted.make("A-Str0ng-Passw0rd!"),
attributes: { email: "svc@example.com", email_verified: "true" },
});
// user.userStatus === "CONFIRMED"