Treemap

AWS Service Cost Breakdown

Dark-themed treemap showing detailed AWS service cost distribution across compute, storage, and managed services.

Output
AWS Service Cost Breakdown
Python
import matplotlib.pyplot as plt
import squarify
import numpy as np

# AWS costs (monthly in dollars)
labels = ['EC2 Compute', 'RDS Database', 'S3 Storage', 'EKS/Fargate',
          'Lambda', 'CloudFront', 'ElastiCache', 'SageMaker', 'Others']
sizes = [18500, 8200, 4500, 6800, 2200, 2800, 1500, 4200, 2100]
total = sum(sizes)

# CLAUDE.md colors - AWS themed
colors = ['#F5B027', '#276CF5', '#6CF527', '#5314E6', '#27D3F5',
          '#F5276C', '#F54927', '#27F5B0', '#C82909']

fig, ax = plt.subplots(figsize=(12, 8), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

pct = [s/total*100 for s in sizes]
squarify.plot(sizes=sizes, 
              label=[f'{l}\n${s/1000:.1f}K ({p:.1f}%)' for l, s, p in zip(labels, sizes, pct)],
              color=colors, alpha=0.85, ax=ax,
              text_kwargs={'fontsize': 9, 'color': 'white', 'fontweight': 'bold'})

ax.axis('off')
ax.set_title(f'Monthly AWS Costs - ${total/1000:.1f}K', 
             fontsize=18, color='#f8fafc', fontweight='bold', pad=20)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support