How to Deploy DeepSeek-R1 on AWS: A Practical MLOps Guide
Learn how to choose an AWS deployment path, estimate GPU memory, compare managed inference with self-hosting, and build a safer serving workflow for DeepSeek-R1 and its smaller distilled models.
Quick answer: Which AWS deployment path should you choose?
Start with the smallest deployment that meets your quality, privacy, latency, and throughput requirements. For many teams, a distilled checkpoint or a managed endpoint is a more practical first step than self-hosting the full 671B model.
Managed model endpoint
Consider Amazon SageMaker AI model deployment or an AWS-supported model catalog path when you want AWS to manage more of the serving infrastructure.
Self-managed GPU serving
Use EC2 GPU instances and a serving runtime such as vLLM when you need control over the container, model configuration, scaling, and observability.
Distilled model deployment
Evaluate a 7B, 14B, 32B, or 70B distilled model first. Smaller models can reduce infrastructure complexity, although output quality and task fit must be tested.
Prototype before production
Measure real prompts, concurrency, context lengths, tokens per second, and total cost before committing to a GPU fleet.
1. Understand the DeepSeek-R1 model before provisioning GPUs
The DeepSeek project lists the full DeepSeek-R1 checkpoint at 671B total parameters and 37B activated parameters, with a 128K context length in its published model information. It also provides distilled checkpoints based on Qwen and Llama model families, including 1.5B, 7B, 8B, 14B, 32B, and 70B variants.
These are different deployment profiles. A distilled 7B model and the full 671B MoE model should not be treated as interchangeable infrastructure workloads. Test the exact checkpoint, tokenizer, serving runtime, quantization format, and prompt template you plan to use.
| Model family | What it means for deployment | Typical first step |
|---|---|---|
| Full DeepSeek-R1 (671B) | Large multi-GPU or multi-node serving project. Weight format, KV cache, runtime support, and networking are critical. | Benchmark with an experienced ML infrastructure team. |
| Distill 70B / 32B | Still requires serious GPU planning, but is substantially smaller than the full checkpoint. | Prototype on a suitable multi-GPU host. |
| Distill 14B / 8B / 7B | More accessible for experimentation and lower-throughput applications. | Start with a single-GPU or modest multi-GPU test where supported. |
| Distill 1.5B | Smallest listed family member; useful for testing constrained workloads, subject to task quality. | Run a controlled quality and latency evaluation. |
Model sizes and context limits are model-card facts, not a guarantee that every runtime, quantization, or AWS instance supports every configuration.
2. Compare AWS deployment options
Amazon SageMaker AI
SageMaker AI provides managed model deployment workflows. You select model artifacts or a supported model deployment option, choose an inference configuration, and create an endpoint. AWS also documents Large Model Inference containers and their support for model-parallel serving features. Confirm the exact model, container, instance, and region combination before deployment.
Amazon EC2 with vLLM
EC2 gives you direct control over the GPU host and serving stack. You are also responsible for operating-system updates, drivers, CUDA compatibility, container lifecycle, monitoring, network security, capacity planning, and recovery procedures.
Amazon Bedrock and model catalog options
AWS has published options for accessing DeepSeek-R1 through AWS model services and SageMaker-related model deployment experiences. Availability and commercial terms can change. Check the current model catalog in your AWS account and region before designing around a particular option.
3. Estimate GPU memory before you deploy
A first-pass weight estimate is:
Weight memory (decimal GB) ≈ parameter count × bytes per parameter ÷ 1,000,000,000.
For the full 671B model, a simple theoretical estimate is about 1,342 GB at 16 bits per parameter, 671 GB at 8 bits, or 335.5 GB at 4 bits. These are arithmetic estimates, not guaranteed checkpoint sizes. Quantization metadata, scales, alignment, runtime buffers, temporary allocations, and KV cache add overhead.
VRAM planning calculator
How to interpret the estimate
- Use the actual checkpoint precision, not a marketing label.
- Do not assume 37B active parameters determines weight storage.
- Include the intended context length and concurrency in real benchmarks.
- GPU count is a rough capacity division, not a recommended topology.
- For multi-GPU serving, confirm supported tensor, pipeline, or expert parallelism.
4. DeepSeek-R1's Mixture-of-Experts architecture
DeepSeek-R1 uses a Mixture-of-Experts (MoE) architecture. In an MoE model, routing selects a subset of expert components for a token rather than activating every expert in the same way for every token. The model's published 671B total and 37B activated parameter counts describe different aspects of the architecture.
MoE can reduce the amount of expert computation used per token compared with a dense model of similar total parameter count. It does not remove the need to store and distribute the model weights. Memory, communication, routing behavior, and runtime implementation all matter.
Conceptual request flow
- A request is tokenized and passed into the model.
- Routing components select the expert computation used for relevant tokens.
- Selected experts process their portions of the workload.
- Outputs are combined and passed through subsequent model layers.
- The serving runtime streams generated tokens back to the client.
This is a simplified conceptual explanation, not a complete diagram of DeepSeek's internal implementation.
5. Self-managed deployment workflow with EC2 and vLLM
This workflow is a starting template for a compatible GPU instance and a model/runtime combination supported by your installed vLLM release. It is not a turnkey command for every DeepSeek-R1 checkpoint or quantization format.
Step 1: Prepare the AWS environment
- Choose an AWS Region and confirm GPU instance availability and service quotas.
- Use a dedicated VPC and private subnets where practical.
- Attach an IAM role with only the S3 and model-registry permissions required.
- Configure encrypted storage and restrict inbound access to approved clients.
- Install a supported NVIDIA driver and container runtime using the current AWS Deep Learning AMI or your validated image.
Step 2: Confirm GPU visibility
nvidia-smi
docker --version
python3 --version
Do not proceed until the host can see the expected GPUs and the driver/runtime combination is compatible with your container.
Step 3: Install or pull a compatible vLLM image
Use the official vLLM installation guidance and select a release that explicitly supports your model architecture and hardware. Pin the image by version or digest after testing rather than relying on an unpinned latest tag.
# Example only: use a vLLM image/version validated for your model.
docker pull vllm/vllm-openai:latest
# Verify the image before production use.
docker image inspect vllm/vllm-openai:latest
Step 4: Start a single-node multi-GPU server
For a host with eight visible GPUs, tensor parallel size 8 is a common starting point for a model that fits across those GPUs. The correct topology depends on the model and runtime. Check the current vLLM model recipe before selecting flags.
# Example template — verify supported flags and model format first.
export HF_TOKEN="YOUR_READ_ONLY_MODEL_ACCESS_TOKEN"
docker run --gpus all --ipc=host \
-p 8000:8000 \
-e HUGGING_FACE_HUB_TOKEN="$HF_TOKEN" \
vllm/vllm-openai:latest \
--model deepseek-ai/DeepSeek-R1 \
--tensor-parallel-size 8 \
--max-model-len 8192
The command is illustrative. A full 671B checkpoint may require a different precision, memory profile, serving recipe, or multi-node topology. Do not expose port 8000 directly to the public internet. Put authentication, TLS, rate limiting, and network controls in front of the service.
Step 5: Send a test request
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/DeepSeek-R1",
"messages": [
{"role": "user", "content": "Explain how a load balancer works."}
],
"temperature": 0.6,
"max_tokens": 512
}'
Check server logs, response correctness, time to first token, output tokens per second, GPU utilization, memory use, and error rates. Use representative prompts rather than a single short test.
6. Managed deployment with Amazon SageMaker AI
SageMaker deployment generally involves selecting model artifacts and a container, configuring an endpoint, and invoking that endpoint. For large language models, AWS documents Large Model Inference containers and model-parallel deployment patterns. The exact code depends on the selected model package, container version, instance type, and deployment route.
- Open the SageMaker AI model catalog or the relevant model deployment workflow in your AWS account.
- Find the exact DeepSeek-R1 or distilled model variant you intend to deploy.
- Review model terms, supported regions, supported instance types, and container/runtime requirements.
- Choose an endpoint configuration based on measured memory and throughput needs.
- Deploy to a test endpoint and validate with representative requests.
- Configure autoscaling, alarms, logging, access controls, and a documented rollback process before production traffic.
Official references: SageMaker model deployment workflow · Large Model Inference container documentation.
7. AWS GPU hardware: compare capacity, not just instance names
AWS publishes the accelerator and memory specifications for its EC2 accelerated-computing families. The figures below are hardware specifications, not a claim that a particular DeepSeek configuration will run successfully or achieve a specific latency.
| Instance family | Accelerators | Aggregate accelerator memory | Practical note |
|---|---|---|---|
| p5.48xlarge | 8 × NVIDIA H100 | 640 GB HBM3 | High-end single-node GPU option; 640 GB is not enough for every full-model precision after runtime overhead. |
| p5e.48xlarge | 8 × NVIDIA H200 | 1,128 GB HBM3e | More memory capacity than P5; confirm region, quota, pricing, and model/runtime support. |
| p5en.48xlarge | 8 × NVIDIA H200 | 1,128 GB HBM3e | H200 platform with updated host/network characteristics; validate your workload. |
| p4de.24xlarge | 8 × NVIDIA A100 80GB | 640 GB HBM2e | Legacy-generation GPU option; check availability and compatibility. |
| inf2.48xlarge | 12 × AWS Inferentia2 | 384 GB accelerator memory | Requires an AWS Neuron-compatible model and software path; do not assume CUDA/vLLM commands apply unchanged. |
Always verify current availability, quotas, and regional pricing in AWS. Instance specifications can be updated. Sources: AWS accelerated computing specifications and EC2 instance type specifications.
8. Compare self-hosting costs with an API or managed endpoint
There is no universal break-even point. Your result depends on input/output token volume, the model's actual throughput, GPU utilization, instance pricing, storage, data transfer, support, and engineering time. Use your own quotes and measured throughput instead of copying a fixed hourly price into a business case.
Monthly cost estimator
Illustrative monthly comparison
Based only on the assumptions entered in the calculator. Does not include engineering labor, taxes, commitments, support, or throughput constraints.
Self-hosting estimate
$72,040API estimate
$110Update assumptions to compare your scenario.
9. Production security, reliability, and MLOps checklist
Identity and access
- Use least-privilege IAM roles.
- Store model tokens and credentials in a secrets manager.
- Rotate credentials and audit access.
- Keep inference endpoints private where possible.
Network and data
- Require TLS for client connections.
- Use security groups and private networking.
- Encrypt storage and backups.
- Define retention rules for prompts and outputs.
Monitoring
- Track request volume and error rates.
- Measure time to first token and tokens per second.
- Alert on GPU memory pressure and host failures.
- Monitor queue depth and throttling.
Reliability and cost
- Load-test peak concurrency.
- Test restarts and model reload behavior.
- Set budget alerts and quota alarms.
- Document rollback and capacity procedures.
Operational risks to plan for
| Risk | Why it matters | Mitigation |
|---|---|---|
| GPU memory exhaustion | Long contexts, concurrent requests, and runtime buffers increase memory demand. | Benchmark realistic workloads, set context/concurrency limits, and monitor KV cache. |
| High idle cost | Large GPU instances can accrue substantial charges while underused. | Schedule nonproduction resources, use autoscaling where suitable, and evaluate batch workloads. |
| Cold starts and model loading | Large weight files can make startup slow and complicate recovery. | Measure load times, optimize artifact delivery, and maintain a tested warm-capacity strategy. |
| Runtime incompatibility | Driver, CUDA, container, model, and quantization versions can conflict. | Pin tested versions and run a preproduction compatibility test. |
| Public endpoint exposure | Unauthenticated inference endpoints can be abused and generate unexpected costs. | Use authentication, TLS, network restrictions, rate limits, and request quotas. |
Frequently asked questions
1. How much GPU memory does the full DeepSeek-R1 model need?
It depends on the weight format, quantization implementation, KV cache, context length, concurrency, and runtime overhead. A simple 16-bit estimate for 671B parameters is about 1,342 GB for weights alone. That is not a complete deployment requirement.
2. Does 37B activated parameters mean I only need memory for 37B parameters?
No. Activated parameters describe the portion used for a token's computation in the MoE design. The full model weights still need to be stored and made available to the serving system.
3. Can I run the full model on one p5.48xlarge?
Do not assume so. A p5.48xlarge has 640 GB of aggregate H100 memory. Whether a particular checkpoint fits depends on its actual weight format and additional memory requirements. FP8 weight arithmetic for 671B parameters alone is approximately 671 GB before overhead.
4. Should I start with a distilled model?
Often, yes. A distilled 7B, 14B, 32B, or 70B checkpoint may be a more manageable way to test application quality and operating costs before investing in full-model infrastructure.
5. Is SageMaker or EC2 better?
SageMaker offers managed deployment workflows. EC2 provides more direct infrastructure and runtime control but requires more operations work. Choose based on your team's skills and requirements.
6. Can vLLM use multiple GPUs?
Yes. vLLM documents tensor parallelism for multi-GPU single-node inference and combinations of tensor and pipeline parallelism for multi-node deployments. The correct configuration depends on model size, GPU topology, and runtime support.
7. Can DeepSeek-R1 run on AWS Inferentia2?
AWS documents Inferentia2 and Neuron deployment paths for supported models and variants. Confirm that the exact checkpoint and software stack you plan to use are supported. CUDA-based vLLM instructions do not automatically transfer to Neuron.
8. What is the cheapest way to test DeepSeek-R1?
Start by evaluating a hosted API or a smaller distilled checkpoint. This lets you test product fit and traffic patterns before provisioning expensive GPU infrastructure.
9. Does self-hosting guarantee data privacy?
No. Self-hosting can give you more control over infrastructure and data paths, but privacy depends on access controls, logging, network design, retention, backups, and operational practices.
10. Are the calculator results production sizing recommendations?
No. They are planning estimates. Confirm sizing with the selected model checkpoint, runtime documentation, startup logs, and representative load tests.
