Introduction & Lesson Overview

Welcome to a critical milestone in your SageMaker deployment journey! Over the past four lessons, you've built comprehensive expertise in deploying machine learning models to AWS endpoints. You started by learning how to deploy locally trained models to serverless endpoints, then progressed through deploying SageMaker estimator models and ModelTrainer models to cost-effective serverless infrastructure. Most recently, you mastered real-time endpoint deployment, understanding how to create persistent, always-on infrastructure for high-throughput applications requiring consistently low latency.

Now that you can successfully deploy both serverless and real-time endpoints, you're ready to learn the equally important operational skills of managing these deployed resources. This lesson focuses on the essential management tasks that every SageMaker practitioner must master: checking endpoint status and configuration details, then properly cleaning up resources to avoid ongoing charges.

Understanding Endpoint Management

Understanding endpoint management is crucial because deployed endpoints represent active AWS resources that continue to incur costs until explicitly deleted. Real-time endpoints charge continuously for their provisioned instances, while serverless endpoints charge for actual usage but still maintain configuration resources. Without proper management practices, you can accumulate unnecessary costs from forgotten endpoints or struggle to troubleshoot deployment issues due to a lack of visibility into endpoint status and configuration.

This lesson will teach you two complementary approaches to endpoint management: programmatic management using Python and the SageMaker SDK, and command-line management using the AWS CLI. The Python approach provides detailed programmatic access that's ideal for automation and integration into larger workflows, while the AWS CLI offers quick, interactive commands perfect for manual inspection and cleanup tasks. By mastering both approaches, you'll have the flexibility to choose the most appropriate tool for each management scenario you encounter.

By the end of this lesson, you'll confidently check endpoint status and retrieve detailed configuration information using both Python and AWS CLI methods, understand how to interpret endpoint configuration details to troubleshoot deployment issues, and properly delete endpoints and their associated resources to prevent unnecessary charges. These management skills will complete your SageMaker deployment expertise and prepare you for production environments where endpoint lifecycle management is essential.

Checking Endpoint Status

The first essential skill in endpoint management is checking the status of your deployed endpoints. This capability allows you to monitor which endpoints are currently running, verify their operational state, and quickly identify any endpoints that may require attention. Let's start by exploring how to programmatically check endpoint status using Python and the SageMaker SDK.

The following Python script demonstrates how to retrieve and display the status of all your SageMaker endpoints. This approach builds on the SageMaker session concepts you've used throughout previous lessons, but now focuses on management rather than deployment operations.

This script begins by creating a SageMaker session, which provides access to the SageMaker client that communicates with AWS services. The process follows these key steps:

  1. Create a SageMaker session - Establishes the connection to AWS SageMaker services
  2. Call list_endpoints() - Retrieves information about all endpoints in your AWS account and region
  3. Extract the endpoints array - Accesses the endpoint objects from the API response
  4. Iterate and display results - Processes each endpoint to show name and status information

The response contains an array of endpoint objects, each including much more data than just the endpoint name and current status shown in this example. Each endpoint object also contains the EndpointArn, CreationTime, LastModifiedTime, and other metadata that provides comprehensive information about your deployed resources.

When you run this script, you'll see output similar to this, showing all your currently deployed endpoints:

Checking Endpoint Status with AWS CLI

The AWS CLI provides an equivalent command for quickly checking endpoint status from the command line. This approach is particularly useful for quick status checks or when working in environments where you prefer command-line tools over Python scripts.

This command produces a JSON output that contains the same information as the Python approach, but in a format that's easy to read for manual inspection:

Both approaches provide the essential information you need to understand which endpoints are currently deployed and their operational status. The Python approach offers more flexibility for programmatic processing and integration into larger automation workflows, while the CLI approach provides immediate visibility that's perfect for interactive management tasks.

Inspecting Endpoint Configuration Details

Beyond basic status information, effective endpoint management requires understanding the detailed configuration of your deployed endpoints. This includes information about the underlying compute resources, scaling settings, and model configurations that determine how your endpoints operate and what they cost. Let's explore how to retrieve and interpret these configuration details using both Python and AWS CLI approaches.

The following Python script extends the basic status checking to include detailed configuration information for each endpoint. This comprehensive approach helps you understand exactly how your endpoints are configured and identify any settings that may need adjustment.

This enhanced script performs several important operations to retrieve comprehensive configuration information. First, it uses describe_endpoint() to get detailed information about each endpoint, including the name of the endpoint configuration that defines its compute resources. Then it uses describe_endpoint_config() to retrieve the full configuration details, which include information about instance types, scaling settings, and model specifications.

The configuration details reveal crucial information about how your endpoints are deployed. For serverless endpoints, you'll see ServerlessConfig sections that specify memory allocation and maximum concurrency settings. For real-time endpoints, you'll see InitialInstanceCount and InstanceType specifications that determine the persistent compute resources and their associated costs.

Understanding Endpoint Configurations

Every SageMaker endpoint is associated with an endpoint configuration, which defines the compute resources, scaling options, and model variants that the endpoint will use. The endpoint configuration acts as a blueprint, specifying how your model will be served once the endpoint is deployed. This includes details such as the instance type (for real-time endpoints), serverless settings (for serverless endpoints), and the specific model artifacts to be used.

When you deploy a model to SageMaker, an endpoint configuration is created as part of the deployment process. In most workflows, the endpoint configuration is given the same name as the endpoint itself, making it easy to identify which configuration belongs to which endpoint. However, it is important to understand that the endpoint and its configuration are separate resources: the endpoint is the live, running service, while the configuration is the set of instructions that defines how that service operates.

This separation has important implications for endpoint management. If you delete an endpoint but leave its configuration behind, you'll encounter an error if you try to deploy a new endpoint with the same name. SageMaker will attempt to create a new endpoint configuration with that name, but since a configuration with that name already exists, the deployment will fail with a naming conflict. This is why proper cleanup requires deleting both the endpoint and its associated configuration.

Understanding this relationship between endpoints and their configurations is crucial for avoiding deployment errors and maintaining clean resource organization in your AWS account.

With this understanding of endpoint configurations, let's explore how to inspect the detailed configuration information for your deployed endpoints.

Deleting Endpoints and Their Associated Resources

Proper cleanup of SageMaker endpoints is crucial for cost management and resource organization. When you no longer need an endpoint, you must delete both the endpoint itself and its associated endpoint configuration to avoid ongoing charges and prevent the accumulation of unused resources. This section demonstrates the correct deletion process using both Python and AWS CLI approaches.

The following Python script shows the proper sequence for deleting an endpoint and its configuration. Notice that the endpoint must be deleted before its configuration can be removed, as SageMaker prevents deletion of configurations that are still in use by active endpoints.

This deletion script follows the essential two-step process required for complete endpoint cleanup:

  1. Retrieve endpoint details - Get the endpoint information to identify the associated configuration name, since this information is needed for the second deletion step
  2. Delete the endpoint - Remove the endpoint itself, which immediately stops any running compute resources and prevents further charges
  3. Delete the endpoint configuration - Remove the resource blueprint to complete the cleanup process

The deletion process is particularly important for real-time endpoints, which continue to incur hourly charges for their provisioned instances until explicitly deleted. Serverless endpoints don't have persistent compute costs, but their configurations still consume resource quotas and can create confusion if left accumulating in your account.

The AWS CLI provides equivalent commands for performing the same deletion operations. These commands are useful for quick cleanup tasks or when integrating endpoint management into shell scripts or automation workflows.

Summary & Preparation for Hands-On Practice

Congratulations! You've now mastered the essential skills for managing deployed SageMaker endpoints. This lesson equipped you with the knowledge to check endpoint status and retrieve detailed configuration information using both Python and AWS CLI approaches, understand and interpret endpoint configuration details, and properly delete endpoints and their associated resources to prevent unnecessary charges.

You now have two complementary toolsets for endpoint management: the Python-based programmatic approach that's ideal for automation, and the AWS CLI approach that provides quick, interactive commands perfect for manual management tasks. The management skills you've learned are just as important as deployment skills - while deployment gets your models into production, effective management ensures they continue operating efficiently and cost-effectively over time.

The upcoming practice exercises will challenge you to apply these management skills in realistic scenarios, helping you develop confidence in managing production-ready deployments. Let's dive into the hands-on practice!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal