createCustomModel

Creates a new custom model in Amazon Bedrock. After the model is active, you can use it for inference.

You can provide the model data source in one of the following ways:

  • customModelDataSource — Specify a SageMaker AI model package ARN. Amazon Bedrock resolves the model package to retrieve the model artifacts. This is the preferred method for new SageMaker AI training outputs.

  • modelSourceConfig — Specify an Amazon S3 URI pointing to the Amazon-managed Amazon S3 bucket containing your model artifacts.

To use the model for inference, you must purchase Provisioned Throughput for it. You can't use On-demand inference with these custom models. For more information about Provisioned Throughput, see Provisioned Throughput.

The model appears in ListCustomModels with a customizationType of imported. To track the status of the new model, you use the GetCustomModel API operation. The model can be in the following states:

  • Creating - Initial state during validation and registration

  • Active - Model is ready for use in inference

  • Failed - Creation process encountered an error

Related APIs

Samples

// Successful CreateCustomModel API call
val resp = bedrockClient.createCustomModel {
    modelName = "SampleModel"
    modelSourceConfig = ModelDataSource.S3DataSource(S3DataSource {
        s3Uri = "s3://my-bucket/folder"
    }
    )
    roleArn = "arn:aws:iam::123456789012:role/SampleRole"
    modelKmsKeyArn = "arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab"
    modelTags = listOf<Tag>(
        Tag {
            key = "foo"
            value = "foo"
        },
        Tag {
            key = "foo"
            value = "foo"
        }            
    )
    clientRequestToken = "foo"
}