Deploy DeepSeek R1 to AWS EC2

Previously, I wrote about running DeepSeek R1 1.5B model on AWS EC2 instance.

In this post, we will explore how to deploy it to AWS EC2 instance and expose its API to the outside world.

1.5B is the smallest R1 model, however the smallest instance req…


This content originally appeared on DEV Community and was authored by F.P. Mortal

Previously, I wrote about running DeepSeek R1 1.5B model on AWS EC2 instance.

In this post, we will explore how to deploy it to AWS EC2 instance and expose its API to the outside world.

1.5B is the smallest R1 model, however the smallest instance required to run it must have at least 4GB of RAM, so we will be using t3.medium.

When creating an instance, make sure to enable HTTP traffic.

User data script:

#!/usr/bin/env bash

curl -fsSL https://ollama.com/install.sh | sh

export OLLAMA_HOST=0.0.0.0:80

sudo ollama serve &

sleep 1

ollama pull deepseek-r1:1.5b

Make a request:

curl ec2-13-61-178-152.eu-north-1.compute.amazonaws.com/api/generate -d '{
  "model": "deepseek-r1:1.5b",
  "prompt": "Hello. Introduce yourself.",
  "stream": false
}' | jq

Response:

{
  "model": "deepseek-r1:1.5b",
  "created_at": "2025-01-30T19:41:16.945227397Z",
  "response": "<think>\n\n</think>\n\nHello! I'm DeepSeek-R1, an artificial intelligence assistant created by DeepSeek. I'm at your service and would be delighted to assist you with any inquiries or tasks you may have.",
  "done": true,
  "done_reason": "stop",
  "context": [
    ...
  ],
  "total_duration": 9775275177,
  "load_duration": 25811605,
  "prompt_eval_count": 9,
  "prompt_eval_duration": 1060000000,
  "eval_count": 44,
  "eval_duration": 8688000000
}


This content originally appeared on DEV Community and was authored by F.P. Mortal


Print Share Comment Cite Upload Translate Updates
APA

F.P. Mortal | Sciencx (2025-01-30T19:45:19+00:00) Deploy DeepSeek R1 to AWS EC2. Retrieved from https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/

MLA
" » Deploy DeepSeek R1 to AWS EC2." F.P. Mortal | Sciencx - Thursday January 30, 2025, https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/
HARVARD
F.P. Mortal | Sciencx Thursday January 30, 2025 » Deploy DeepSeek R1 to AWS EC2., viewed ,<https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/>
VANCOUVER
F.P. Mortal | Sciencx - » Deploy DeepSeek R1 to AWS EC2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/
CHICAGO
" » Deploy DeepSeek R1 to AWS EC2." F.P. Mortal | Sciencx - Accessed . https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/
IEEE
" » Deploy DeepSeek R1 to AWS EC2." F.P. Mortal | Sciencx [Online]. Available: https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/. [Accessed: ]
rf:citation
» Deploy DeepSeek R1 to AWS EC2 | F.P. Mortal | Sciencx | https://www.scien.cx/2025/01/30/deploy-deepseek-r1-to-aws-ec2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.