Skip to main content

Scalable Servers API

Overview

Scalable Servers are Auto Scaling Groups (ASG) that automatically adjust the number of EC2 instances based on demand. This provides high availability and automatic scaling for your applications.

Scalable Server Endpoints

Scalable servers use AWS Auto Scaling Groups to automatically manage EC2 instance capacity. GatewaysApp creates ASGs with launch templates, default security groups, and configurable capacity limits.

Create Scalable Server

  • POST /api/:projectSlug/:environmentSlug/scalable-servers - Create a new Auto Scaling Group in AWS
Description: Creates an Auto Scaling Group with:
  • Launch template with specified instance type and AMI
  • Default security group (reuses project/environment default security group if it exists)
  • Configurable min/max/desired capacity
  • Automatic instance health checks
  • Support for multiple availability zones via subnets
Request Body:
Capacity Constraints:
  • minSize must be at least 0
  • maxSize must be at least 1
  • desiredCapacity must be between minSize and maxSize (inclusive)
Example Request:
Example Response:

List Scalable Servers

  • GET /api/:projectSlug/:environmentSlug/scalable-servers - List all scalable servers for a project environment
Description: Retrieves all scalable servers in the specified project and environment. Example Request:
Example Response:

Get Scalable Server Details

  • GET /api/:projectSlug/:environmentSlug/scalable-servers/:id - Get details of a specific scalable server
Description: Retrieves detailed information about a specific scalable server, including instance details. Example Request:
Example Response:

Sync Scalable Server

Note: Scalable server sync is now performed through the unified resources API. Use the unified sync endpoint instead of the type-specific endpoint. Unified Sync Endpoint: PUT /api/:projectSlug/:environmentSlug/resources/:resourceId/sync See Resources API — Sync Resource from Cloud Provider for details. Example Request:
Example Response:

Update Scalable Server Capacity

  • PATCH /api/:projectSlug/:environmentSlug/scalable-servers/:id/capacity - Update scalable server capacity (minSize, maxSize, desiredCapacity)
Description: Updates the Auto Scaling Group’s capacity limits and desired capacity. AWS will automatically adjust the number of instances to match the new desired capacity. Request Body:
Capacity Constraints:
  • minSize must be at least 0 (if provided)
  • maxSize must be at least 1 (if provided)
  • desiredCapacity must be between minSize and maxSize (inclusive)
Example Request:
Example Response:

Delete Scalable Server

Scalable server deletion is performed only via the unified resources API:
  • DELETE /api/:projectSlug/:environmentSlug/resources/:resourceId
Use the scalable server’s database ID. The service deletes resource connections (DNS, etc.), sets ASG capacity to 0, deletes the Auto Scaling Group from AWS, then soft-deletes the resource. See Resources API — Delete Resource by ID. Query: forceDelete=true — Force delete even if instances are still running (default: false). Example:
Example (force delete):

Error Responses

Error: Invalid capacity
Error: No cloud connection
Error: Invalid cloud provider
Error: Scalable server not found

Notes

  • Auto Scaling: AWS automatically adjusts the number of instances based on your capacity settings. You can manually update capacity using the PATCH endpoint.
  • Health Checks: Auto Scaling Groups perform health checks on instances. Unhealthy instances are automatically terminated and replaced.
  • Launch Templates: Each Auto Scaling Group uses a launch template that defines the instance configuration (AMI, instance type, security groups, etc.).
  • Multi-AZ Support: Auto Scaling Groups automatically distribute instances across multiple Availability Zones via subnets.
  • Connections: Scalable servers can be connected to DNS resources and other resources similar to regular instances.
  • Deletion: Deleting a scalable server will terminate all instances and delete all associated connections (DNS records, etc.) before deleting the ASG itself.