CreateModel - Amazon Lookout for Vision API Reference


Creates a new version of a model within an an Amazon Lookout for Vision project. CreateModel is an asynchronous operation in which Amazon Lookout for Vision trains, tests, and evaluates a new version of a model.

To get the current status, check the Status field returned in the response from DescribeModel.

If the project has a single dataset, Amazon Lookout for Vision internally splits the dataset to create a training and a test dataset. If the project has a training and a test dataset, Lookout for Vision uses the respective datasets to train and test the model.

After training completes, the evaluation metrics are stored at the location specified in OutputConfig.

This operation requires the following permissions.

Permission to create a model

lookoutvision:CreateModel - Permission to call the CreateModel operation.

Permissions to read the dataset images during training

  • s3:GetObject - Required on all S3 objects specified in the Train and Test datasets.

  • (Optional) kms:Decrypt - Required on any KMS keys used to encrypt S3 objects specified in the Train and Test datasets.

Permissions to write the training results output

  • s3:GetBucketLocation - Validates the ownership and the AWS Region of the S3 bucket.

  • s3:PutObject - Lets Amazon Lookout for Vision write training results to the S3 bucket.

  • (Optional) kms:GenerateDataKey - Required on the S3 bucket's default encryption KMS key, if the S3 bucket is configured with SSE-KMS default encryption and KmsKeyId is not specified in the request.

(Optional) Permissions to use a customer managed KMS key for encrypting images during training

  • (Optional) kms:CreateGrant - Required on the KmsKeyId specified in the request.

  • (Optional) kms:GenerateDataKey - Required on the KmsKeyId specified in the request.

(Optional) Permissions to tag a model on creation

  • (Optional) lookoutvision:TagResource - Required on the new model ARN if you tag your model with the Tags request parameter.

Request Syntax

POST /2020-11-20/projects/projectName/models HTTP/1.1 X-Amzn-Client-Token: ClientToken Content-type: application/json { "Description": "string", "KmsKeyId": "string", "OutputConfig": { "S3Location": { "Bucket": "string", "Prefix": "string" } }, "Tags": [ { "Key": "string", "Value": "string" } ] }

URI Request Parameters

The request uses the following URI parameters.


ClientToken is an idempotency token that ensures a call to CreateModel completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from CreateModel. In this case, safely retry your call to CreateModel by using the same ClientToken parameter value.

If you don't supply a value for ClientToken, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from starting multiple training jobs. You'll need to provide your own value for other use cases.

An error occurs if the other input parameters are not the same as in the first request. Using a different value for ClientToken is considered a new call to CreateModel. An idempotency token is active for 8 hours.

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: ^[a-zA-Z0-9-]+$


The name of the project in which you want to create a model version.

Length Constraints: Minimum length of 1. Maximum length of 255.

Pattern: [a-zA-Z0-9][a-zA-Z0-9_\-]*

Required: Yes

Request Body

The request accepts the following data in JSON format.


A description for the version of the model.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 500.

Pattern: [0-9A-Za-z\.\-_]*

Required: No


The identifier for your AWS KMS key. The key is used to encrypt training and test images copied into the service for model training. Your source images are unaffected. If this parameter is not specified, the copied images are encrypted by a key that AWS owns and manages.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Pattern: ^[A-Za-z0-9][A-Za-z0-9:_/+=,@.-]{0,2048}$

Required: No


The location where Amazon Lookout for Vision saves the training results.

Type: OutputConfig object

Required: Yes


A set of tags (key-value pairs) that you want to attach to the model. For more information, see Tagging models in the Amazon Lookout for Vision developer guide.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

HTTP/1.1 202 Content-type: application/json { "ModelMetadata": { "CreationTimestamp": number, "Description": "string", "ModelArn": "string", "ModelVersion": "string", "Performance": { "F1Score": number, "Precision": number, "Recall": number }, "Status": "string", "StatusMessage": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 202 response.

The following data is returned in JSON format by the service.


The response from a call to CreateModel.

Type: ModelMetadata object


For information about the errors that are common to all actions, see Common Errors.


You are not authorized to perform the action.

HTTP Status Code: 403


The update or deletion of a resource caused an inconsistent state.

HTTP Status Code: 409


Amazon Lookout for Vision experienced a service issue. Try your call again.

HTTP Status Code: 500


The resource could not be found.

HTTP Status Code: 404


A service quota exceeded the allowed limit. For more information, see Quotas in Amazon Lookout for Vision.

HTTP Status Code: 402


Amazon Lookout for Vision is temporarily unable to process the request. Try your call again.

HTTP Status Code: 429


An input validation error occured. For example, invalid characters in a project name, or if a pagination token is invalid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: