cognito-import v1.2.12
Cognito Import
A simple CLI tool and JavaScript package for importing users into an AWS Cognito user pool.
This tool works perfectly with
cognito-export. The user records exported match the import template to easily export from one user pool and import to another.
Getting Started
- Use it as a CLI tool to import users from a CSV file into a user pool
npx cognito-import -u <user-pool-id> -f ./users.csv -v
- or, use it in Node.js
npm i cognito-import
import cognitoImport from "cognito-import";
await cognitoImport(users, {
  userPoolId: "<user-pool-id>",
});All flags and options can be found in the table below.
1. CLI Options
A full example of the CLI tool in effect can be found below:
npx cognito-import -u eu-west-1_aaaaaaaaa -p SOMEPROFILE -v -f ./users.csv
| Flag | Description | 
|---|---|
| -u, --user-pool-id | Required. The ID of the AWS Cognito user pool to import into | 
| -p, --profile PROFILEA | The AWS profile to use for authentication. This will default to the AWS_PROFILE environment variable if left blank, or defaultif that is undefined. | 
| -f, --file ./users.csv | The path to the CSV file to import. Defaults to ./users.csv. | 
| -i, --iam | An IAM Role ARN. If omitted, an IAM role will be created with the correct policy. Your access credentials will need permissions to create IAM roles and policies. | 
| -v, --verbose | Show all logs and errors in the console. Defaults to true. | 
| -h, --help | See all flags and options | 
## 2. Node.js Example
A full example of the package in effect can be found below:
import cognitoImport, { ImportUsers } from "cognito-import";
const users: ImportUsers = []; // Get your users ready
await cognitoImport(users, {
  userPoolId: "eu-west-1_aaaaaaaaa",
  profile: "SOMEPROFILE",
});Please note: This method supports all flags documented above, except the file and verbose flags. Instead, the method expects the users to be passed in.
Use with cognito-export
npx cognito-export -u eu-west-1_aaaaaaaaa -p PROFILE_A &&
npx cognito-import -u eu-west-1_bbbbbbbbb -p PROFILE_B -f users.csvor
import cognitoExport from "cognito-export";
import cognitoImport from "cognito-import";
const users = await cognitoExport({
  userPoolId: "eu-west-1_aaaaaaaaa",
  profile: "PROFILE_A",
});
const job = await cognitoImport(users, {
  userPoolId: "eu-west-2_bbbbbbbbb",
  profile: "PROFILE_B",
});1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago