AWS Bedrock and SageMaker
Amazon Bedrock and Amazon SageMaker bring artificial intelligence (AI) and machine learning (ML) to AWS. Bedrock lets applications use ready-made foundation models through a simple API. SageMaker gives data scientists tools to build, train, and deploy their own models.
Compare the two with food. Bedrock resembles a restaurant: pick a dish from the menu and receive it quickly. SageMaker resembles a fully equipped kitchen: choose ingredients, follow your own recipe, and cook a custom dish.
Key Terms in Plain Language
- Machine learning: software that learns patterns from data instead of following only fixed rules.
- Model: the trained result of that learning, which makes predictions or creates content.
- Foundation model: a large model trained on broad data that handles many tasks, such as writing, summarizing, or answering questions.
- Inference: using a trained model to produce an answer.
- Prompt: the instruction or question you send to a model.
Amazon Bedrock
Bedrock is a managed service that offers foundation models from several providers through one API. You do not manage servers or train anything. Send a prompt, and the model returns text, an image, or other content depending on the model type.
Your Application
|
Bedrock API
|
+------+-------+--------+
| | |
Model A Model B Model C
(text) (image) (embeddings)
Common Uses
- Summarizing long documents and meeting notes
- Answering customer questions in a chat assistant
- Drafting product descriptions
- Extracting fields from forms and emails
- Searching documents by meaning instead of exact keywords
Useful Bedrock Features
- Knowledge Bases connect a model to your own documents so answers draw on your data. The pattern is called retrieval-augmented generation (RAG).
- Guardrails filter harmful topics and sensitive information in prompts and responses.
- Agents let a model plan steps and call your APIs to complete tasks.
- Model customization adapts a model to your domain with your own examples.
Knowledge Base Flow
User question
|
v
Search your documents (stored in S3, indexed in a vector store)
|
v
Relevant passages + question sent to the model
|
v
Answer grounded in your own documents
Amazon SageMaker
SageMaker covers the whole ML lifecycle. Data scientists prepare data, train models, tune them, and publish them as endpoints that applications call.
Core Capabilities
- Notebooks and studio environments for writing and testing code
- Training jobs that run on managed compute and shut down when finished
- Hyperparameter tuning that tries many settings automatically
- Endpoints that serve predictions in real time or in batches
- Pipelines that automate repeated steps
Data in S3 --> Prepare --> Train --> Evaluate --> Deploy --> Monitor
|
Real-time endpoint
Choosing Between Them
+-------------------------+----------------+-----------------+ | Situation | Bedrock | SageMaker | +-------------------------+----------------+-----------------+ | Need text generation | Strong fit | Possible, more | | quickly | | effort | | Custom prediction model | Limited | Strong fit | | on your own data | | | | ML expertise required | Low | Medium to high | | Infrastructure control | Low | High | +-------------------------+----------------+-----------------+
Example: Support Assistant
A software company wants a help assistant that answers questions from its manuals. The team uploads manuals to S3, creates a Bedrock knowledge base, and adds guardrails that block requests for personal data. A small web app sends user questions through the API. Developers write little code and run no model servers.
Responsible Use
- Check model answers for accuracy before acting on them, especially in health, legal, and money topics.
- Avoid sending sensitive personal data unless your policies and the service settings allow it.
- Tell users when they interact with an AI system.
- Test for bias and harmful outputs before release.
Security and Cost
- IAM controls which people and applications call models.
- VPC endpoints keep traffic on the AWS network.
- KMS encrypts stored data.
- Bedrock typically bills by the amount of text processed. SageMaker bills for compute time, so stop notebooks and delete endpoints when idle.
Best Practices
- Start with Bedrock for common language tasks.
- Move to SageMaker when you need a custom model.
- Write clear prompts with context and examples.
- Monitor usage and set budgets and alerts.
