Skip to main content

custom_models

Creates, updates, deletes, gets or lists a custom_models resource.

Overview

Namecustom_models
TypeResource
Idaws.bedrock.custom_models

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
base_model_arnstringAmazon Resource Name (ARN) of the base model. (pattern: <code>arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/((imported)|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}))(([:][a-z0-9-]{1,63}){0,2})?/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}([a-z0-9-]{1,63}[.]){0,2}[a-z0-9-]{1,63}([:][a-z0-9-]{1,63}){0,2}))</code>)
creation_timestring (date-time)Creation time of the model.
customization_configobjectA model customization configuration
customization_typestringThe type of model customization. (FINE_TUNING, CONTINUED_PRE_TRAINING, DISTILLATION, REINFORCEMENT_FINE_TUNING, IMPORTED)
failure_messagestringA failure message for any issues that occurred when creating the custom model. This is included for only a failed CreateCustomModel operation.
hyper_parametersobjectHyperparameter values associated with this model. For details on the format for different models, see Custom model hyperparameters.
job_arnstringJob Amazon Resource Name (ARN) associated with this model. For models that you create with the CreateCustomModel API operation, this is NULL. (pattern: <code>arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:model-customization-job/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([a-z0-9-]{1,63}[.]){0,2}[a-z0-9-]{1,63}([:][a-z0-9-]{1,63}){0,2}/[a-z0-9]{12}</code>)
job_namestringJob name associated with this model. (pattern: <code>[a-zA-Z0-9](-[a-zA-Z0-9+-.])</code>)
model_arnstringAmazon Resource Name (ARN) associated with this model. (pattern: <code>arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/((imported)|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}))(([:][a-z0-9-]{1,63}){0,2})?/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}([a-z0-9-]{1,63}[.]){0,2}[a-z0-9-]{1,63}([:][a-z0-9-]{1,63}){0,2}))</code>)
model_kms_key_arnstringThe custom model is encrypted at rest using this key. (pattern: <code>arn:aws(-[^:]+)?:kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}</code>)
model_namestringModel name associated with this model. (pattern: <code>([0-9a-zA-Z][_-]?){1,63}</code>)
model_statusstringThe current status of the custom model. Possible values include: Creating - The model is being created and validated. Active - The model has been successfully created and is ready for use. Failed - The model creation process failed. Check the failureMessage field for details. (Active, Creating, Failed)
output_data_configobjectS3 Location of the output data.
training_data_configobjectS3 Location of the training data.
training_metricsobjectContains training metrics from the job creation.
validation_data_configobjectArray of up to 10 validators.
validation_metricsarrayThe validation metrics from the job creation.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_custom_modelselectmodel_identifier, regionGet the properties associated with a Amazon Bedrock custom model that you have created. For more information, see Custom models in the Amazon Bedrock User Guide.
list_custom_modelsselectregioncreationTimeBefore, creationTimeAfter, nameContains, baseModelArnEquals, foundationModelArnEquals, maxResults, nextToken, sortBy, sortOrder, isOwned, modelStatusReturns a list of the custom models that you have created with the CreateModelCustomizationJob operation. For more information, see Custom models in the Amazon Bedrock User Guide.
create_custom_modelinsertregion, modelNameCreates 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 GetCustomModel ListCustomModels DeleteCustomModel
delete_custom_modeldeletemodel_identifier, regionDeletes a custom model that you created earlier. For more information, see Custom models in the Amazon Bedrock User Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
model_identifierstringName of the model to delete.
regionstringAWS region (default: us-east-1)
baseModelArnEqualsstringReturn custom models only if the base model Amazon Resource Name (ARN) matches this parameter.
creationTimeAfterstring (date-time)Return custom models created after the specified time.
creationTimeBeforestring (date-time)Return custom models created before the specified time.
foundationModelArnEqualsstringReturn custom models only if the foundation model Amazon Resource Name (ARN) matches this parameter.
isOwnedbooleanReturn custom models depending on if the current account owns them (true) or if they were shared with the current account (false).
maxResultsintegerThe maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
modelStatusstringThe status of them model to filter results by. Possible values include: Creating - Include only models that are currently being created and validated. Active - Include only models that have been successfully created and are ready for use. Failed - Include only models where the creation process failed. If you don't specify a status, the API returns models in all states.
nameContainsstringReturn custom models only if the job name contains these characters.
nextTokenstringIf the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.
sortBystringThe field to sort by in the returned list of models.
sortOrderstringThe sort order of the results.

SELECT examples

Get the properties associated with a Amazon Bedrock custom model that you have created. For more information, see Custom models in the Amazon Bedrock User Guide.

SELECT
base_model_arn,
creation_time,
customization_config,
customization_type,
failure_message,
hyper_parameters,
job_arn,
job_name,
model_arn,
model_kms_key_arn,
model_name,
model_status,
output_data_config,
training_data_config,
training_metrics,
validation_data_config,
validation_metrics
FROM aws.bedrock.custom_models
WHERE model_identifier = '{{ model_identifier }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

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 GetCustomModel ListCustomModels DeleteCustomModel

INSERT INTO aws.bedrock.custom_models (
modelName,
modelSourceConfig,
customModelDataSource,
modelKmsKeyArn,
roleArn,
modelTags,
clientRequestToken,
region
)
SELECT
'{{ modelName }}' /* required */,
'{{ modelSourceConfig }}',
'{{ customModelDataSource }}',
'{{ modelKmsKeyArn }}',
'{{ roleArn }}',
'{{ modelTags }}',
'{{ clientRequestToken }}',
'{{ region }}'
RETURNING
model_arn
;

DELETE examples

Deletes a custom model that you created earlier. For more information, see Custom models in the Amazon Bedrock User Guide.

DELETE FROM aws.bedrock.custom_models
WHERE model_identifier = '{{ model_identifier }}' --required
AND region = '{{ region }}' --required
;