Resource Groups
Organize related resources and schedule them together with execution tiers and ordering for dependency-aware start and stop.
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
/resource-groups Create a new resource group.
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" }'{ "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
/resource-groups List all resource groups.
Get Resource Group
/resource-groups/{groupID} Get a resource group with its members.
Get Group Schedules
/resource-groups/{groupID}/schedules List all schedules attached to a resource group.
Update Resource Group
/resource-groups/{groupID} Update group name or description.
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
/resource-groups/{groupID} Delete a resource group. Schedule attachments are also removed. Deletion is permanent and cannot be undone.
Add Member
/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
/resource-groups/{groupID}/resources/{resourceID}/sequence Update the execution tier and order for a group member.
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:
| Resource | Tier | Order | Starts |
|---|---|---|---|
| PostgreSQL RDS | database | 1 | First |
| Redis ElastiCache | database | 2 | Second |
| App Server EC2 | app | 1 | After the database tier |
| Worker EC2 | app | 2 | After the app server |
On stop, the tiers run in reverse: the app tier stops before the database tier.
Remove Member
/resource-groups/{groupID}/resources/{resourceID} Remove a resource from the group.
Group Member Object
| Field | Type | Description |
|---|---|---|
id | string | Membership ID |
groupId | string | Resource group ID |
resourceId | string | ZopNight resource ID |
resourceUid | string | Cloud provider resource UID |
resourceName | string | Resource display name |
resourceType | string | Resource type (e.g., ec2) |
provider | string | Cloud provider |
cloudAccountId | string | Connected cloud account ID |
region | string | Cloud region |
executionTier | string | app, compute, database or storage |
executionOrder | integer | Order within the tier |
startDelay | integer | Seconds to wait before starting this member |
stopDelay | integer | Seconds to wait before stopping this member |