Cloud Deployment Platforms (AWS SageMaker / GCP Vertex)
Managed cloud ML platforms like AWS SageMaker and GCP Vertex AI abstract away infrastructure management, providing scalable training, one-click deployment, and built-in monitoring for production ML workloads.
AWS SageMaker
SageMaker offers a comprehensive suite covering data labelling, training jobs, hyperparameter tuning, real-time endpoints, batch transform, and model monitoring — all governed by IAM roles and VPC networking.
Deploying a Scikit-Learn Model to a SageMaker Endpoint
<pre><code class="language-python"># Using the SageMaker Python SDK
import sagemaker
from sagemaker.sklearn import SKLearnModel
# Upload model artifact to S3
sagemaker_session = sagemaker.Session()
model_s3_uri = sagemaker_session.upload_data(
path="model.tar.gz", # tarball of model.joblib
bucket="my-ml-bucket",
key_prefix="models/iris-rf"
)
# Define the model
sklearn_model = SKLearnModel(
model_data=model_s3_uri,
role="arn:aws:iam::123456789012:role/SageMakerRole",
entry_point="inference.py", # defines model_fn, predict_fn
framework_version="1.2-1",
py_version="py3"
)
# Deploy as a real-time endpoint
predictor = sklearn_model.deploy(
initial_instance_count=1,
instance_type="ml.t2.medium"
)
# Invoke
import numpy as np
predictor.predict(np.array([[5.1, 3.5, 1.4, 0.2]]))</pre>
SageMaker Key Features
- Training Jobs: Managed distributed training with spot instances
- Autopilot: AutoML for tabular data
- Model Monitor: Built-in data quality and drift monitoring
- Pipelines: Directed acyclic graph (DAG) ML workflows
- Feature Store: Centralised, versioned feature repository
GCP Vertex AI
Vertex AI unifies Google Cloud's ML services under a single API, offering custom training, AutoML, managed endpoints, Feature Store, Model Registry, and Vertex Pipelines (Kubeflow-based).
Deploying to a Vertex AI Endpoint
<pre><code class="language-python">from google.cloud import aiplatform
aiplatform.init(project="my-gcp-project", location="us-central1")
# Upload model (pre-built sklearn container)
model = aiplatform.Model.upload(
display_name="iris-random-forest",
artifact_uri="gs://my-bucket/models/iris-rf/",
serving_container_image_uri="us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-4:latest"
)
# Create endpoint and deploy
endpoint = aiplatform.Endpoint.create(display_name="iris-endpoint")
endpoint.deploy(
model=model,
machine_type="n1-standard-2",
min_replica_count=1,
max_replica_count=5 # auto-scales
)
# Predict
response = endpoint.predict(instances=[[5.1, 3.5, 1.4, 0.2]])
print(response.predictions)</pre>
Choosing Between Platforms
The right platform depends on your organisation's existing cloud footprint, data residency requirements, and preferred pricing model.
Quick Comparison
- AWS SageMaker: Most mature, widest feature set, deep AWS ecosystem integration
- GCP Vertex AI: Strong AutoML, native BigQuery/BigTable integration, Kubeflow pipelines
- Azure ML: Best for Microsoft-centric shops, strong enterprise identity integration
- All three support custom containers, so you're not locked into their native SDKs