A comprehensive tool to compare AWS EC2 instance pricing across different regions, operating systems, and pricing models (On-Demand, Reserved, and Spot). This application helps users make informed decisions about AWS EC2 instance selection based on pricing and specifications.
- Features
- Project Structure
- Technology Stack
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Documentation
- Frontend Components
- Development
- Testing
- Deployment
- Contributing
- License
- View EC2 instance details (vCPU, memory, network performance)
- Compare On-Demand, Reserved, and Spot pricing
- Filter by region, OS (Linux/Windows), and pricing type
- Interactive data grid with sorting, filtering, and export capabilities
- Price History: View historical pricing data for instances
- Savings Calculator: Calculate potential savings between different pricing models
- Instance Comparison: Compare specifications and pricing of multiple instances
- Price Alerts: Set up alerts for price drops below specified thresholds
- Tabbed Interface: Easy navigation between different features
aws-pricing-tool/
├── backend/ # Express.js backend
│ ├── src/ # Backend source code
│ │ ├── controllers/ # API controllers
│ │ ├── models/ # Data models
│ │ ├── routes/ # API routes
│ │ └── utils/ # Utility functions
│ ├── server.js # Backend entry point
│ └── package.json # Backend dependencies
├── frontend/ # React frontend
│ ├── public/ # Static files
│ ├── src/ # React source code
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API service functions
│ │ ├── styles/ # CSS and style files
│ │ └── utils/ # Utility functions
│ └── package.json # Frontend dependencies
├── docs/ # Documentation files
├── .env.example # Example environment variables
├── .gitignore # Git ignore file
├── package.json # Root package.json for running both services
└── README.md # Project documentation
- Node.js: JavaScript runtime
- Express.js: Web framework
- AWS SDK: AWS API integration
- MongoDB: Database for storing price history and alerts (optional)
- Node-cron: Scheduled tasks for price updates
- React: UI library
- Material UI: Component library
- Chart.js: Data visualization
- React-chartjs-2: React wrapper for Chart.js
- MUI X-Data-Grid: Advanced data grid component
- Node.js (v14 or higher)
- npm (v6 or higher)
- AWS credentials with EC2 and Pricing API access
- MongoDB (optional, for price history and alerts)
-
Clone the repository
git clone https://github.com/yourusername/aws-pricing-tool.git cd aws-pricing-tool -
Install dependencies
npm run install-all
-
Create a
.envfile in the root directory based on.env.example:AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key AWS_REGION=us-east-1 MONGODB_URI=your_mongodb_connection_string (optional) PORT=4000 -
Alternatively, configure AWS credentials using the AWS CLI:
aws configure
To run both the backend and frontend concurrently:
npm run devTo run only the backend:
npm run serverTo run only the frontend:
npm run clientBuild the frontend:
cd frontend && npm run buildStart the production server:
npm startGET /api/regions- Get list of available AWS regions
GET /api/instances/:region- Get EC2 instance pricing data for a specific region
GET /api/price-history/:region/:instanceType- Get price history for a specific instance type
POST /api/calculate-savings- Calculate savings between different pricing models- Body:
{ instanceType, region, os, hours, riTerm, riPayment }
- Body:
POST /api/price-alerts- Create a new price alert- Body:
{ instanceType, region, os, priceType, threshold, email, active }
- Body:
- App.js: Main application component with routing and state management
- DataGrid: Interactive table for displaying instance data
- PriceHistory: Chart component for displaying price history
- SavingsCalculator: Form for calculating potential savings
- InstanceComparison: Table for comparing multiple instances
- PriceAlerts: Form for setting up price alerts
This project uses ESLint and Prettier for code formatting. Run linting with:
npm run lintFix linting issues automatically:
npm run lint:fix- Backend: Add new routes in
backend/src/routesand controllers inbackend/src/controllers - Frontend: Add new components in
frontend/src/componentsand services infrontend/src/services
The backend uses Jest for unit and integration testing. Tests are located in the backend/src/controllers/__tests__ and backend/tests/integration directories.
Run backend tests:
cd backend && npm testRun backend tests with coverage:
cd backend && npm run test:coverageThe frontend uses React Testing Library for component testing. Tests are located in the frontend/src/components/__tests__ directory.
Run frontend tests:
cd frontend && npm testRun frontend tests with coverage:
cd frontend && npm run test:coverageYou can run the entire application locally using Docker Compose:
# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop all services
docker-compose downThis project is configured for deployment to AWS EKS (Elastic Kubernetes Service). The deployment process is automated using GitHub Actions.
- AWS CLI installed and configured with appropriate permissions
- kubectl installed
- helm installed
Run the setup script to create an EKS cluster:
chmod +x scripts/setup-eks.sh
./scripts/setup-eks.shYou can manually deploy the application to EKS using the deployment script:
chmod +x scripts/deploy.sh
./scripts/deploy.shThe project includes a GitHub Actions workflow for CI/CD. When you push to the main branch, it will:
- Run tests for both backend and frontend
- Build Docker images
- Push images to Amazon ECR
- Deploy to EKS
To set up the CI/CD pipeline, you need to add the following secrets to your GitHub repository:
AWS_ACCESS_KEY_ID: Your AWS access keyAWS_SECRET_ACCESS_KEY: Your AWS secret key
The Kubernetes manifests are located in the k8s directory and include:
- Namespace
- ConfigMap and Secret for configuration
- MongoDB StatefulSet and Service
- Backend and Frontend Deployments and Services
- Ingress for external access
- HorizontalPodAutoscaler for scaling
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature/my-feature - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Backend: Express.js, AWS SDK
- Frontend: React, Material UI, MUI X-Data-Grid
- Development: Nodemon, Concurrently
