Skip to content

Instantly share code, notes, and snippets.

@fabidick22
Created November 23, 2023 04:54
Show Gist options
  • Save fabidick22/11bef02c8bc30f06e268c4eb38964398 to your computer and use it in GitHub Desktop.
Save fabidick22/11bef02c8bc30f06e268c4eb38964398 to your computer and use it in GitHub Desktop.
vcpu_used_by_instance = 1 # Resource used by sh-runner-small-teamS-ruby
gb_used_by_instance = 4 # Resource used by sh-runner-small-teamS-ruby
vcpu_hourly_rate = 0.04048 # Cost per vCPU hour
gb_hourly_rate = 0.004445 # Cost per GB-hour of RAM
workflow_executions = 150 # Number of monthly executions
jobs_per_execution = 30 # Number of jobs per execution
job_duration_hours = 0.0667 # Duration of each job in hours (4 min)
start_time_hours = 0.0333 # Start time in hours (2 min)
optimization_percentage = 0.72 # Start time optimization percentage
hourly_cost_fargate_instance = (vcpu_hourly_rate * vcpu) + (gb_hourly_rate * gb)
# Calculations without SOCI
total_jobs = workflow_executions * jobs_per_execution
cost_per_job_without_soci = (job_duration_hours * hourly_cost_fargate_instance) + (start_time_hours * hourly_cost_fargate_instance)
total_cost_without_soci = total_jobs * cost_per_job_without_soci
# Calculations with SOCI
optimized_start_time_hours = start_time_hours * (1 - optimization_percentage)
cost_per_job_with_soci = (job_duration_hours * hourly_cost_fargate_instance) + (optimized_start_time_hours * hourly_cost_fargate_instance)
total_cost_with_soci = total_jobs * cost_per_job_with_soci
# Monthly Savings Estimate
estimated_savings = total_cost_without_soci - total_cost_with_soci
# Print results
print(f"Total monthly cost without SOCI: ${total_cost_without_soci:.2f}")
print(f"Total monthly cost with SOCI: ${total_cost_with_soci:.2f}")
print(f"Estimated monthly savings: ${estimated_savings:.2f}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment