Skip to content

aleck31/ec2-quicklook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EC2 QuickLook

A web tool that helps you quickly query EC2 instance information, including configuration, specifications, features, and monthly on-demand price for reference.

Features

  • 🔍 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

What is this project?

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.

Architecture

  • 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

File Structure

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

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/aleck31/ec2-quicklook.git
cd ec2-quicklook
  1. Set up Python virtual environment:
python -m venv .venv

# Linux/Mac
source .venv/bin/activate

# Windows
.venv/Scripts/Activate.ps1
  1. Install required dependencies:
pip install -r requirements.txt
  1. Create required AWS resources:
# Create resources (default --stage dev)
python create-resources.py

Local Development

  1. Run the application locally:
chalice local
  1. Access the application:

Deployment

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

Environment Configuration

Log Level

Log level is controlled by ENV_LOG_LEVEL environment variable in .chalice/config.json:

  • CRITICAL
  • ERROR
  • WARNING
  • INFO
  • DEBUG
  • NOTSET

Reference: Python logging levels

IAM Role Policy

You can customize the IAM role policy for your project:

Troubleshooting

Access Denied

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.

AWS China Region

For AWS China region queries:

  1. Ensure you have an AWS China account
  2. Save the credentials in AWS Secrets Manager
  3. Update the SECRET_NAME in config.json

Local Development

Common issues and solutions:

  1. DynamoDB Connection: Ensure your AWS credentials have DynamoDB access permissions
  2. API Gateway: Local development uses a mock API Gateway, some features might behave differently
  3. Environment Variables: Check .chalice/config.json for correct environment variable configuration

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

A web tool that help you to quickly query EC2 instance information, including: configuration, specifications, features and monthly on-demand price for reference.

Resources

Stars

Watchers

Forks

Contributors