google-agents-cli-scaffold
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
infrastructure-cost-optimization
Optimize cloud infrastructure costs through resource rightsizing, reserved instances, spot instances, and waste reduction strategies.
Full skill instructions
Reduce infrastructure costs through intelligent resource allocation, reserved instances, spot instances, and continuous optimization without sacrificing performance.
# cost-optimization-setup.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: cost-optimization-scripts
namespace: operations
data:
analyze-costs.sh: |
#!/bin/bash
set -euo pipefail
echo "=== AWS Cost Analysis ==="
# Get daily cost trend
echo "Daily costs for last 7 days:"
aws ce get-cost-and-usage \
--time-period Start=$(date -d '7 days ago' +%Y-%m-%d),End=$(date +%Y-%m-%d) \
--granularity DAILY \
--metrics "BlendedCost" \
--group-by Type=DIMENSION,Key=SERVICE \
--query 'ResultsByTime[*].[TimePeriod.Start,Total.BlendedCost.Amount]' \
--output table
# Find unattached resources
echo -e "\n=== Unattached EBS Volumes ==="
aws ec2 describe-volumes \
--filters Name=status,Values=available \
--query 'Volumes[*].[VolumeId,Size,CreateTime]' \
--output table
echo -e "\n=== Unattached Elastic IPs ==="
aws ec2 describe-addresses \
--filters Name=association-id,Values=none \
--query 'Addresses[*].[PublicIp,AllocationId]' \
--output table
echo -e "\n=== Unused RDS Instances ==="
aws rds describe-db-instances \
--query 'DBInstances[?DBInstanceStatus==`available`].[DBInstanceIdentifier,DBInstanceClass,Engine,AllocatedStorage]' \
--output table
# Estimate savings with Reserved Instances
echo -e "\n=== Reserved Instance Savings Potential ==="
aws ce get-reservation-purchase-recommendation \
--service "EC2" \
--lookback-period THIRTY_DAYS \
--query 'Recommendations[0].[RecommendationSummary.TotalEstimatedMonthlySavingsAmount,RecommendationSummary.TotalEstimatedMonthlySavingsPercentage]' \
--output table
optimize-resources.sh: |
#!/bin/bash
set -euo pipefail
echo "Starting resource optimization..."
# Remove unattached volumes
echo "Removing unattached volumes..."
aws ec2 describe-volumes \
--filters Name=status,Values=available \
--query 'Volumes[*].VolumeId' \
--output text | \
while read volume_id; do
echo "Deleting volume: $volume_id"
aws ec2 delete-volume --volume-id "$volume_id" 2>/dev/null || true
done
# Release unused Elastic IPs
echo "Releasing unused Elastic IPs..."
aws ec2 describe-addresses \
--filters Name=association-id,Values=none \
--query 'Addresses[*].AllocationId' \
--output text | \
while read alloc_id; do
echo "Releasing EIP: $alloc_id"
aws ec2 release-address --allocation-id "$alloc_id" 2>/dev/null || true
done
# Modify RDS to smaller instances
echo "Analyzing RDS for downsizing..."
# Implement logic to check CloudWatch metrics and downsize if needed
echo "Optimization complete"
---
# Terraform cost optimization
resource "aws_ec2_instance" "spot" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t3.medium"
# Use spot instances for non-critical workloads
instance_market_options {
market_type = "spot"
spot_options {
max_price = "0.05" # Set max price
spot_instance_type = "persistent"
interrupt_behavior = "terminate"
valid_until = "2025-12-31T23:59:59Z"
}
}
tags = {
Name = "spot-instance"
CostCenter = "engineering"
}
}
# Reserved instance for baseline capacity
resource "aws_ec2_instance" "reserved" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t3.medium"
# Tag for reserved instance matching
tags = {
Name = "reserved-instance"
ReservationType = "reserved"
}
}
resource "aws_ec2_fleet" "mixed" {
name = "mixed-capacity"
launch_template_configs {
launch_template_specification {
launch_template_id = aws_launch_template.app.id
version = "$Latest"
}
overrides {
instance_type = "t3.medium"
weighted_capacity = "1"
priority = 1 # Reserved
}
overrides {
instance_type = "t3.large"
weighted_capacity = "2"
priority = 2 # Reserved
}
overrides {
instance_type = "t3a.medium"
weighted_capacity = "1"
priority = 3 # Spot
}
overrides {
instance_type = "t3a.large"
weighted_capacity = "2"
priority = 4 # Spot
}
}
target_capacity_specification {
total_target_capacity = 10
on_demand_target_capacity = 6
spot_target_capacity = 4
default_target_capacity_type = "on-demand"
}
fleet_type = "maintain"
}
# k8s-cost-optimization.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: cost-optimization-policies
namespace: kube-system
data:
policies.yaml: |
# Resource quotas per namespace
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-quota
namespace: production
spec:
hard:
requests.cpu: "100"
requests.memory: "200Gi"
limits.cpu: "200"
limits.memory: "400Gi"
pods: "500"
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values: ["high", "medium"]
---
# Pod Disruption Budget for cost-effective scaling
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: cost-optimized-pdb
namespace: production
spec:
minAvailable: 1
selector:
matchLabels:
tier: backend
---
# Prioritize spot instances with taints/tolerations
apiVersion: v1
kind: Node
metadata:
name: spot-node-1
spec:
taints:
- key: cloud.google.com/gke-preemptible
value: "true"
effect: NoSchedule
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cost-optimized-app
namespace: production
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
# Tolerate spot instances
tolerations:
- key: cloud.google.com/gke-preemptible
operator: Equal
value: "true"
effect: NoSchedule
# Prefer nodes with lower cost
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: karpenter.sh/capacity-type
operator: In
values: ["spot"]
containers:
- name: app
image: myapp:latest
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
# cost-monitoring.py
import boto3
import json
from datetime import datetime, timedelta
class CostOptimizer:
def __init__(self):
self.ce_client = boto3.client('ce')
self.ec2_client = boto3.client('ec2')
self.rds_client = boto3.client('rds')
def get_daily_costs(self, days=30):
"""Get daily costs for past N days"""
end_date = datetime.now().date()
start_date = end_date - timedelta(days=days)
response = self.ce_client.get_cost_and_usage(
TimePeriod={
'Start': str(start_date),
'End': str(end_date)
},
Granularity='DAILY',
Metrics=['BlendedCost'],
GroupBy=[
{'Type': 'DIMENSION', 'Key': 'SERVICE'}
]
)
return response
def find_underutilized_instances(self):
"""Find EC2 instances with low CPU usage"""
cloudwatch = boto3.client('cloudwatch')
instances = []
ec2_instances = self.ec2_client.describe_instances()
for reservation in ec2_instances['Reservations']:
for instance in reservation['Instances']:
instance_id = instance['InstanceId']
# Check CPU utilization
response = cloudwatch.get_metric_statistics(
Namespace='AWS/EC2',
MetricName='CPUUtilization',
Dimensions=[{'Name': 'InstanceId', 'Value': instance_id}],
StartTime=datetime.now() - timedelta(days=7),
EndTime=datetime.now(),
Period=3600,
Statistics=['Average']
)
if response['Datapoints']:
avg_cpu = sum(d['Average'] for d in response['Datapoints']) / len(response['Datapoints'])
if avg_cpu < 10: # Less than 10% average
instances.append({
'InstanceId': instance_id,
'Type': instance['InstanceType'],
'AverageCPU': avg_cpu,
'Recommendation': 'Downsize or terminate'
})
return instances
def estimate_reserved_instance_savings(self):
"""Estimate potential savings from reserved instances"""
response = self.ce_client.get_reservation_purchase_recommendation(
Service='EC2',
LookbackPeriod='THIRTY_DAYS',
PageSize=100
)
total_savings = 0
for recommendation in response.get('Recommendations', []):
summary = recommendation['RecommendationSummary']
savings = float(summary['EstimatedMonthlyMonthlySavingsAmount'])
total_savings += savings
return total_savings
def generate_report(self):
"""Generate comprehensive cost optimization report"""
print("=== Cost Optimization Report ===\n")
# Daily costs
print("Daily Costs:")
costs = self.get_daily_costs(7)
for result in costs['ResultsByTime']:
date = result['TimePeriod']['Start']
total = result['Total']['BlendedCost']['Amount']
print(f" {date}: ${total}")
# Underutilized instances
print("\nUnderutilized Instances:")
underutilized = self.find_underutilized_instances()
for instance in underutilized:
print(f" {instance['InstanceId']}: {instance['AverageCPU']:.1f}% CPU - {instance['Recommendation']}")
# Reserved instance savings
print("\nReserved Instance Savings Potential:")
savings = self.estimate_reserved_instance_savings()
print(f" Estimated Monthly Savings: ${savings:.2f}")
# Usage
if __name__ == '__main__':
optimizer = CostOptimizer()
optimizer.generate_report()
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.
Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.
Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.
Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.
Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.
Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.
Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.
Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.
Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Opus.ai: Revolutionize Your Web Experience
Build a no-code AI app in minutes.
An IDE for code migration from legacy to modern frameworks through coding agents.
Automate CGI animation in live-action scenes
Branded artistic QR-code concepts
Launch a website in seconds with AI.
Streamline Your Coding Experience with AI Code Helper
Convert any screenshot or design to clean code.