CognitoIdentityProvider / Client / create_user_import_job
create_user_import_job#
- CognitoIdentityProvider.Client.create_user_import_job(**kwargs)#
Creates a user import job. You can import users into user pools from a comma-separated values (CSV) file without adding Amazon Cognito MAU costs to your Amazon Web Services bill. To generate a template for your import, see GetCSVHeader. To learn more about CSV import, see Importing users from a CSV file.
Note
Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.
Learn more
See also: AWS API Documentation
Request Syntax
response = client.create_user_import_job( JobName='string', UserPoolId='string', CloudWatchLogsRoleArn='string' )
- Parameters:
JobName (string) –
[REQUIRED]
A friendly name for the user import job.
UserPoolId (string) –
[REQUIRED]
The ID of the user pool that you want to import users into.
CloudWatchLogsRoleArn (string) –
[REQUIRED]
You must specify an IAM role that has permission to log import-job results to Amazon CloudWatch Logs. This parameter is the ARN of that role.
- Return type:
dict
- Returns:
Response Syntax
{ 'UserImportJob': { 'JobName': 'string', 'JobId': 'string', 'UserPoolId': 'string', 'PreSignedUrl': 'string', 'CreationDate': datetime(2015, 1, 1), 'StartDate': datetime(2015, 1, 1), 'CompletionDate': datetime(2015, 1, 1), 'Status': 'Created'|'Pending'|'InProgress'|'Stopping'|'Expired'|'Stopped'|'Failed'|'Succeeded', 'CloudWatchLogsRoleArn': 'string', 'ImportedUsers': 123, 'SkippedUsers': 123, 'FailedUsers': 123, 'CompletionMessage': 'string' } }
Response Structure
(dict) –
Represents the response from the server to the request to create the user import job.
UserImportJob (dict) –
The details of the user import job.
JobName (string) –
The friendly name of the user import job.
JobId (string) –
The ID of the user import job.
UserPoolId (string) –
The ID of the user pool that the users are being imported into.
PreSignedUrl (string) –
The pre-signed URL target for uploading the CSV file.
CreationDate (datetime) –
The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java
Date
object.StartDate (datetime) –
The date when the user import job was started.
CompletionDate (datetime) –
The date when the user import job was completed.
Status (string) –
The status of the user import job. One of the following:
Created
- The job was created but not started.Pending
- A transition state. You have started the job, but it has not begun importing users yet.InProgress
- The job has started, and users are being imported.Stopping
- You have stopped the job, but the job has not stopped importing users yet.Stopped
- You have stopped the job, and the job has stopped importing users.Succeeded
- The job has completed successfully.Failed
- The job has stopped due to an error.Expired
- You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can’t be started.
CloudWatchLogsRoleArn (string) –
The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see “Creating the CloudWatch Logs IAM Role” in the Amazon Cognito Developer Guide.
ImportedUsers (integer) –
The number of users that were successfully imported.
SkippedUsers (integer) –
The number of users that were skipped.
FailedUsers (integer) –
The number of users that couldn’t be imported.
CompletionMessage (string) –
The message returned when the user import job is completed.
Exceptions
CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
CognitoIdentityProvider.Client.exceptions.InvalidParameterException
CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
CognitoIdentityProvider.Client.exceptions.PreconditionNotMetException
CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
CognitoIdentityProvider.Client.exceptions.LimitExceededException
CognitoIdentityProvider.Client.exceptions.InternalErrorException