Skip to content

High-PO/aws-ec2-price-console

Repository files navigation

Next.js TypeScript AWS SDK License Docker Kubernetes

AWS EC2 Instance Types Explorer

Real-time EC2 instance comparison and cost optimization recommendations

FeaturesQuick StartDeploymentAPIContributing한국어


Overview

AWS EC2 Instance Types Explorer is a web application that provides real-time comparison of EC2 instance specifications and pricing across AWS regions. It fetches data directly from AWS APIs and provides intelligent cost optimization recommendations based on resource utilization patterns.

┌─────────────────────────────────────────────────────────────────────────┐
│  ☁ AWS EC2 Instance Types          [Instance Types] [Cost Optimizer]   │
├─────────────────────────────────────────────────────────────────────────┤
│  Pricing: [Hourly] [Daily] [Monthly] [Custom]    Currency: [USD] [KRW] │
├─────────────────────────────────────────────────────────────────────────┤
│  Instance Type    │ vCPU │ Memory  │ Network     │ Price              │
│  c6i.large        │   2  │   4 GiB │ 12.5 Gbps   │ $0.085/hr          │
│  m6i.xlarge       │   4  │  16 GiB │ 12.5 Gbps   │ $0.192/hr          │
│  r6i.2xlarge      │   8  │  64 GiB │ 12.5 Gbps   │ $0.504/hr          │
└─────────────────────────────────────────────────────────────────────────┘

Features

  • Real-time Data — Fetches instance specs from EC2 API and pricing from AWS Pricing API
  • Multi-Region Support — Compare prices across 15+ AWS regions
  • Cost Optimization — Intelligent right-sizing recommendations based on CPU/Memory utilization
  • Currency Conversion — Real-time USD to KRW exchange rate
  • Flexible Pricing — View costs hourly, daily, monthly, or custom hours
  • In-Memory Caching — Fast responses after initial load (1-hour TTL)
  • Container Ready — Docker and Kubernetes deployment support

Quick Start

Prerequisites

  • Node.js 18+
  • AWS credentials with required permissions

Installation

# Clone the repository
git clone https://github.com/yourusername/aws-instance-types.git
cd aws-instance-types

# Install dependencies
npm install

# Set AWS credentials
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_REGION="ap-northeast-2"  # optional, defaults to ap-northeast-2

# Start development server
npm run dev

Open http://localhost:3000 in your browser.

Required AWS Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstanceTypes",
        "ec2:DescribeInstances",
        "pricing:GetProducts"
      ],
      "Resource": "*"
    }
  ]
}

Deployment

Docker

# Build image
docker build -t aws-instance-types .

# Run container
docker run -p 3000:3000 \
  -e AWS_ACCESS_KEY_ID="your-key" \
  -e AWS_SECRET_ACCESS_KEY="your-secret" \
  aws-instance-types

Docker Compose

docker-compose up -d

Kubernetes

# Create AWS credentials secret
kubectl create secret generic aws-credentials \
  --from-literal=AWS_ACCESS_KEY_ID=your-key \
  --from-literal=AWS_SECRET_ACCESS_KEY=your-secret \
  -n aws-tools

# Deploy with Kustomize
kubectl apply -k k8s/

# Access via NodePort
# http://<node-ip>:30080

API Reference

GET /api/instances

Fetches all EC2 instance types with pricing for a specific region.

Parameter Type Default Description
region string ap-northeast-2 AWS region code
family string All Instance family filter
search string - Search term
refresh boolean false Force cache refresh

Response:

{
  "instances": [
    {
      "name": "m6i.large",
      "family": "General Purpose",
      "vCPU": 2,
      "memory": 8,
      "networkPerformance": "Up to 12.5 Gigabit",
      "networkBandwidth": 12.5,
      "pricePerHour": 0.096
    }
  ],
  "regions": [...],
  "families": [...],
  "cached": true,
  "fetchTime": 48
}

GET /api/exchange-rate

Returns current USD to KRW exchange rate.

GET /api/my-instances

Lists running EC2 instances in your AWS account.

Network Requirements

Outbound (Egress) Access Required

Endpoint Port Protocol Purpose
ec2.{region}.amazonaws.com 443 HTTPS EC2 DescribeInstanceTypes
pricing.us-east-1.amazonaws.com 443 HTTPS AWS Pricing API
api.exchangerate-api.com 443 HTTPS Exchange rate

Note: AWS Pricing API is only available in us-east-1 and ap-south-1 regions.

Project Structure

aws-instance-types/
├── src/
│   ├── app/
│   │   ├── api/
│   │   │   ├── instances/route.ts      # Instance types + pricing
│   │   │   ├── my-instances/route.ts   # User's EC2 instances
│   │   │   └── exchange-rate/route.ts  # Currency exchange
│   │   ├── optimizer/page.tsx          # Cost optimizer page
│   │   ├── page.tsx                    # Main instance types page
│   │   └── globals.css                 # AWS Console-style CSS
│   └── components/
│       └── SearchableSelect.tsx        # Searchable dropdown
├── k8s/                                # Kubernetes manifests
│   ├── deployment.yaml
│   ├── service.yaml
│   ├── ingress.yaml
│   ├── hpa.yaml
│   └── kustomization.yaml
├── Dockerfile
├── docker-compose.yml
└── package.json

Tech Stack

Category Technology
Framework Next.js 14 (App Router)
Language TypeScript
AWS SDK @aws-sdk/client-ec2, @aws-sdk/client-pricing
Styling CSS (AWS Console inspired)
Container Docker, Kubernetes

Contributing

We welcome contributions! Please see our contributing guidelines (coming soon).

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Roadmap

  • CloudWatch metrics integration (CPU/Memory utilization)
  • Spot instance pricing comparison
  • Savings Plans / Reserved Instance recommendations
  • Cost history and trends
  • Export to CSV/Excel
  • Slack/Teams notifications for cost alerts

License

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


한국어

개요

AWS EC2 Instance Types Explorer는 AWS API에서 실시간으로 EC2 인스턴스 사양과 가격을 조회하고, 리소스 사용률 기반 비용 최적화를 추천하는 웹 애플리케이션입니다.

주요 기능

  • 실시간 데이터 — EC2 API와 Pricing API에서 직접 조회
  • 멀티 리전 — 15개 이상 AWS 리전의 가격 비교
  • 비용 최적화 — CPU/메모리 사용률 기반 Right-sizing 추천
  • 환율 변환 — 실시간 USD→KRW 환율 적용
  • 시간 단위 — 시간당, 일당, 월당, 커스텀 시간 선택
  • 캐싱 — 첫 로딩 후 빠른 응답 (1시간 TTL)
  • 컨테이너 — Docker, Kubernetes 배포 지원

빠른 시작

# 저장소 클론
git clone https://github.com/yourusername/aws-instance-types.git
cd aws-instance-types

# 의존성 설치
npm install

# AWS 자격 증명 설정
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"

# 개발 서버 실행
npm run dev

http://localhost:3000 접속

필요 AWS 권한

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstanceTypes",
        "ec2:DescribeInstances",
        "pricing:GetProducts"
      ],
      "Resource": "*"
    }
  ]
}

네트워크 요구사항

대상 포트 용도
ec2.{region}.amazonaws.com 443 EC2 인스턴스 타입 조회
pricing.us-east-1.amazonaws.com 443 가격 조회
api.exchangerate-api.com 443 환율 조회

라이선스

MIT License

About

aws ec2 cost optimize console

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages