Skip to content

create_model_import_job

create_model_import_job(
    job_name: JobName,
    imported_model_name: ImportedModelName,
    role_arn: RoleArn,
    model_data_source: ModelDataSource,
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    job_tags: Optional[TagList] = None,
    imported_model_tags: Optional[TagList] = None,
    client_request_token: Optional[IdempotencyToken] = None,
    vpc_config: Optional[VpcConfig] = None,
    imported_model_kms_key_id: Optional[KmsKeyId] = None,
) -> CreateModelImportJobResponse

Creates a model import job to import model that you have customized in other environments, such as Amazon SageMaker. For more information, see Import a customized model

Parameters:

  • job_name (JobName) –

    The name of the import job.

  • imported_model_name (ImportedModelName) –

    The name of the imported model.

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of the model import job.

  • model_data_source (ModelDataSource) –

    The data source for the imported model.

  • job_tags (Optional[TagList], default: None ) –

    Tags to attach to this import job.

  • imported_model_tags (Optional[TagList], default: None ) –

    Tags to attach to the imported model.

  • client_request_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive identifier to ensure that the API request 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.

  • vpc_config (Optional[VpcConfig], default: None ) –

    VPC configuration parameters for the private Virtual Private Cloud (VPC) that contains the resources you are using for the import job.

  • imported_model_kms_key_id (Optional[KmsKeyId], default: None ) –

    The imported model is encrypted at rest using this key.

Raises:

  • AccessDeniedException –

    The request is denied because of missing access permissions.

  • ConflictException –

    Error occurred because of a conflict while performing an operation.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • ResourceNotFoundException –

    The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

  • ServiceQuotaExceededException –

    The number of requests exceeds the service quota. Resubmit your request later.

  • ThrottlingException –

    The number of requests exceeds the limit. Resubmit your request later.

  • TooManyTagsException –

    The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request.

  • ValidationException –

    Input validation failed. Check your request parameters and retry the request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock/_services/bedrock.py
def create_model_import_job(
    self,
    job_name: "capo_bedrock.types.job_name.JobName",
    imported_model_name: "capo_bedrock.types.imported_model_name.ImportedModelName",
    role_arn: "capo_bedrock.types.role_arn.RoleArn",
    model_data_source: "capo_bedrock.types.model_data_source.ModelDataSource",
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    job_tags: Optional["capo_bedrock.types.tag_list.TagList"] = None,
    imported_model_tags: Optional["capo_bedrock.types.tag_list.TagList"] = None,
    client_request_token: Optional[
        "capo_bedrock.types.idempotency_token.IdempotencyToken"
    ] = None,
    vpc_config: Optional["capo_bedrock.types.vpc_config.VpcConfig"] = None,
    imported_model_kms_key_id: Optional[
        "capo_bedrock.types.kms_key_id.KmsKeyId"
    ] = None,
) -> "capo_bedrock.types.create_model_import_job_response.CreateModelImportJobResponse":
    """<p>Creates a model import job to import model that you have customized in other environments, such as Amazon SageMaker. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">Import a customized model</a> </p>

    Args:
        job_name: <p>The name of the import job.</p>
        imported_model_name: <p>The name of the imported model.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the model import job.</p>
        model_data_source: <p>The data source for the imported model.</p>
        job_tags: <p>Tags to attach to this import job. </p>
        imported_model_tags: <p>Tags to attach to the imported model.</p>
        client_request_token: <p>A unique, case-sensitive identifier to ensure that the API request 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 <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
        vpc_config: <p>VPC configuration parameters for the private Virtual Private Cloud (VPC) that contains the resources you are using for the import job.</p>
        imported_model_kms_key_id: <p>The imported model is encrypted at rest using this key.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.conflict_exception.ConflictException: <p>Error occurred because of a conflict while performing an operation.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock.types.create_model_import_job_request.CreateModelImportJobRequest]",
    ) -> OperationResponse[
        "capo_bedrock.types.create_model_import_job_response.CreateModelImportJobResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.create_model_import_job

        output, http_response = (
            capo_bedrock._operations.amazon_bedrock_control_plane_service.create_model_import_job.create_model_import_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateModelImportJob")
    )
    input_: capo_bedrock.types.create_model_import_job_request.CreateModelImportJobRequest = {
        "job_name": job_name,
        "imported_model_name": imported_model_name,
        "role_arn": role_arn,
        "model_data_source": model_data_source,
    }
    if job_tags is not None:
        input_["job_tags"] = job_tags
    if imported_model_tags is not None:
        input_["imported_model_tags"] = imported_model_tags
    if client_request_token is not None:
        input_["client_request_token"] = client_request_token
    if vpc_config is not None:
        input_["vpc_config"] = vpc_config
    if imported_model_kms_key_id is not None:
        input_["imported_model_kms_key_id"] = imported_model_kms_key_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output