0
0
Supabasecloud~30 mins

Cost optimization strategies in Supabase - Mini Project: Build & Apply

Choose your learning style9 modes available
Cost Optimization Strategies with Supabase
📖 Scenario: You are managing a small web app using Supabase as your backend. You want to keep your costs low while ensuring your app runs smoothly.
🎯 Goal: Build a simple Supabase project configuration that demonstrates cost optimization by limiting database size, setting usage thresholds, and enabling automatic backups.
📋 What You'll Learn
Create a Supabase project configuration dictionary with exact keys and values
Add a cost threshold variable to monitor monthly usage
Write a function to check if usage exceeds the threshold
Add a final configuration setting to enable automatic backups
💡 Why This Matters
🌍 Real World
This project simulates managing a Supabase backend with cost controls to avoid unexpected charges.
💼 Career
Understanding cost optimization is key for cloud engineers and developers managing cloud resources efficiently.
Progress0 / 4 steps
1
Create initial Supabase project configuration
Create a dictionary called supabase_config with these exact entries: 'project_name': 'MyApp', 'db_size_gb': 2, 'monthly_usage_gb': 0, and 'auto_backup': False.
Supabase
Hint

Use a Python dictionary with the exact keys and values given.

2
Add a cost threshold variable
Add a variable called cost_threshold_gb and set it to 5 to represent the maximum allowed monthly usage in GB.
Supabase
Hint

Just create a variable with the exact name and value.

3
Write a function to check usage against threshold
Write a function called is_over_threshold that takes no arguments and returns True if supabase_config['monthly_usage_gb'] is greater than cost_threshold_gb, otherwise returns False.
Supabase
Hint

Define a function with the exact name and return the comparison result.

4
Enable automatic backups in configuration
Set supabase_config['auto_backup'] to True to enable automatic backups.
Supabase
Hint

Change the auto_backup key value to True.