1.2.11 • Published 3 days ago

cognito-import v1.2.11

Weekly downloads
-
License
-
Repository
github
Last release
3 days ago

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

  1. 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

  1. 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

FlagDescription
-u, --user-pool-id Required. The ID of the AWS Cognito user pool to import into
-p, --profile PROFILEAThe AWS profile to use for authentication. This will default to the AWS_PROFILE environment variable if left blank, or default if that is undefined.
-f, --file ./users.csvThe 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, --verboseShow all logs and errors in the console. Defaults to true.
-h, --helpSee 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.csv

or

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.2.8

3 days ago

1.2.9

3 days ago

1.2.10

3 days ago

1.2.11

3 days ago

1.2.0

4 days ago

1.2.7

4 days ago

1.2.6

4 days ago

1.2.3

4 days ago

1.2.2

4 days ago

1.2.1

4 days ago

1.1.4

22 days ago

1.1.1

24 days ago

1.0.20

24 days ago

1.1.2

24 days ago

1.0.18

25 days ago

1.0.15

25 days ago

1.0.9

25 days ago

1.0.8

25 days ago

1.0.6

25 days ago