Skip to main content
Last Updated: January 28, 2026 Scheduled scaling (time of day) is now a native SaladCloud feature. You can configure schedules directly in the Portal or via the Salad API to adjust replica counts on a fixed timetable. If you need custom logic or integrations, the serverless approach is still available and covered below.

Choose Your Approach

  • SaladCloud Native Scheduled Scaling (recommended): Configure cron schedules in the Portal or API. Best for fixed schedules and the simplest operational setup.
  • Serverless Scheduled Scaling (advanced): Run scheduled functions (AWS Lambda, Cloudflare Workers, or Google Cloud Functions) that call the Salad API. Best for conditional logic, external signals, or coordinating multiple container groups.

SaladCloud Scheduled Scaling (Portal and API)

Scheduled scaling lets you set replica counts at specific times using cron expressions. It works best for predictable usage patterns, such as business hours or nightly batch windows. This approach is ideal for:
  • Business hours scaling: Scale up during work hours, down during nights/weekends
  • Batch processing windows: Prepare resources before scheduled jobs
  • Global applications: Adjust capacity based on regional peak times
  • Cost optimization: Predictably scale to zero during known low-usage periods

Plan Your Scaling Schedule

Before implementing, define your scaling schedule:

Example Scaling Patterns

Business Hours Pattern:
Global Coverage Pattern:
Batch Processing Pattern:

Key Considerations

  • Time Zones: Use UTC in cron schedules
  • Startup Time: Account for SaladCloud’s container startup time (5-15 minutes)
  • Overlap Periods: Plan transitions to handle workload handoffs smoothly
  • Emergency Scaling: Keep manual override capabilities for unexpected load

SaladCloud Portal

You can set a schedule while creating a container group or by editing an existing one. To add scheduled scaling when creating a container group:
  1. On the “Container Configuration” page, find “Scheduled Scaling” just below “Replicas”.
  2. Click “Add Scaling Event”.
To add scheduled scaling to an existing container group:
  1. Open the container group and click “Edit”.
  2. Scroll to the bottom of the page to “Scheduled Scaling” and click “Edit”.
Make sure the “Enable Scheduled Scaling” checkbox is selected.

Salad API

You can also configure scheduled scaling through the Salad API when creating or updating a container group. See Create Container Group and Update Container Group for the request details.

Add Scaling Events

Enter a cron expression and the desired replica count, and SaladCloud will scale the container group on schedule.
Scaling is not immediate. Plan ahead for instances to download the image and start.
You can add multiple cron expressions in the portal in two ways:
  • Add them one by one and click “Add Scaling Event” after each entry.
  • Click “Bulk Edit” and add one entry per line using the format cron_expression=replica_count.
Example bulk entries:
Once you click “Configure”, you will also see explanations of the cron expressions you entered.

Cron Expression Examples

  • 0 8 * * 1-5 - Weekdays at 08:00.
  • 0 18 * * 1-5 - Weekdays at 18:00.
  • 0 0 1 * * - First day of every month at 00:00.
  • 0 2 * * * - Daily at 02:00.
For help building cron expressions, see https://crontab.guru.

Serverless Scheduled Scaling (Advanced)

Use this approach when you need conditional logic, external signals, or custom integrations. It relies on scheduled serverless functions that call the Salad API at specific times.

Serverless Prerequisites

Before you begin, ensure you have:
  • SaladCloud API Key: You’ll need a valid API key with permissions to manage container groups
  • Organization and Project: An active organization and project in SaladCloud
  • Container Group: An existing container group that you want to scale on a schedule
  • Serverless Platform Access: Account on one of the supported platforms (AWS Lambda, Cloudflare Workers, etc.)
  • Time Zone Planning: Clear understanding of your scaling schedule and time zones
Cost Optimization: Time-of-day scaling is particularly effective for workloads with predictable patterns, allowing you to scale to zero during off-hours and scale up before peak demand, optimizing both cost and performance.

Serverless Approach Overview

Serverless scheduled scaling works by scheduling functions to run at specific times when you want to change your replica count:
  1. Schedule functions to trigger at exact times when scaling is needed
  2. Execute scaling actions directly without checking current time
  3. Call the SaladCloud API to set the desired replica count
  4. Handle state transitions (starting/stopping container groups as needed)

Choose Your Serverless Implementation

Select one of the following serverless platforms for implementing serverless scheduled scaling:

Option A: AWS Lambda + EventBridge

  • Best for: AWS-heavy environments, complex logic, integration with other AWS services
  • Scheduling: EventBridge with cron expressions and event payloads
  • Cost: Pay-per-invocation, very cost-effective for periodic scaling

Option B: Cloudflare Workers + Cron Triggers

  • Best for: Global distribution, simple logic, edge computing integration
  • Scheduling: Built-in cron triggers with environment-based configuration
  • Cost: Generous free tier, low latency execution

Option C: Google Cloud Functions + Cloud Scheduler

  • Best for: Google Cloud environments, integration with GCP services
  • Scheduling: Cloud Scheduler with flexible cron expressions
  • Cost: Pay-per-invocation with generous free tier

AWS Lambda Implementation

Here’s a complete AWS Lambda implementation for serverless scheduled scaling:

Lambda Function Code

Deployment Configuration

  1. Create the Lambda Function:
    • Runtime: Python 3.9 or later
    • Timeout: 30 seconds
    • Memory: 128 MB (sufficient for API calls)
  2. Set Environment Variables:
  3. Create Multiple EventBridge Rules for Your Schedule: Business Hours Start (8 AM Monday-Friday):
    Business Hours End (6 PM Monday-Friday):
    Batch Processing Start (2 AM Daily):
    Batch Processing End (6 AM Daily):
    Weekend Scale Down (Saturday 12 AM):
Alternative: Infrastructure as Code (CloudFormation/Terraform)

Testing Your Lambda Implementation

Unit Testing:
Manual Testing:
Dry-Run Mode: Add a dry-run mode for testing without actual scaling:

Cloudflare Workers Implementation

Cloudflare Workers provides a clean single-worker approach where all scaling configuration is defined in the wrangler.toml file through environment variables:

Worker Script (src/index.js)

Wrangler Configuration

The key is to deploy the same worker multiple times with different names and environment variables. Create separate wrangler.toml files for each scaling action: Business Hours Start (wrangler-business-start.toml):
Business Hours End (wrangler-business-end.toml):
Batch Processing Start (wrangler-batch-start.toml):
Overnight Shutdown (wrangler-shutdown.toml):
Weekend Scale Down (wrangler-weekend.toml):

Deployment Commands

Deploy each worker with its specific configuration:

Simplified Deployment Script

Create a deploy.sh script to automate the process:
Make it executable and run:

Testing Your Cloudflare Workers Implementation

Manual Trigger Testing:
Testing with Dry-Run Mode: Add a DRY_RUN environment variable to your wrangler.toml for testing:
Then update your worker code to support dry-run:
Testing Individual Workers:

Serverless Best Practices

Scheduling Considerations

  1. Account for Startup Time: SaladCloud containers can take 5-15 minutes to start
    • Schedule scale-up 15-30 minutes before you need the capacity
    • Use multiple scaling events rather than trying to predict exact timing
  2. Minimize Unnecessary Executions:
    • Only schedule functions when you need to change replica counts
    • Each cron trigger should have a specific scaling purpose
    • Avoid overlapping schedules that might conflict
  3. Handle Time Zones Properly:
    • Use UTC in your cron expressions to avoid daylight saving issues
    • Convert business hours to UTC when setting up schedules
    • Document your schedule clearly for future maintenance

Error Handling and Reliability

Cost Optimization

  1. Scale to Zero: Use 0 replicas during guaranteed low-usage periods
  2. Gradual Scaling: Implement stepped scaling instead of jumping to max replicas
  3. Weekend Patterns: Reduce capacity during weekends unless needed

Troubleshooting

Common Issues

  1. Function Not Triggering:
    • Verify cron expressions are correct
    • Check function permissions and environment variables
    • Review platform-specific logs
  2. API Authentication Errors:
    • Ensure API key is correctly set as environment variable
    • Verify API key has necessary permissions
    • Check for trailing spaces in environment variables
  3. Incorrect Scaling:
    • Test your time calculation logic with various dates
    • Verify timezone handling (use UTC consistently)
    • Check for off-by-one errors in hour comparisons
  4. Container Group Not Responding:
    • Allow 5-15 minutes for scaling operations to complete
    • Check container group status in SaladCloud portal
    • Verify container group name matches exactly

Debugging Tools

Integration with Existing Autoscaling

You can combine serverless scheduled scaling with queue-based autoscaling:

Next Steps

  • 📊 Monitor Performance: Set up dashboards to track scaling effectiveness
  • 🔧 Optimize Schedule: Adjust timing based on actual usage patterns
  • 🚨 Add Alerting: Implement notifications for scaling failures
  • 📈 Cost Analysis: Track cost savings from optimized scaling
  • 🔄 Backup Strategy: Consider hybrid queue-based scaling for unexpected load