How to Deploy a Hugging Face Model to AWS in 10 Minutes
A step-by-step guide to deploying any Hugging Face model to AWS SageMaker.
How to Deploy a Hugging Face Model to AWS in 10 Minutes
You have a trained model on Hugging Face. You need it in production. Not in a notebook — behind an API, serving real traffic. Here's how to do it in 10 minutes with Roptal, without writing a single line of infrastructure code.
Prerequisites
- A GitHub repository with your model code (FastAPI, Flask, Streamlit, or Gradio)
- An AWS account with programmatic access (IAM user with EC2, ECR, and SageMaker permissions)
- A Roptal account (free to start)
Step 1: Connect Your GitHub Repository
Roptal Dashboard → Repositories → Connect GitHub
Authorize the Roptal GitHub App. Select only the repository you want to deploy. Roptal never gets access to your entire GitHub account — permissions are scoped to selected repos.
Once connected, Roptal scans your repository:
- Detects the framework (FastAPI 0.104 detected)
- Identifies Python version and dependencies
- Checks for CUDA requirements, exposed ports, system libraries
- Analyzes entry points and model files
Step 2: Review Your Deployment Configuration
Roptal auto-generates four files:
- Dockerfile — Production-optimized. Multi-stage build, non-root user, health checks built in. No need to write a single line.
- docker-compose.yml — For local testing before cloud deployment
- dockerignore — Excludes unnecessary files (venv, .git, caches)
- requirements.txt — Pinned versions, production-only dependencies
You can review and edit these before deploying. The generated Dockerfile uses best practices: slim base images (python:3.11-slim), non-root user (uid 1000), explicit health checks, and layer caching optimization.
Step 3: Add AWS Credentials
Roptal Dashboard → Settings → Credentials → Add Provider → AWS
Enter your AWS Access Key ID and Secret Access Key. Roptal encrypts credentials at rest using AES-256-GCM with envelope encryption. Your keys never leave your Roptal account and are only used during deployment.
Required IAM permissions:
ecr:CreateRepository
ecr:GetAuthorizationToken
ecr:BatchCheckLayerAvailability
ecr:InitiateLayerUpload
ecr:UploadLayerPart
ecr:CompleteLayerUpload
ecr:PutImage
sagemaker:CreateModel
sagemaker:CreateEndpointConfig
sagemaker:CreateEndpoint
Step 4: Deploy
Roptal Dashboard → Your Repository → Deploy → AWS (us-east-1)
Hit deploy. Roptal:
- Builds a production Docker image
- Pushes it to Amazon ECR
- Creates a SageMaker model and endpoint configuration
- Provisions the endpoint (starts with a single ml.g4dn.xlarge)
Live logs stream to your dashboard. You'll see:
[runtime] Building Docker image...
[runtime] Image built: roptal/acme-sentiment:v1.0
[runtime] Pushing to ECR... [████████████████] 100%
[aws] Creating SageMaker endpoint...
[aws] Endpoint status: Creating → InService
[aws] Endpoint ready: https://runtime.sagemaker.us-east-1.amazonaws.com/...
Deployment time: ~8 minutes from click to live endpoint.
Step 5: Test Your Endpoint
curl -X POST https://your-endpoint.amazonaws.com/predict \
-H "Content-Type: application/json" \
-d '{"text": "This product is amazing!"}'
Response:
{
"label": "POSITIVE",
"score": 0.987
}
Going Further
Add monitoring: Roptal automatically tracks endpoint health, latency, and request volume. Set up budget alerts to avoid surprise bills.
Enable canary deployments: When you push an updated model, deploy as a canary (10% traffic) first. Roptal monitors error rates and latency before promoting to 100%.
Cross-cloud failover: Add GCP credentials and deploy a backup endpoint. If AWS goes down, Roptal can shift traffic with one click.
The Hard Way (Without Roptal)
Here's what the same deployment looks like manually:
- Write a Dockerfile from scratch (30 min)
- Set up ECR repository, authenticate Docker (15 min)
- Build and push image (10 min)
- Create SageMaker model JSON config (20 min)
- Create endpoint configuration (15 min)
- Wait for endpoint to provision (10-15 min)
- Set up CloudWatch monitoring (30 min)
Total: ~2 hours if you know what you're doing. Days if you don't.
With Roptal: 10 minutes. Every time.
Try It Yourself
Roptal is launching with early access soon. The platform will support AWS, GCP, Azure, RunPod, Railway, and Hugging Face Spaces — all from one control plane.