Bringing Externally Trained Models to AWS
This lesson explains how to deploy models trained or fine-tuned elsewhere, on premises, in another cloud or from open-source repositories, with SageMaker AI and Amazon Bedrock Custom Model Import.
Learning outcomes
After completing this lesson, you will be able to:
- Host external models on SageMaker AI.
- Import supported open-weight models with Bedrock Custom Model Import.
- Choose the path for an external model.
Hosting external models on SageMaker AI
SageMaker AI can host any model whose artefacts can be served by a container. For supported frameworks, package the trained weights (and, if needed, an inference.py with model_fn, input_fn, predict_fn and output_fn) as model.tar.gz in S3, and create a model with the matching prebuilt framework image: PyTorch, TensorFlow, scikit-learn, XGBoost, Hugging Face or a large model inference (LMI) container for LLMs. Hugging Face Hub models can be deployed by model ID. Models in other formats can be converted (for example, to ONNX) or served with an extended container.
Host your own model
Amazon Bedrock Custom Model Import
Custom Model Import brings open-weight models that you have fine-tuned elsewhere into Bedrock, so they are invoked through the same serverless Bedrock runtime APIs as other models. Supported architectures include families such as Llama, Mistral, Mixtral, Qwen and GPT-OSS, with weights in Hugging Face safetensors format imported from S3 or from a SageMaker AI model. Importing is free; inference is billed by the number of active model copies over time (in five-minute windows), measured in custom model units, and copies scale automatically with traffic, including down to zero, so the first request after idle can see a cold start.
Choosing the path
Models trained elsewhere, or open-weight models customised outside AWS, can be brought to AWS in several ways. Amazon Bedrock Custom Model Import serves supported open-weight architectures through the Bedrock APIs, with serverless scaling and no infrastructure to manage. Amazon Bedrock Marketplace offers specialised models deployed to managed endpoints. A SageMaker AI endpoint hosts any model the team can package in a container, with full control over hardware and serving. The choice depends on whether the model's architecture is supported and how much control the team needs. The following table summarises the choice.
| Situation | Path |
|---|---|
| Fine-tuned model of a supported architecture; want serverless Bedrock APIs, guardrails, knowledge bases | Bedrock Custom Model Import |
| Unsupported architecture or custom inference code | SageMaker AI endpoint |
| Classic ML model (scikit-learn, XGBoost) trained on premises | SageMaker AI endpoint with framework container |
| Need GPU-level control, custom batching or quantisation | SageMaker AI endpoint with LMI container |
The following diagram shows the path for importing a fine-tuned Llama model from an on-premises environment into Amazon Bedrock.

Bring the model in
A fine-tuned Llama model
A research team fine-tuned a Llama-family model on premises and wants product teams to use it through the same Converse API and Bedrock Guardrails they already use, without managing GPUs. Traffic is irregular.
- Upload the safetensors weights, config and tokeniser files to S3.
- Run a Custom Model Import job; the model gets a Bedrock model ARN.
- Product teams call the imported model ARN with the Bedrock runtime, with their existing guardrail.
Because copies scale with demand and are billed only while active, irregular traffic costs less than an always-on GPU endpoint. A SageMaker AI endpoint would also work but would leave GPU capacity and a separate API for the product teams to manage.
Which weights format does Bedrock Custom Model Import use?
Show answer
Hugging Face safetensors, from S3 or SageMaker AI.
Exam Tips
Remember for the exam
- Supported open-weight architecture, serverless Bedrock API: Custom Model Import.
- Custom Model Import uses Hugging Face safetensors weights from S3 or SageMaker AI.
- Imported models are billed by active model copies; cold starts can occur after idle.
- Any framework or custom inference code: SageMaker AI endpoint.
- Package SageMaker artefacts as model.tar.gz in S3.