In my previous article, I explained how the DeepSeek R1 Distilled model can be used with Amazon Bedrock by storing it in an S3 bucket and importing it before invoking it via AWS Lambda and API Gateway.
In this article, I will explore a simpler and more efficient approach, using the fully managed DeepSeek R1 model with Amazon Bedrock, AWS Lambda, and API Gateway in a serverless environment. This eliminates the need to manually store and import the model, allowing you to integrate DeepSeek R1 into your applications without managing any infrastructure.
Amazon announced support for the fully managed DeepSeek R1 model in Amazon Bedrock on March 10, 2025. With this update, you no longer need to download the model, store it in Amazon S3, or use Bedrockβs custom model feature, everything is managed seamlessly by AWS.
Before diving in, letβs review the architecture diagram to understand how these components interact.
Introduction to Amazon Bedrock
Amazon Bedrock is a fully managed service that provides access to a variety of foundation models, including Anthropic Claude, AI21 Jurassic-2, Stability AI, Amazon Titan, and others.
As a serverless offering from Amazon, Bedrock enables seamless integration with popular foundation models (FMs). It also allows you to privately customize these models with your own data using AWS tools, eliminating the need to manage any infrastructure.
Additionally, Bedrock supports the import of custom models.
Overview of DeepSeek R1 Model
The DeepSeek R1 model is a text-to-text language model designed to handle a wide range of natural language processing (NLP) tasks. It excels in transforming input text into meaningful and contextually relevant output, making it ideal for tasks such as text generation, summarization and question-answering.
As a fully managed model on Amazon Bedrock, DeepSeek R1 simplifies integration by removing the need for manual deployment and infrastructure management. It processes input text and generates coherent, context-aware responses, which can be leveraged in chatbots, customer support systems, content creation, and more.
Request Access to DeepSeek R1 Model
Before you can use the model, you need to request the access to the model.
Select DeepSeek R1 and click on Modify Access.
Request Model Access
Review and submit the model access request.
Please review that access has been granted to the model.
Validate the Model Using Amazon Bedrock Playground
Once you have access to the model, you can start using it via Bedrock Playground:
Prompt: Please suggest 3 places to visit in NYC.
Review AWS SAM template
The AWS Serverless Application Model (SAM) template defines the infrastructure required for the lambda function and API.
Hereβs what the SAM template for this solution looks like:
Review AWS Lambda function (Python/Boto3 Library)
Lambda function is developed using Python and uses the Boto3 library to interact with Amazon Bedrock through Lambda and API.
Build function locally using AWS SAM
Command to build the function locally is SAM Build.
Once code is successfully build, it is ready to be invoked.
Invoke function locally using AWS SAM
Command to invoke the function is sam local invoke -e
Deploy function using AWS SAM
Invoke the Model with Amazon Bedrock via API/Lambda
I am using Postman to pass the prompt and review the responses.
Cleanup - Delete resources
Once done with this exercise, ensure to delete all the resources created so that these resources do not incur charges impacting overall cloud cost and budget.
Since these resources were build and deployed using AWS SAM, these can be deleted using AWS SAM command.
Command: sam delete
You can also delete the resources via AWS Console.
Conclusion
In this article, I demonstrated how to use the managed DeepSeek model with Amazon Bedrock. Since this is a serverless offering, there was no infrastructure that I needed to provision to use this model. I used the AWS CLI, AWS Management Console, AWS SAM, and Postman to validate the API.
For this solution, I used Python/Boto3 to create an API integrated with Bedrock via a Lambda function.
I hope you found this article both helpful and informative!
Thank you for reading!
Watch the video here:
https://www.youtube.com/watch?v=DNfxnxYYA4s
π’πΎππΎππ½ β¬π½πΆππΎπΆ
πππ ππ¦π³π΅πͺπ§πͺπ¦π₯ ππ°ππΆπ΅πͺπ°π― ππ³π€π©πͺπ΅π¦π€π΅ & ππ¦π·π¦ππ°π±π¦π³ ππ΄π΄π°π€πͺπ’π΅π¦
πππ°πΆπ₯ ππ¦π€π©π―π°ππ°π¨πΊ ππ―π΅π©πΆπ΄πͺπ’π΄π΅
Top comments (0)