{"id":47411,"library":"dm-driver-cognito","title":"dm-driver-cognito","description":"A Data Migration driver for querying and modifying Amazon Cognito user pools. Version 1.6.0 is the current stable release, maintained as part of the data-migration monorepo with Lerna. It integrates with the data-migration framework and supports cloudformation parameter resolution via dm-processor-cf. Compared to direct AWS SDK usage, it provides a migration-oriented abstraction with addUser, getUser, and deleteUser methods within a staging and migration directory structure.","status":"active","version":"1.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/theBenForce/data-migration","tags":["javascript","typescript"],"install":[{"cmd":"npm install dm-driver-cognito","lang":"bash","label":"npm"},{"cmd":"yarn add dm-driver-cognito","lang":"bash","label":"yarn"},{"cmd":"pnpm add dm-driver-cognito","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core framework dependency; this package is a driver plugin for data-migration.","package":"data-migration","optional":false},{"reason":"AWS SDK for Cognito Identity Provider operations.","package":"@aws-sdk/client-cognito-identity-provider","optional":false}],"imports":[{"note":"Package does not ship ESM; use CommonJS require().","wrong":"import cognitoDriver from 'dm-driver-cognito'","symbol":"default","correct":"const cognitoDriver = require('dm-driver-cognito')"},{"note":"UserPoolDriver is not exported; use type inference from the driver instance returned by data-migration context.","wrong":"import { UserPoolDriver } from 'dm-driver-cognito'","symbol":"UserPoolDriver","correct":"type UserPoolDriver = InstanceType<typeof import('dm-driver-cognito')>"},{"note":"ScriptContext is part of the core data-migration package, not this driver.","wrong":"import { ScriptContext } from 'dm-driver-cognito'","symbol":"ScriptContext","correct":"import { ScriptContext } from 'data-migration'"}],"quickstart":{"code":"// dm.config.js\nmodule.exports = {\n  defaultStage: \"dev\",\n  migrationDirectory: \"./migrations\",\n  stages: {\n    dev: {\n      defaultParams: {\n        region: \"us-east-1\",\n        profile: \"my-profile\", // optional\n      },\n      drivers: {\n        users: {\n          driver: require(\"dm-driver-cognito\"),\n          params: {\n            userPoolDriver: {\n              processor: require(\"dm-processor-cf\"),\n              params: {\n                stack: \"MyUserPoolStack\",\n                output: \"UserPoolId\",\n              },\n            },\n          },\n        },\n      },\n    },\n  },\n};\n\n// migrations/001-create-user.ts\nimport { ScriptContext, Logger } from 'data-migration';\n\nexport async function up(context: ScriptContext, log: Logger) {\n  const userPool = await context.getDriver(\"users\");\n  await userPool.addUser(\"jdoe\", \"TempPass123!\", {\n    UserAttributes: [\n      { Name: \"email\", Value: \"jdoe@example.com\" },\n    ],\n  });\n  log.info(\"User jdoe created\");\n}\n\nexport async function down(context: ScriptContext, log: Logger) {\n  const userPool = await context.getDriver(\"users\");\n  await userPool.deleteUser(\"jdoe\");\n  log.info(\"User jdoe deleted\");\n}","lang":"typescript","description":"Configures a Cognito driver using a CloudFormation stack output for the user pool ID, then creates a user in an up migration and deletes it in down."},"warnings":[{"fix":"Set AWS credentials via environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) or configure an AWS profile.","message":"The driver requires a configured AWS credential source (environment variables, profile, or IAM role). Ensure credentials are available before running migrations.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use const cognitoDriver = require('dm-driver-cognito') in your config file.","message":"The driver does not support ESM imports; CommonJS require() is mandatory.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Add @aws-sdk/client-cognito-identity-provider as a dependency if not already present.","message":"The driver uses the AWS SDK v3 package @aws-sdk/client-cognito-identity-provider. Ensure you have the correct version installed.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Either provide a plain user pool ID string or use a processor object as shown in the configuration example.","message":"The userPool parameter can be a string ID or a processor object. Misconfiguring this will cause runtime errors.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'1.6.0':18 'abstract':65 'addus':67 'amazon':13 'aw':56 'cf':52 'cloudform':45 'cognito':4,14 'compar':53 'current':21 'data':6,30,40 'data-migr':29,39 'deleteus':70 'direct':55 'directori':77 'dm':2,50 'dm-driver-cognito':1 'dm-processor-cf':49 'driver':3,8 'framework':42 'getus':68 'integr':36 'javascript':79 'lerna':34 'maintain':24 'method':71 'migrat':7,31,41,63,76 'migration-ori':62 'modifi':12 'monorepo':32 'orient':64 'paramet':46 'part':26 'pool':16 'processor':51 'provid':60 'queri':10 'releas':23 'resolut':47 'sdk':57 'stabl':22 'stage':74 'structur':78 'support':44 'typescript':80 'usag':58 'user':15 'version':17 'via':48 'within':72","created_at":"2026-06-07T16:51:23.285466+00:00","updated_at":"2026-06-07T16:51:23.285466+00:00","problems":[{"fix":"Run 'npm install dm-driver-cognito' and ensure node_modules contains the package.","cause":"The package is not installed or not resolvable from the project root.","error":"Error: Cannot find module 'dm-driver-cognito'"},{"fix":"Use driver: require('dm-driver-cognito'), not new (require('dm-driver-cognito'))().","cause":"Incorrect import style; the driver should be passed as a value to the 'driver' config field, not instantiated.","error":"TypeError: cognitoDriver is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://data-migration.js.org/plugins/drivers/aurora-rds","github":"https://github.com/theBenForce/data-migration","docs":null,"changelog":null,"pypi":null,"npm":"dm-driver-cognito","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}