Skip to main content Skip to content

Resource Groups

Organize related resources and schedule them together with execution tiers and ordering for dependency-aware start and stop.

4 min read Last updated: 

Resource groups let you organize related resources and schedule them together with defined execution ordering.

Overview

A resource group is a logical collection of cloud resources that should be managed together. When a group is attached to a schedule, all its members are started/stopped according to their execution tier and order, so dependencies are respected.

Create Resource Group

POST /resource-groups

Create a new resource group.

Request
curl -X POST https://api.zop.dev/resource-groups \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Backend Stack",
"description": "Database, cache, and app servers for the backend"
}'
Response
{
"data": {
"id": "9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
"orgId": "3f6c2a9e-8b1d-4c7e-9f2a-1d5e6b7c8a90",
"name": "Backend Stack",
"description": "Database, cache, and app servers for the backend",
"members": [],
"createdBy": "user@company.com",
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}
}

List Resource Groups

GET /resource-groups

List all resource groups.

Get Resource Group

GET /resource-groups/{groupID}

Get a resource group with its members.

Get Group Schedules

GET /resource-groups/{groupID}/schedules

List all schedules attached to a resource group.

Update Resource Group

PUT /resource-groups/{groupID}

Update group name or description.

Request
curl -X PUT https://api.zop.dev/resource-groups/9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Full Backend Stack",
"description": "Updated description"
}'

Delete Resource Group

DELETE /resource-groups/{groupID}

Delete a resource group. Schedule attachments are also removed. Deletion is permanent and cannot be undone.

Add Member

POST /resource-groups/{groupID}/resources/{resourceID}

Add a resource to the group.

Members get an execution tier inferred from their resource type: database for RDS, Cloud SQL and other SQL databases; app for EKS, GKE, AKS, ECS, Cloud Run and Function Apps; storage for disks and buckets; compute for everything else. Use the update sequence endpoint to override the tier or set the order.

Update Execution Order

PATCH /resource-groups/{groupID}/resources/{resourceID}/sequence

Update the execution tier and order for a group member.

Request
curl -X PATCH https://api.zop.dev/resource-groups/9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/resources/0b7d5c3e-2f1a-4e9b-8c6d-5a4b3c2d1e0f/sequence \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"executionTier": "database",
"executionOrder": 1,
"startDelay": 0,
"stopDelay": 0
}'

executionTier must be one of app, compute, database or storage. Any other value is treated as compute. startDelay and stopDelay add an offset in seconds before the member’s start or stop runs.

Example ordering for a backend stack:

ResourceTierOrderStarts
PostgreSQL RDSdatabase1First
Redis ElastiCachedatabase2Second
App Server EC2app1After the database tier
Worker EC2app2After the app server

On stop, the tiers run in reverse: the app tier stops before the database tier.

Remove Member

DELETE /resource-groups/{groupID}/resources/{resourceID}

Remove a resource from the group.

Group Member Object

FieldTypeDescription
idstringMembership ID
groupIdstringResource group ID
resourceIdstringZopNight resource ID
resourceUidstringCloud provider resource UID
resourceNamestringResource display name
resourceTypestringResource type (e.g., ec2)
providerstringCloud provider
cloudAccountIdstringConnected cloud account ID
regionstringCloud region
executionTierstringapp, compute, database or storage
executionOrderintegerOrder within the tier
startDelayintegerSeconds to wait before starting this member
stopDelayintegerSeconds to wait before stopping this member
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·