SOP - Deploying vLLM on Amazon Linux
Version: 1.0
Platform: Amazon Linux 2023
Deployment Method: Docker (Recommended)
Audience: System Administrators, DevOps Engineers, AI/ML Engineers
1. Purpose
This document describes the recommended procedure for deploying vLLM on Amazon Linux 2023 using the official AWS Deep Learning Container (DLC).
Using the AWS DLC is the simplest and most reliable deployment method because AWS maintains the container image with:
- CUDA libraries
- NVIDIA GPU drivers compatibility
- PyTorch
- vLLM
- Optimized runtime libraries
This approach avoids installing CUDA toolkits and compiling C++ dependencies directly on the operating system.
2. Prerequisites
Hardware
- NVIDIA GPU EC2 Instance
- g5
- g6
- p4
- p5
- Other CUDA-capable GPU instances
Operating System
- Amazon Linux 2023
Note: Amazon Linux 2 has reached end of support and is not recommended.
3. Architecture
+-------------------------+
| Amazon Linux 2023 EC2 |
+-----------+-------------+
|
Docker Engine
|
AWS Deep Learning Container
|
NVIDIA Runtime
|
CUDA
|
vLLM
|
OpenAI Compatible API
|
Port 8000 (HTTP)4. Install Docker
Update the system.
sudo dnf update -yInstall Docker.
sudo dnf install docker -yEnable Docker.
sudo systemctl enable docker
sudo systemctl start dockerVerify Docker.
docker --version5. Install NVIDIA Container Toolkit
Install the NVIDIA container runtime.
Follow the NVIDIA Container Toolkit installation guide appropriate for Amazon Linux 2023.
Restart Docker afterward.
sudo systemctl restart dockerVerify GPU visibility.
docker run --rm --gpus all nvidia/cuda:12.8.0-base-ubuntu22.04 nvidia-smiExpected output should display the NVIDIA GPU information.
6. Prepare Hugging Face Cache
Create a local cache directory.
mkdir -p ~/.cache/huggingfaceIf using gated or private models, create a Hugging Face access token and export it:
export HF_TOKEN=<your_token>7. Pull the AWS vLLM Container
Download the official AWS Deep Learning Container.
docker pull public.ecr.aws/deep-learning-containers/vllm:latest-gpu-py312-cu130-ubuntu22.04-ec2This image includes:
- CUDA
- PyTorch
- Python 3.12
- vLLM
- Optimized GPU runtime
8. Start the vLLM Server
Run a model using Docker.
docker run --rm \
--gpus all \
-p 8000:8000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-e HF_TOKEN=$HF_TOKEN \
public.ecr.aws/deep-learning-containers/vllm:latest-gpu-py312-cu130-ubuntu22.04-ec2 \
--model facebook/opt-125mThe server will automatically:
- Download the model (first launch)
- Cache model files
- Start an OpenAI-compatible API server
- Listen on port 8000
9. Access the API
Verify the server is running.
curl http://localhost:8000/v1/modelsExample response:
{
"data": [
{
"id": "facebook/opt-125m"
}
]
}10. Example: Run Gemma 4
Replace the model argument with your desired Hugging Face model.
docker run --rm \
--gpus all \
-p 8000:8000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-e HF_TOKEN=$HF_TOKEN \
public.ecr.aws/deep-learning-containers/vllm:latest-gpu-py312-cu130-ubuntu22.04-ec2 \
--model google/gemma-4-12bNote: Ensure your Hugging Face account has accepted the model license if the model is gated.
11. Verify GPU Usage
Check GPU utilization.
nvidia-smiYou should see:
- Python process
- CUDA memory usage
- GPU utilization
12. Stopping the Server
If running interactively:
CTRL+CIf running detached:
docker ps
docker stop <container-id>13. Optional: Run in Background
Launch the container in detached mode.
docker run -d \
--name vllm \
--restart unless-stopped \
--gpus all \
-p 8000:8000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-e HF_TOKEN=$HF_TOKEN \
public.ecr.aws/deep-learning-containers/vllm:latest-gpu-py312-cu130-ubuntu22.04-ec2 \
--model google/gemma-4-12bUseful Docker commands:
View logs:
docker logs -f vllmStop:
docker stop vllmRestart:
docker restart vllm14. Alternative: Native Installation (Advanced)
Native installation is intended only for advanced users who require a non-containerized deployment.
Requirements:
- Amazon Linux 2023
- Python 3.9 or later
- GCC/G++
- CUDA Toolkit
- Matching PyTorch with CUDA support
Example:
sudo dnf install python3 gcc gcc-c++ git -y
pip install torch torchvision torchaudio
pip install vllmDuring installation, pip compiles the required CUDA and C++ extensions locally. This process is slower and more prone to version mismatches than the Docker-based deployment.
15. Troubleshooting
| Issue | Possible Cause | Resolution |
|---|---|---|
No NVIDIA devices found | NVIDIA Container Toolkit not installed or configured | Install the NVIDIA Container Toolkit and restart Docker. |
| Model download fails | Missing or invalid HF_TOKEN | Export a valid Hugging Face access token and ensure you have accepted the model's license. |
| CUDA out of memory | Model exceeds available GPU memory | Use a smaller model, enable tensor parallelism, or select a larger GPU instance. |
| Port 8000 unavailable | Another service is already using the port | Stop the conflicting service or map vLLM to a different host port (for example, -p 8080:8000). |
| Slow first startup | Initial model download | Subsequent launches will use the cached model files in ~/.cache/huggingface. |
16. Best Practices
- Use Amazon Linux 2023 for new deployments.
- Prefer the AWS Deep Learning Container over native installations.
- Store Hugging Face models in a persistent cache volume to avoid repeated downloads.
- Use
--restart unless-stoppedor asystemdservice to ensure automatic recovery after reboots. - Restrict network access to the vLLM API using AWS Security Groups or a reverse proxy if the service is not intended to be publicly accessible.
- Monitor GPU utilization and memory usage with
nvidia-smito optimize model placement and performance.
17. References
- AWS Deep Learning Containers (DLC)
- vLLM Documentation
- Hugging Face Model Hub
- NVIDIA Container Toolkit Documentation