Overview
The EC2 deployment provides a simple, cost-effective way to run Oxy with the following components:- EC2 Instance: ARM64-based t4g.small instance running Ubuntu 22.04
- EBS Storage: 10GB persistent volume for application data
- Application Load Balancer: For traffic routing
- Security Groups: Configured for web traffic and SSH access
Prerequisites
Before starting, ensure you have:- AWS CLI configured with appropriate permissions
- SSH key pair created in AWS (or create one during setup)
- Domain name configured in Route53 (optional)
- Basic familiarity with AWS Console and CLI
Step 1: Network Infrastructure Setup
1.1 Create VPC and Subnets
1.2 Create Security Groups
1.3 Create SSH Key Pair (if needed)
Step 2: Create IAM Roles and Policies
2.1 Create IAM Role for EC2
2.2 Create Setup Script
Create the setup script that will be executed on instance launch:Step 3: Launch EC2 Instance
3.1 Get Latest Ubuntu ARM64 AMI
3.2 Launch EC2 Instance
3.3 Create and Attach EBS Volume
Step 4: Configure Application Secrets
4.1 Store Environment Variables
4.2 Store BigQuery Credentials
Step 5: Create Application Load Balancer
Step 6: Access Your Oxy Instance
6.1 Get Instance Information
6.2 SSH Access (for debugging)
6.3 Check Service Status
Step 7: Monitoring and Maintenance
8.1 Monitor Instance Health
8.2 Application Logs
8.3 Data Backup
Troubleshooting
Common Issues
1. Instance fails to start Oxy service
2. EBS volume not mounting
3. Cannot access through ALB
Scaling Considerations
For the EC2 deployment:- Vertical scaling: Increase instance size (t4g.medium, t4g.large)
- Storage scaling: Increase EBS volume size
- High availability: Consider multiple instances with a shared database
Cleanup
To destroy the infrastructure:Security Best Practices
-
Regularly update the EC2 instance:
- Rotate SSH keys and API credentials periodically
- Monitor CloudWatch logs for suspicious activity
- Use VPC Flow Logs for network monitoring
- Enable AWS Config for compliance monitoring
Next Steps
- Set up CloudWatch monitoring and alarms
- Configure automated EBS snapshots
- Implement CI/CD for application updates
- Consider migrating to ECS for production workloads
- Set up log aggregation with CloudWatch Logs or ELK stack