createCustomModelDeployment method

Future<CreateCustomModelDeploymentResponse> createCustomModelDeployment({
  1. required String modelArn,
  2. required String modelDeploymentName,
  3. String? clientRequestToken,
  4. String? description,
  5. List<Tag>? tags,
})

Deploys a custom model for on-demand inference in Amazon Bedrock. After you deploy your custom model, you use the deployment's Amazon Resource Name (ARN) as the modelId parameter when you submit prompts and generate responses with model inference.

For more information about setting up on-demand inference for custom models, see Set up inference for a custom model.

The following actions are related to the CreateCustomModelDeployment operation:

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw TooManyTagsException. May throw ValidationException.

Parameter modelArn : The Amazon Resource Name (ARN) of the custom model to deploy for on-demand inference. The custom model must be in the Active state.

Parameter modelDeploymentName : The name for the custom model deployment. The name must be unique within your Amazon Web Services account and Region.

Parameter clientRequestToken : A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

Parameter description : A description for the custom model deployment to help you identify its purpose.

Parameter tags : Tags to assign to the custom model deployment. You can use tags to organize and track your Amazon Web Services resources for cost allocation and management purposes.

Implementation

Future<CreateCustomModelDeploymentResponse> createCustomModelDeployment({
  required String modelArn,
  required String modelDeploymentName,
  String? clientRequestToken,
  String? description,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'modelArn': modelArn,
    'modelDeploymentName': modelDeploymentName,
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/model-customization/custom-model-deployments',
    exceptionFnMap: _exceptionFns,
  );
  return CreateCustomModelDeploymentResponse.fromJson(response);
}