Skip to content

Latest commit

 

History

History
483 lines (356 loc) · 19.2 KB

File metadata and controls

483 lines (356 loc) · 19.2 KB

🚀 Amazon Bedrock Complete Hands‑On Guides 🌟

Typing SVG
Forks Stars Watchers Last Commit Commit Activity Repo Size Star Badge

GitHub License GitHub contributors Open Issues Open PRs PRs Welcome


Cloud Engineer | Kubernetes Developer | Open Source Contributor

LinkedIn Twitter Medium Email DockerHub

🚀 Community-Driven Knowledge Hub
We welcome contributions to build the most comprehensive amazon-bedrock hands-on resource!

📢 How You Can Help:

Open Issues Good First Issues Open PRs


A comprehensive collection of hands-on guides for mastering Amazon Bedrock with Infrastructure as Code (IaC) using AWS CDK. This repository provides practical, real-world examples to help you learn and implement Amazon Bedrock's powerful AI/ML capabilities.

📋 Table of Contents

🎯 About

Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies through a single API. This repository provides step-by-step hands-on guides to help you:

  • Learn by doing with practical, deployable examples
  • Understand core concepts through real-world implementations
  • Deploy infrastructure using AWS CDK for reproducible environments
  • Explore different AI models and their capabilities
  • Build production-ready solutions with best practices

🎯 Target Audience

  • Developers looking to integrate AI capabilities into applications
  • DevOps Engineers wanting to deploy AI infrastructure as code
  • Solutions Architects designing AI-powered systems
  • Students and Learners exploring Amazon Bedrock capabilities
  • AI Enthusiasts interested in hands-on AWS AI services

✅ Prerequisites

Before starting with these guides, ensure you have:

Required Tools

# AWS CLI v2
aws --version

# AWS CDK
npm install -g aws-cdk
cdk --version

# Python 3.8+
python --version

# Git
git --version

AWS Account Setup

  • ✅ AWS Account with appropriate permissions
  • ✅ AWS CLI configured with credentials
  • ✅ Amazon Bedrock model access enabled
  • ✅ Basic understanding of AWS services

Knowledge Prerequisites

  • Basic AWS concepts (IAM, Lambda, S3, API Gateway)
  • Python programming fundamentals
  • Command line interface familiarity
  • Infrastructure as Code concepts

📁 Repository Structure

amazon-bedrock/
├── 01-fundamentals/           # Bedrock basics and core concepts
├── 02-image-generation/       # AI image generation with Titan
├── 03-background-removal/     # Image editing and manipulation
├── 04-generate-embedding/     # Text embeddings and vector operations
├── docs/                      # Additional documentation
├── scripts/                   # Utility scripts
├── LICENSE                    # MIT License
└── README.md                  # This file

Each guide directory contains:

guide-name/
├── README.md                  # Guide-specific instructions
├── app.py                     # CDK app entry point
├── requirements.txt           # Python dependencies
├── lambda/                    # Lambda function code
│   └── index.py
├── guide-name/                # CDK stack definitions
│   └── stack.py
└── tests/                     # Unit tests (where applicable)

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/anveshmuppeda/amazon-bedrock.git
cd amazon-bedrock

2. Set Up Your Environment

# Create virtual environment (recommended)
python -m venv bedrock-env
source bedrock-env/bin/activate  # On Windows: bedrock-env\Scripts\activate

# Install global dependencies
pip install -r requirements.txt

3. Bootstrap CDK (First Time Only)

cdk bootstrap aws://ACCOUNT-NUMBER/REGION

4. Enable Bedrock Model Access

  1. Navigate to Amazon Bedrock Console
  2. Go to "Model access" in the left sidebar
  3. Click "Enable specific models"
  4. Enable required models for your chosen guide
  5. Wait for approval (usually immediate for most models)

5. Choose Your First Guide

Start with 01-fundamentals for beginners or jump to any specific use case that interests you!

📚 Available Guides

🎓 01. Fundamentals

Level: Beginner | Duration: 30 minutes | Cost: ~$0.50

Learn the basics of Amazon Bedrock, understand different models, and make your first API calls.

What you'll build:

  • Simple Bedrock API integration
  • Text generation with Claude
  • Basic Lambda function setup

Key concepts: Foundation models, API calls, text generation


🎨 02. Image Generation

Level: Intermediate | Duration: 45 minutes | Cost: ~$2.00

Build a complete image generation API using Amazon Titan Image Generator.

What you'll build:

  • REST API for image generation
  • S3 storage integration
  • Presigned URL generation
  • CORS-enabled API Gateway

Key concepts: Image generation, API Gateway, S3 integration, presigned URLs


🖼️ 03. Background Removal

Level: Intermediate | Duration: 50 minutes | Cost: ~$2.00

Create an intelligent background removal service using Amazon Titan Image Generator V2.

What you'll build:

  • AI background removal API with S3 integration
  • RESTful service with API Gateway and Lambda
  • Presigned URL generation for secure image access
  • Production-ready infrastructure with CDK

Key concepts: AI image processing, S3 integration, presigned URLs, error handling


🔤 04. Generate Embedding

Level: Intermediate | Duration: 45 minutes | Cost: ~$1.00

Build a text embedding generation service using Amazon Titan Embeddings G1 model.

What you'll build:

  • Text embedding API that converts text to 1536-dimensional vectors
  • RESTful service with API Gateway and Lambda integration
  • Semantic search foundation for AI applications
  • Vector generation pipeline for machine learning workflows

Key concepts: Text embeddings, vector dimensions, semantic applications, API design


🤖 05. Chatbot with Memory

Level: Intermediate | Duration: 60 minutes | Cost: ~$3.00

Build an intelligent chatbot with conversation memory using Amazon Bedrock, LangChain, and Streamlit.

What you'll build:

  • Intelligent chatbot with conversation memory and context awareness
  • Streamlit web interface for interactive chat experience
  • AWS ECS deployment with Application Load Balancer
  • Conversation memory using LangChain's ConversationSummaryBufferMemory

Key concepts: Conversation memory, LangChain integration, Streamlit state management, container orchestration


📚 06. RAG Server - Document Q&A

Level: Advanced | Duration: 75 minutes | Cost: ~$4.00

Build a production-ready Retrieval-Augmented Generation (RAG) system for intelligent Q&A over documents.

What you'll build:

  • Document processing pipeline that converts PDFs to searchable vectors
  • Intelligent Q&A system that answers questions based on document content
  • Vector search engine using FAISS for fast similarity matching
  • RAG architecture combining retrieval and generation

Key concepts: RAG architecture, vector embeddings, document processing, FAISS database, semantic search


🎨 07. Image Generation UI

Level: Intermediate | Duration: 55 minutes | Cost: ~$3.50

Build a beautiful web-based AI image generator using Amazon Titan Image Generator G1 and Streamlit.

What you'll build:

  • Interactive web UI for AI image generation from text prompts
  • Real-time image generation using Amazon Titan Image Generator G1
  • Streamlit frontend with modern, responsive design
  • Image download functionality for saving generated images

Key concepts: AI image generation, Streamlit development, session management, user experience design


🤖 08. AI Agent Hub - Image Generation & Background Removal

Level: Advanced | Duration: 70 minutes | Cost: ~$5.00

Build a comprehensive AI-powered image processing hub combining multiple AI capabilities in a unified interface.

What you'll build:

  • Unified AI hub with multiple image processing capabilities
  • Text-to-image generation using Amazon Titan Image Generator G1
  • AI background removal using Amazon Titan Image Generator V2
  • Tabbed interface for seamless feature switching
  • Before/after comparisons and complete workflow pipelines

Key concepts: Multi-feature AI applications, modular architecture, dual model integration, workflow design


🔮 Upcoming Guides

We're continuously adding new guides! Here's what's coming next:

Guide Level Status
RAG Implementation Advanced 🏗️ In Progress
Chatbot with Memory Intermediate 📋 Planned
Document Analysis Advanced 📋 Planned
Multi-Modal AI Expert 📋 Planned
Model Fine-Tuning Expert 📋 Planned
Production Monitoring Advanced 📋 Planned

Want to suggest a guide? Open an issue with the tag guide-request.

💻 Usage

Quick Start for Any Guide

  1. Navigate to the guide directory:

    cd 02-image-generation  # Replace with your chosen guide
  2. Install dependencies:

    pip install -r requirements.txt
  3. Review the guide README:

    cat README.md
  4. Deploy the infrastructure:

    cd image-generation  # Adjust path as needed
    cdk deploy
  5. Test the deployment: Follow the testing instructions in each guide's README.

  6. Clean up resources:

    cdk destroy

Best Practices

  • 🔒 Security: Always follow AWS security best practices
  • 💰 Cost: Monitor your AWS costs and clean up resources after testing
  • 🏷️ Tagging: Use consistent resource tagging for organization
  • 📝 Documentation: Read each guide's README thoroughly before starting
  • 🧪 Testing: Test in a development environment first

🤝 Contributing

We welcome contributions from the community! Here's how you can help:

Ways to Contribute

  • 🐛 Report bugs by opening an issue
  • 💡 Suggest improvements or new guide ideas
  • 📝 Improve documentation with clearer explanations
  • 🔧 Submit code improvements via pull requests
  • Share the repository to help others learn

Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-guide
  3. Follow the existing code style and structure
  4. Test your changes thoroughly
  5. Update documentation as needed
  6. Submit a pull request with a clear description

Guide Contribution Template

When contributing a new guide, please include:

  • Clear README with step-by-step instructions
  • Working CDK code with proper error handling
  • Cost estimates and time requirements
  • Prerequisites and learning objectives
  • Testing instructions with sample inputs/outputs

💰 Cost Considerations

Estimated Costs per Guide

*Costs are estimates for testing/learning purposes and may vary based on usage

Cost Optimization Tips

  • 🕐 Clean up resources immediately after testing
  • 📊 Monitor AWS billing dashboard regularly
  • 🎯 Use AWS Free Tier where applicable
  • 📈 Set billing alerts for cost control
  • 🗑️ Implement lifecycle policies for S3 storage

🆘 Support

Getting Help

  • 📖 Documentation: Start with the specific guide's README
  • 🐛 Issues: GitHub Issues for bugs and questions
  • 💬 Discussions: GitHub Discussions for general questions

Common Issues

Issue Solution
CDK Bootstrap Failed Ensure AWS credentials are configured correctly
Model Access Denied Enable specific models in Bedrock console
Lambda Timeout Increase timeout duration in CDK stack
CORS Issues Check API Gateway CORS configuration
High Costs Review resource usage and implement cleanup

Troubleshooting Resources

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2024 [Your Name]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...

🌟 Acknowledgments

  • AWS Team for creating Amazon Bedrock
  • CDK Community for excellent documentation and examples
  • Contributors who help improve these guides
  • Open Source Community for inspiration and best practices

🚀 Ready to Start Learning?

Choose your first guide and start building with Amazon Bedrock today!

Beginner? → Start with 01-fundamentals
Want to generate images? → Jump to 02-image-generation
Interested in embeddings? → Try 04-generate-embedding


Happy Learning! 🎓✨

If you find this repository helpful, please consider giving it a star ⭐ and sharing it with others who might benefit from these hands-on guides.