A production-ready serverless application that generates high-quality blog content using AWS services and Amazon Bedrock's Meta Llama3-70B model.
- Overview
- Architecture
- Features
- Technology Stack
- Prerequisites
- Installation & Setup
- Usage
- API Reference
- Configuration
- Monitoring & Logging
- Contributing
- License
- Contact
The AI Blog Generator is an end-to-end serverless solution that leverages the power of generative AI to create professional blog content. Built with AWS cloud services, this application demonstrates modern serverless architecture patterns while providing practical AI-powered content generation capabilities.
- β‘ Serverless Architecture: Fully managed AWS services with auto-scaling
- π€ AI-Powered: Meta Llama3-70B model via Amazon Bedrock
- π End-to-End Automation: From API request to content storage
- π Production Ready: Comprehensive logging and monitoring
- π High Performance: Optimized with custom Lambda layers
graph LR
A[Client/Postman] --> B[API Gateway]
B --> C[AWS Lambda]
C --> D[Amazon Bedrock]
D --> E[Meta Llama3-70B]
C --> F[Amazon S3]
C --> G[CloudWatch Logs]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
style D fill:#fff3e0
style F fill:#fce4ec
style G fill:#f1f8e9
- API Request: Client sends blog topic via REST API
- Lambda Processing: Custom function processes the request
- AI Generation: Amazon Bedrock generates content using Meta Llama3-70B
- Storage: Generated blog automatically saved to S3 with timestamp
- Monitoring: Complete workflow tracked in CloudWatch
- π¨ Intelligent Content Creation: Generate contextually relevant blog posts
- π RESTful API: Clean, documented endpoints for easy integration
- πΎ Automatic Storage: Timestamped content saved to S3
- π Scalable: Serverless architecture handles varying loads
- π Comprehensive Logging: Full request/response tracking
- βοΈ Custom Runtime: Optimized Lambda layers for performance
- π‘οΈ Secure: IAM-based access control and encryption
| Category | Technology |
|---|---|
| Language | Python 3.9 |
| Cloud Provider | Amazon Web Services (AWS) |
| AI/ML | Amazon Bedrock, Meta Llama3-70B |
| Compute | AWS Lambda (Custom Layers) |
| API | AWS API Gateway |
| Storage | Amazon S3 |
| Monitoring | CloudWatch Logs |
| SDK | boto3 |
Before setting up the project, ensure you have:
- β AWS Account with appropriate IAM permissions
- β AWS CLI installed and configured
- β Python 3.9 or higher
- β Access to Amazon Bedrock service
- β Basic knowledge of AWS services
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"s3:PutObject",
"s3:GetObject",
"lambda:InvokeFunction",
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}git clone https://github.com/eensaydn/ai-blog-generator.git
cd ai-blog-generatoraws s3 mb s3://your-unique-blog-bucket-name --region us-east-1# Install dependencies
pip install boto3 -t ./package/
cd package
zip -r ../lambda-function.zip .
cd ..
zip -g lambda-function.zip lambda_function.pyaws lambda create-function \
--function-name blog-generator \
--runtime python3.9 \
--role arn:aws:iam::YOUR-ACCOUNT:role/lambda-execution-role \
--handler lambda_function.lambda_handler \
--zip-file fileb://lambda-function.zip \
--environment Variables='{BUCKET_NAME=your-unique-blog-bucket-name}'# Create REST API
aws apigateway create-rest-api --name blog-generator-api
# Configure POST method and Lambda integration
# Deploy to stageEndpoint: POST https://your-api-gateway-url/prod/generate
Request:
curl -X POST https://your-api-gateway-url/prod/generate \
-H "Content-Type: application/json" \
-d '{
"blog_topic": "The Future of Artificial Intelligence in Healthcare"
}'Response:
{
"statusCode": 200,
"body": "Blog Generation is completed"
}- Set method to
POST - Enter your API Gateway URL
- Add JSON body with
blog_topicparameter - Send request
- Check S3 bucket for generated content
| Parameter | Type | Required | Description |
|---|---|---|---|
blog_topic |
string | Yes | Topic for blog generation (max 200 chars) |
Example Topics:
- "Machine Learning in Healthcare"
- "Sustainable Energy Solutions"
- "Remote Work Best Practices"
- Success: HTTP 200 with confirmation message
- Error: HTTP 500 with error details
- Generated Content: Saved to S3 as
blog-output/{timestamp}.txt
| Variable | Description | Default |
|---|---|---|
BUCKET_NAME |
S3 bucket for content storage | aws_bedrock_course1 |
AWS_REGION |
AWS region for services | us-east-2 |
MODEL_ID |
Bedrock model identifier | meta.llama3-70b-instruct-v1:0 |
# Recommended settings
MEMORY_SIZE = 512 # MB
TIMEOUT = 30 # seconds
RUNTIME = "python3.9"- Lambda Logs: Function execution details
- API Gateway Logs: Request/response tracking
- Error Monitoring: Automatic error detection
- Performance Metrics: Execution time and memory usage
# View recent logs
aws logs describe-log-streams --log-group-name /aws/lambda/blog-generator
# Filter specific events
aws logs filter-log-events --log-group-name /aws/lambda/blog-generator \
--filter-pattern "ERROR"- β Use least privilege IAM roles
- β Enable API Gateway authentication
- β Encrypt S3 buckets
- β Implement request rate limiting
- β Regular security audits
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 Python style guide
- Add unit tests for new features
- Update documentation as needed
- Test locally before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
Enes AydΔ±n
- π GitHub: @eensaydn
- πΌ LinkedIn: enesaydin00
- π§ Email: Contact via LinkedIn