A web tool that helps you quickly query EC2 instance information, including configuration, specifications, features, and monthly on-demand price for reference.
- 🔍 Query EC2 instance details and OD pricing
- 💾 EBS volume OD pricing
- 📊 Detailed instance specifications
- 💰 Price change indicators
- 📈 Instance price comparison (up to 8 instances)
- 🌐 Support for both AWS Global and China regions
- 🚀 Serverless deployment with AWS Chalice
- 📝 Swagger UI API documentation
This is a demonstration project for AWS Chalice, a microservice framework for writing serverless applications in Python. The project features a modern Vue.js frontend with Bootstrap-Vue components, RESTful backend APIs, and integrated Swagger UI for API documentation.
You can deploy it to the AWS cloud with a single command. No servers, containers, or storage resources are required for deployment.
- Infrastructure: AWS Lambda + API Gateway (managed by Chalice)
- Database: Amazon DynamoDB
- Frontend: Vue.js with Bootstrap-Vue components
- Backend: Python with AWS Chalice framework
- API Documentation: Swagger UI
ec2-quicklook/ ├── app.py # Main application entry point ├── chalicelib/ │ ├── config.py # Configuration management │ ├── sdk.py # AWS SDK integration │ ├── utils.py # Utility functions │ ├── models.py # Data models │ ├── product/ # Product-related functionality │ ├── swagger/ # Swagger UI integration │ ├── webui/ # Web interface │ └── static/ # Static assets │ └── js/ # VUE JavaScript └── tests/ # Test files
- Python >= 3.10
- AWS Chalice
- AWS Credentials (with appropriate permissions)
- Clone the repository:
git clone https://github.com/aleck31/ec2-quicklook.git
cd ec2-quicklook- Set up Python virtual environment:
python -m venv .venv
# Linux/Mac
source .venv/bin/activate
# Windows
.venv/Scripts/Activate.ps1- Install required dependencies:
pip install -r requirements.txt- Create required AWS resources:
# Create resources (default --stage dev)
python create-resources.py- Run the application locally:
chalice local- Access the application:
- Main application: http://127.0.0.1:8000
- API documentation: http://127.0.0.1:8000/api/docs
Deploy to AWS:
chalice deploy
# Example output:
Updating lambda function: ec2-quicklook-dev
Updating rest API
Resources deployed:
- Lambda ARN: arn:aws:lambda:us-east-1::function:ec2-quicklook-dev
- Rest API URL: https://...execute-api.us-east-1.amazonaws.com/api/After deployment, you can access:
- Main application: https://...execute-api.us-east-1.amazonaws.com/api/
- API documentation: https://...execute-api.us-east-1.amazonaws.com/api/docs
Log level is controlled by ENV_LOG_LEVEL environment variable in .chalice/config.json:
- CRITICAL
- ERROR
- WARNING
- INFO
- DEBUG
- NOTSET
Reference: Python logging levels
You can customize the IAM role policy for your project:
If you encounter an "AccessDeniedException", ensure that the correct permissions are configured for the Lambda service role. Refer to example/role_policy.json to update the Lambda role permissions.
For AWS China region queries:
- Ensure you have an AWS China account
- Save the credentials in AWS Secrets Manager
- Update the
SECRET_NAMEinconfig.json
Common issues and solutions:
- DynamoDB Connection: Ensure your AWS credentials have DynamoDB access permissions
- API Gateway: Local development uses a mock API Gateway, some features might behave differently
- Environment Variables: Check
.chalice/config.jsonfor correct environment variable configuration
This project is licensed under the MIT License - see the LICENSE file for details.
- AWS Chalice Tutorial - Python Serverless Framework
- AWS Pricing API - EC2 Pricing Information
- Bootstrap-Vue - Vue.js Implementation of Bootstrap
- Swagger UI - API Documentation