How do I check CloudWatch logs for errors when I import users into a user pool from a CSV file?

Last updated: 2022-12-28

I want to check for errors that are reported when I import users into a user pool from a CSV file.

Short description

Amazon Cognito allows you to import users into an Amazon Cognito user pool from a specially formatted CSV file. This import process sets values for all user attributes except password. For more information, see Importing users into user pools from a CSV file.

For information on common errors during the importing process, see How do I troubleshoot common errors with the importing process in Amazon Cognito?

To find these errors, do the following:

  1. Find the user pool ID and name.
  2. Import the job name.
  3. Find the Cloudwatch log group.
  4. Use Cloudwatch log stream.

Resolution

Find user pool ID and name

  1. Open the Amazon Cognito console.
    Note: If using the old interface, choose Manage User Pools.
  2. Search for the user pool where you ran the import job to find the name and ID of the user pool.
  3. Note the user pool name and ID.

User pool ID and name example:

- Pool Id - us-east-1_XXXXXXXXX
- Pool Name - testuserimport

Find the import job name

Old interface

  1. Open the Amazon Cognito console.
  2. Choose Manager User Pools.
  3. Choose your user pool.
  4. In the navigation pane, choose Users and groups under General settings.
  5. Select Import Users.
  6. Note the failing job name.

New interface

  1. Open the Amazon Cognito console.
  2. Choose your user pool.
  3. Under the Users tab, find the Import users information.
  4. Note the failing job name.
    Note: You can view the CloudWatch logs from here by clicking on View logs for the failed import job. This will redirect you to the log group stream.

Import job name example:

import-Test1

Find the Cloudwatch log group

  1. Open the Amazon CloudWatch console.
  2. Expand Logs in the navigation pane, and select Log Groups.
  3. Using the Log Groups search bar functionality, you can look for either the user pool ID or name. Doing this will filter for the specific log group of that user pool.

CloudWatch log group example:

/aws/cognito/userpools/{user_pool_id}/{user_pool_name}

Find the CloudWatch log stream

  1. While still in CloudWatch, select the log group you found for your user pool during the previous steps.
  2. Select the Log Streams tab, and use the search filter functionality to find the log stream using import job name.
  3. Select the log stream to check the log events for import job error.

CloudWatch log stream example:

[Timestamp]    Cognito User Pools Import - Test Log 
[Timestamp]    Cognito User Pools Import - Test Log 
[Timestamp]    [FAILED] Line Number 2 - The User Record contains an invalid value for phone_number_verified. It must be true or false.

Note: Based on this example, the error reported in CloudWatch Log Stream shows that the value for phone_number_verified field is set incorrectly.


Did this article help?


Do you need billing or technical support?