A .ts
script to output information about a Cognito user pool. This uses the V3 JS client to call describe-user-pool
This is simply one means, amongst many, to fetch user pool info.
user@~: $ mkdir cognito_test
user@~: $ cd cognito_test
user@~/cognito_test: $ npm init -y
user@~/cognito_test: $ npm i @aws-sdk/client-cognito-identity-provider
user@~/cognito_test: $ npm i dotenv
user@~/cognito_test: $ touch .env.local
Reference the sample .env.local in the gist below
user@~/cognito_test: $ touch describe-user-pool.ts
Feel free to use the snippet in the gist below
user@~/cognito_test: $ npx tsx describe-user-pool.ts
{
"$metadata": {
"httpStatusCode": 200,
"requestId": "25ebbdaf-ad6b-44fb-83a6-2cce27756660",
"attempts": 1,
"totalRetryDelay": 0
},
"UserPool": {
"AccountRecoverySetting": {
"RecoveryMechanisms": [
... etc.