Skip to content

AnoopHegde/amazon-bedrock

ย 
ย 

Repository files navigation

๐Ÿš€ 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.

About

Amazon Bedrock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Batchfile 2.9%
  • Dockerfile 2.2%