Skip to main content
In this lesson you’ll learn how to host a trained model in Amazon SageMaker by creating and using SageMaker endpoints. This is a demonstration-oriented walkthrough using SageMaker Studio (Jupyter notebooks) and the AWS Management Console. We’ll show both low-level (Boto3) and high-level (SageMaker Python SDK) approaches so you can compare patterns for model registration, endpoint creation, and invoking inference. What we’ll cover
  • Create an endpoint configuration and endpoint via the Boto3 SDK.
  • Create a model and endpoint using the SageMaker Python SDK (single-flow approach).
  • Compare invocation methods: Boto3 invoke_endpoint vs SageMaker SDK Predictor.
  • Test and clean up endpoints to avoid incurring charges.
High-level demo steps (what we’ll run from the notebook):
A dark-blue presentation slide titled "Demo Steps" listing three numbered steps. The steps instruct confirming a model package is available, running a Jupyter notebook with boto3 to create and test SageMaker endpoint/config, and running a notebook with the SageMaker SDK to create and test the endpoint using the Predictor class.
We’ll use the SageMaker SDK Predictor for the SDK example and Boto3’s invoke_endpoint for the Boto3 example so you can see the differences in interaction style. Getting started in SageMaker Studio All commands in this demo are executed from a JupyterLab notebook inside SageMaker Studio. Here is the JupyterLab Launcher in SageMaker Studio where the notebooks live:
A screenshot of a JupyterLab / SageMaker notebook interface with a file browser on the left listing a "sagemaker-demystified" project and several notebooks and files. The main pane shows a Launcher with tiles for Python 3, Glue PySpark, SparkMagic kernels, consoles, and other items like Terminal, Text File, and Markdown File.
Open the notebook named “Inference Demo” and run the steps below.
  1. Initialize the notebook: import libraries, create a SageMaker session, obtain the execution role, and set an S3 bucket/prefix for model artifacts
When you run it you may see SDK informational logs followed by the printed role and bucket values. Example:
  1. Upload the model artifact to S3 (if applicable) and determine the container image URI for hosting
  • If your model was produced by a training job, you can skip the upload and reference the training job’s output S3 URI directly.
  • For models that were saved locally in the notebook environment, upload to S3 and then choose the appropriate container image (this demo uses Linear Learner).
Example output:
If your model artifact is already available from a training job’s output, you can skip the upload step and reference the existing training output S3 path.
  1. Create a SageMaker model object (register the model in SageMaker)
The SageMaker SDK Model constructs a model resource in SageMaker that maps the container image to the model artifact and IAM role. Only when you call model.create() is the model created in SageMaker.
After this step, confirm in the AWS Management Console under Inference → Models that the model package house-prices-inference-demo exists with the matching model artifact and container image. Example resource values you may see (for reference):
  1. Create an endpoint configuration using Boto3
When using Boto3 you create an Endpoint Configuration first. The config defines production variants—mapping models to instance types, counts, and traffic weights. Below we create a single variant consuming all traffic.
Validate the endpoint configuration in the Console at Inference → Endpoint configurations.
  1. Create the SageMaker endpoint that references the endpoint configuration
Once started, the endpoint will appear in the Console (Inference → Endpoints) with status Creating. Provisioning typically takes several minutes. The console provides an endpoint summary, the ARN, and operational metrics while the endpoint is being created:
A screenshot of the Amazon SageMaker console showing an endpoint named "my-endpoint-using-boto3" with status "Creating," plus its ARN/URL and endpoint summary. The page also shows monitoring tabs and operational metrics panels (CPU/Memory).
Two important notes:
  • Boto3 requires a two-step process: create the endpoint configuration, then create the endpoint that references it.
  • The SageMaker Python SDK provides higher-level constructs to create model and endpoint resources in fewer lines of code and supports using Predictor for inference.
SageMaker Studio and the AWS Management Console show related but slightly different views. Studio lists endpoints under Deployments → Endpoints, but it does not display endpoint configuration objects separately. To inspect endpoint configurations directly, use the Management Console (Inference → Endpoint configurations) or enumerate them via SDK calls.
Optional: Poll for endpoint creation completion (Boto3) Use this snippet to wait for the endpoint to transition to InService or to report failures. This is useful for automation in notebooks or CI pipelines.
Testing and invocation
  • For the Boto3-based endpoint, call the runtime invoke_endpoint API to send binary/payload requests and receive the response.
  • For the SDK-based endpoint (later in the notebook), use the Predictor class which wraps serialization/deserialization and runtime invocation in a convenient interface.
Cleanup to avoid charges When finished, delete endpoint resources:
Resource and command summary Links and references Next steps in the notebook
  • Run the SDK-based example that builds the Model and endpoint using higher-level APIs and then uses Predictor to make requests.
  • Compare the two invocation styles (Boto3 vs Predictor) for serialization, error handling, and convenience.
  • Delete the endpoint, endpoint configuration, and model resources to avoid ongoing charges.

Watch Video