Files
mockupAWS/alembic/versions/0892c44b2a58_seed_aws_pricing_data.py
Luca Sacchi Ricciardi 216f9e229c feat(database): seed AWS pricing data
Populate aws_pricing table with real AWS pricing for:

Services:
- SQS: /bin/bash.40 per million requests
- Lambda: /bin/bash.20 per million requests + /bin/bash.0000166667 per GB-second
- Bedrock Claude 3 Sonnet: /bin/bash.003 input / /bin/bash.015 output per 1K tokens

Regions:
- us-east-1 (N. Virginia)
- eu-west-1 (Ireland)

Total: 10 pricing records inserted

Task: DB-007 complete
All database tasks (DB-001 to DB-007) now complete!

Next: Backend team can proceed with SQLAlchemy models and repositories.
2026-04-07 13:55:30 +02:00

137 lines
4.3 KiB
Python

"""seed aws pricing data
Revision ID: 0892c44b2a58
Revises: e80c6eef58b2
Create Date: 2026-04-07 13:53:23.116106
"""
from typing import Sequence, Union
from uuid import uuid4
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "0892c44b2a58"
down_revision: Union[str, Sequence[str], None] = "e80c6eef58b2"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Seed AWS pricing data."""
# Pricing data for us-east-1 (N. Virginia)
pricing_data = [
# SQS Pricing
{
"id": str(uuid4()),
"service": "sqs",
"region": "us-east-1",
"tier": "standard",
"price_per_unit": 0.40,
"unit": "per_million_requests",
"description": "Amazon SQS Standard Queue - API requests",
},
# Lambda Pricing
{
"id": str(uuid4()),
"service": "lambda",
"region": "us-east-1",
"tier": "x86_request",
"price_per_unit": 0.20,
"unit": "per_million_requests",
"description": "AWS Lambda x86 - Request charges",
},
{
"id": str(uuid4()),
"service": "lambda",
"region": "us-east-1",
"tier": "x86_compute",
"price_per_unit": 0.0000166667,
"unit": "per_gb_second",
"description": "AWS Lambda x86 - Compute charges",
},
# Bedrock Pricing (Claude 3)
{
"id": str(uuid4()),
"service": "bedrock",
"region": "us-east-1",
"tier": "claude_3_sonnet_input",
"price_per_unit": 0.003,
"unit": "per_1k_tokens",
"description": "Amazon Bedrock - Claude 3 Sonnet Input",
},
{
"id": str(uuid4()),
"service": "bedrock",
"region": "us-east-1",
"tier": "claude_3_sonnet_output",
"price_per_unit": 0.015,
"unit": "per_1k_tokens",
"description": "Amazon Bedrock - Claude 3 Sonnet Output",
},
# eu-west-1 (Ireland) - similar pricing
{
"id": str(uuid4()),
"service": "sqs",
"region": "eu-west-1",
"tier": "standard",
"price_per_unit": 0.40,
"unit": "per_million_requests",
"description": "Amazon SQS Standard Queue - API requests",
},
{
"id": str(uuid4()),
"service": "lambda",
"region": "eu-west-1",
"tier": "x86_request",
"price_per_unit": 0.20,
"unit": "per_million_requests",
"description": "AWS Lambda x86 - Request charges",
},
{
"id": str(uuid4()),
"service": "lambda",
"region": "eu-west-1",
"tier": "x86_compute",
"price_per_unit": 0.0000166667,
"unit": "per_gb_second",
"description": "AWS Lambda x86 - Compute charges",
},
{
"id": str(uuid4()),
"service": "bedrock",
"region": "eu-west-1",
"tier": "claude_3_sonnet_input",
"price_per_unit": 0.003,
"unit": "per_1k_tokens",
"description": "Amazon Bedrock - Claude 3 Sonnet Input",
},
{
"id": str(uuid4()),
"service": "bedrock",
"region": "eu-west-1",
"tier": "claude_3_sonnet_output",
"price_per_unit": 0.015,
"unit": "per_1k_tokens",
"description": "Amazon Bedrock - Claude 3 Sonnet Output",
},
]
# Insert data using bulk insert
for data in pricing_data:
op.execute(f"""
INSERT INTO aws_pricing
(id, service, region, tier, price_per_unit, unit, description, is_active, effective_from)
VALUES
('{data["id"]}', '{data["service"]}', '{data["region"]}', '{data["tier"]}',
{data["price_per_unit"]}, '{data["unit"]}', '{data["description"]}',
true, CURRENT_DATE)
""")
def downgrade() -> None:
"""Remove seeded pricing data."""
op.execute("DELETE FROM aws_pricing WHERE is_active = true;")