A newer version of the Gradio SDK is available:
6.9.0
AWS Deployment Guide for Party Planner
This guide will walk you through deploying your Party Planner app on AWS using Elastic Beanstalk.
Prerequisites
- AWS Account: You need an active AWS account
- AWS CLI: Install and configure AWS CLI
- EB CLI: Install Elastic Beanstalk CLI
- Git: For version control
Step 1: Install AWS CLI and EB CLI
Install AWS CLI
# macOS (using Homebrew)
brew install awscli
# Or download from AWS website
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
Install EB CLI
pip install awsebcli
Configure AWS CLI
aws configure
# Enter your AWS Access Key ID
# Enter your AWS Secret Access Key
# Enter your default region (e.g., us-east-1)
# Enter your output format (json)
Step 2: Prepare Your Application
Your application is already prepared with the necessary files:
application.py- Main Flask applicationrequirements.txt- Python dependenciesProcfile- Tells EB how to run the app.ebextensions/01_flask.config- EB configuration
Step 3: Initialize Elastic Beanstalk
# Navigate to your project directory
cd /path/to/your/LinkedInParty
# Initialize EB application
eb init
# Follow the prompts:
# 1. Select your region
# 2. Create new application (enter app name: party-planner)
# 3. Select Python platform
# 4. Select Python version (3.11 or 3.12)
# 5. Set up SSH (optional)
Step 4: Create Environment
# Create and deploy your environment
eb create party-planner-env
# This will:
# 1. Create an EC2 instance
# 2. Set up load balancer
# 3. Configure security groups
# 4. Deploy your application
# 5. Provide you with a URL
Step 5: Deploy Your Application
# Deploy your application
eb deploy
# Or if you want to deploy and open in browser
eb deploy --open
Step 6: Monitor Your Application
# Check application status
eb status
# View application logs
eb logs
# Open application in browser
eb open
Alternative Deployment Methods
Method 2: AWS Lambda + API Gateway
If you prefer serverless deployment:
- Install AWS SAM CLI
# macOS
brew install aws-sam-cli
- Create SAM template (create
template.yaml):
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
PartyPlannerFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./
Handler: application.app
Runtime: python3.11
Events:
Api:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
- Deploy with SAM
sam build
sam deploy --guided
Method 3: AWS ECS (Docker)
- Create Dockerfile:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "application:app"]
- Build and push to ECR
aws ecr create-repository --repository-name party-planner
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin YOUR_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com
docker build -t party-planner .
docker tag party-planner:latest YOUR_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/party-planner:latest
docker push YOUR_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/party-planner:latest
Environment Variables (Optional)
You can set environment variables in the EB console or via CLI:
eb setenv SECRET_KEY=your-secret-key-here
Custom Domain (Optional)
- Register domain in Route 53 or use existing domain
- Create SSL certificate in AWS Certificate Manager
- Configure domain in EB console or via CLI
eb config
# Add domain configuration
Monitoring and Scaling
Auto Scaling
# Configure auto scaling
eb config
# Set min/max instances based on your needs
CloudWatch Monitoring
- Set up CloudWatch alarms
- Monitor application metrics
- Set up log aggregation
Cost Optimization
Free Tier
- AWS offers 12 months free tier
- 750 hours/month of t2.micro instances
- 20GB of storage
Cost Saving Tips
- Use t3.micro instances for development
- Set up auto scaling to scale down during low usage
- Use Spot Instances for non-critical workloads
- Monitor costs in AWS Cost Explorer
Troubleshooting
Common Issues
- Deployment Fails
eb logs
# Check for specific error messages
- Application Not Responding
eb health
# Check application health
- Environment Issues
eb events
# View recent events
Useful Commands
# SSH into your instance
eb ssh
# View environment info
eb info
# List all environments
eb list
# Terminate environment
eb terminate party-planner-env
# Clone environment
eb clone party-planner-env --clone_name party-planner-env-2
Security Best Practices
- Use IAM roles instead of access keys
- Enable VPC for network isolation
- Set up security groups to restrict access
- Use HTTPS for all communications
- Regular security updates
Backup and Recovery
- Database backups (if using RDS)
- Application backups (version control)
- Configuration backups (EB configuration)
- Disaster recovery plan
Performance Optimization
- Enable CloudFront for static content
- Use RDS for database (if needed)
- Implement caching (Redis/ElastiCache)
- Optimize application code
Maintenance
Regular Tasks
- Update dependencies monthly
- Monitor costs weekly
- Review logs for issues
- Update SSL certificates before expiry
Updates
# Update application
git add .
git commit -m "Update application"
eb deploy
# Update environment
eb upgrade
Support
- AWS Documentation: https://docs.aws.amazon.com/elasticbeanstalk/
- AWS Support: Available with paid plans
- Community Forums: AWS Developer Forums
- Stack Overflow: Tag with aws-elasticbeanstalk
Estimated Costs
Small Application (t3.micro)
- EC2: ~$8-15/month
- Load Balancer: ~$18/month
- Storage: ~$1-5/month
- Data Transfer: ~$1-10/month
- Total: ~$30-50/month
Free Tier
- First 12 months: Free (with limitations)
- After free tier: ~$30-50/month
Next Steps
- Set up monitoring with CloudWatch
- Configure custom domain
- Set up CI/CD pipeline
- Implement backup strategy
- Plan for scaling
Your Party Planner app is now ready for production deployment on AWS! 🚀