custom_models
Creates, updates, deletes, gets or lists a custom_models resource.
Overview
| Name | custom_models |
| Type | Resource |
| Id | aws.bedrock.custom_models |
Fields
The following fields are returned by SELECT queries:
- get_custom_model
- list_custom_models
| Name | Datatype | Description |
|---|---|---|
base_model_arn | string | Amazon 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_time | string (date-time) | Creation time of the model. |
customization_config | object | A model customization configuration |
customization_type | string | The type of model customization. (FINE_TUNING, CONTINUED_PRE_TRAINING, DISTILLATION, REINFORCEMENT_FINE_TUNING, IMPORTED) |
failure_message | string | A failure message for any issues that occurred when creating the custom model. This is included for only a failed CreateCustomModel operation. |
hyper_parameters | object | Hyperparameter values associated with this model. For details on the format for different models, see Custom model hyperparameters. |
job_arn | string | Job 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_name | string | Job name associated with this model. (pattern: <code>[a-zA-Z0-9](-[a-zA-Z0-9+-.])</code>) |
model_arn | string | Amazon 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_arn | string | The 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_name | string | Model name associated with this model. (pattern: <code>([0-9a-zA-Z][_-]?){1,63}</code>) |
model_status | string | The 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_config | object | S3 Location of the output data. |
training_data_config | object | S3 Location of the training data. |
training_metrics | object | Contains training metrics from the job creation. |
validation_data_config | object | Array of up to 10 validators. |
validation_metrics | array | The validation metrics from the job creation. |
| Name | Datatype | Description |
|---|---|---|
base_model_arn | string | The base model Amazon Resource Name (ARN). (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>) |
base_model_name | string | The base model name. (pattern: <code>([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63})</code>) |
creation_time | string (date-time) | Creation time of the model. |
customization_type | string | Specifies whether to carry out continued pre-training of a model or whether to fine-tune it. For more information, see Custom models. (FINE_TUNING, CONTINUED_PRE_TRAINING, DISTILLATION, REINFORCEMENT_FINE_TUNING, IMPORTED) |
model_arn | string | The Amazon Resource Name (ARN) of the custom model. (pattern: <code>arn:aws(|-us-gov|-cn|-iso|-iso-b):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-]{1,63}([:][a-z0-9-]{1,63}){0,2})/[a-z0-9]{12}</code>) |
model_name | string | The name of the custom model. (pattern: <code>([0-9a-zA-Z][_-]?){1,63}</code>) |
model_status | string | The 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. (Active, Creating, Failed) |
owner_account_id | string | The unique identifier of the account that owns the model. (pattern: <code>[0-9]{12}</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_custom_model | select | model_identifier, region | 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. | |
list_custom_models | select | region | creationTimeBefore, creationTimeAfter, nameContains, baseModelArnEquals, foundationModelArnEquals, maxResults, nextToken, sortBy, sortOrder, isOwned, modelStatus | Returns 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_model | insert | region, modelName | 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 | |
delete_custom_model | delete | model_identifier, region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
model_identifier | string | Name of the model to delete. |
region | string | AWS region (default: us-east-1) |
baseModelArnEquals | string | Return custom models only if the base model Amazon Resource Name (ARN) matches this parameter. |
creationTimeAfter | string (date-time) | Return custom models created after the specified time. |
creationTimeBefore | string (date-time) | Return custom models created before the specified time. |
foundationModelArnEquals | string | Return custom models only if the foundation model Amazon Resource Name (ARN) matches this parameter. |
isOwned | boolean | Return custom models depending on if the current account owns them (true) or if they were shared with the current account (false). |
maxResults | integer | The 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. |
modelStatus | string | The 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. |
nameContains | string | Return custom models only if the job name contains these characters. |
nextToken | string | If 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. |
sortBy | string | The field to sort by in the returned list of models. |
sortOrder | string | The sort order of the results. |
SELECT examples
- get_custom_model
- list_custom_models
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
;
Returns 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.
SELECT
base_model_arn,
base_model_name,
creation_time,
customization_type,
model_arn,
model_name,
model_status,
owner_account_id
FROM aws.bedrock.custom_models
WHERE region = '{{ region }}' -- required
AND creationTimeBefore = '{{ creationTimeBefore }}'
AND creationTimeAfter = '{{ creationTimeAfter }}'
AND nameContains = '{{ nameContains }}'
AND baseModelArnEquals = '{{ baseModelArnEquals }}'
AND foundationModelArnEquals = '{{ foundationModelArnEquals }}'
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND isOwned = '{{ isOwned }}'
AND modelStatus = '{{ modelStatus }}'
;
INSERT examples
- create_custom_model
- Manifest
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
;
# Description fields are for documentation purposes
- name: custom_models
props:
- name: region
value: "{{ region }}"
description: Required parameter for the custom_models resource.
- name: modelName
value: "{{ modelName }}"
- name: modelSourceConfig
description: |
The data source of the model to import.
value:
s3DataSource:
s3Uri: "{{ s3Uri }}"
- name: customModelDataSource
description: |
The data source for a custom model. This is a union type that supports the following member: modelPackageArnDataSource — Specifies a SageMaker AI model package as the data source.
value:
modelPackageArnDataSource:
modelPackageArn: "{{ modelPackageArn }}"
- name: modelKmsKeyArn
value: "{{ modelKmsKeyArn }}"
- name: roleArn
value: "{{ roleArn }}"
- name: modelTags
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: clientRequestToken
value: "{{ clientRequestToken }}"
DELETE examples
- delete_custom_model
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
;