AWS, Cloud Computing, DevOps

3 Mins Read

Custom Containers with BYOC in Amazon SageMaker


Amazon SageMaker is a fully managed machine learning service that Amazon Web Services (AWS) provides. It is designed to help developers and data scientists build, train, and deploy machine learning models at scale. Amazon SageMaker provides a comprehensive set of tools and capabilities to streamline the entire machine learning workflow, from data preparation and model training to deployment and monitoring.

BYOC (Bring Your Own Containers) in Amazon SageMaker

BYOC in Amazon SageMaker stands for “Bring Your Own Container.” It refers to the capability of Amazon SageMaker that allows you to use custom Docker containers to train and deploy machine learning models.

Typically, Amazon SageMaker provides built-in algorithms and pre-configured environments for popular machine learning frameworks. However, there may be cases where we have unique or proprietary algorithms, dependencies, or specific requirements that are not available in the built-in options. In such scenarios, BYOC enables us to bring our own container with the necessary software and configurations.

With BYOC in Amazon SageMaker, we can package your custom training or inference code and any required dependencies into a Docker container. This container can be built and hosted in a container registry, such as Amazon Elastic Container Registry (ECR) or Docker Hub. SageMaker can then pull and use this custom container for training or inference tasks.

Using a custom container gives us more flexibility and control over the machine learning environment. We can use any machine learning framework, language, or library of your choice within the container. This allows us to leverage our existing codebase, proprietary algorithms, or specific software versions while benefiting from the managed infrastructure and scalability Amazon SageMaker provides.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Steps to Implement BYOC in Amazon SageMaker

  1. Build and package your custom training or inference code and dependencies into a Docker container.
  2. Push the container to a container registry, such as Amazon ECR or Docker Hub.
  3. Specify the custom container and location when creating an Amazon SageMaker training job or inference endpoint.
  4. Amazon SageMaker will then pull the custom container and execute the training or inference tasks within that container.

How to Deploy BYOC as an Inference Endpoint

  1. Prepare your custom Docker container: Build and package your custom inference code, dependencies, and model artifacts into a Docker container. Ensure your container adheres to the Amazon SageMaker container requirements, including the necessary environment variables and file structure.
  2. Push the container to a container registry: Upload your custom Docker container to an Amazon Elastic Container Registry (ECR). This step enables Amazon SageMaker to access and deploy your container.
  3. Create an inference script: Prepare an inference script that the deployed endpoint will execute. The script should define how to load the model, process incoming requests, and generate the desired inference results.
  4. Create Amazon SageMaker model: Define the Amazon SageMaker model by specifying the container image, the IAM role with appropriate permissions, and any other necessary configurations. The model is a blueprint for deploying the container as an inference endpoint.
  5. Create an endpoint configuration: Configure the deployment settings for the inference endpoint, such as instance type, scaling behavior, and other deployment options. The endpoint configuration provides instructions on how the endpoint should be created and managed.
  6. Create the inference endpoint: Use the model and endpoint configuration to create the actual SageMaker inference endpoint. This step provisions the necessary compute resources and starts the container with your custom code.


In this era of advancement of Machine learning services, data scientists and machine learning engineers require a feature that does most of the things with more effectiveness such that they can spend their time playing with data and understanding them to create a good model. To overcome this situation, BYOC in Amazon SageMaker enables them to easily deploy their models as an endpoint without custom dependency on others. By leveraging BYOC and the Amazon SageMaker platform, developers and data scientists can harness the benefits of managed infrastructure, scalability, and integration with other AWS services, while still having the flexibility to utilize custom code and configurations for their machine learning workflows.

Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.

  • Reduced infrastructure costs
  • Timely data-driven decisions
Get Started

About CloudThat

CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Drop a query if you have any questions regarding Amazon SageMaker, I will get back to you quickly.

To get started, go through our Consultancy page and Managed Services Package, CloudThat’s offerings.


1. What is BYOC?

ANS: – BYOC is bringing our own container package into Amazon SageMaker Environment to benefit from the machine learning power of AWS.

2. What is Endpoint Configuration?

ANS: – Endpoint Configuration is the setting to create the endpoints, which consists of different production variants and parameters such as All Traffic, Instance Type, model name, etc.

3. What is ECR?

ANS: – ECR stands for Elastic Container Registry, it is a managed service in AWS which helps to store the custom built or prebuilt image in the form of a repository.

WRITTEN BY Arslan Eqbal



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!