When to use this runbook
Use to create a new Container Group or change the configuration of one existing Container Group through the public API.When not to use it
Do not use it to start, stop, monitor, or replace an individual instance; use Monitor and Operate a Container Group. Do not create a second group as an implicit rollback or workaround.Required inputs
SALAD_API_KEY,SALAD_ORGANIZATION,SALAD_PROJECT, and intendedSALAD_CONTAINER_GROUPname.- Container image reference, CPU cores, RAM in MB, optional storage in bytes, live GPU class UUIDs if needed, desired replicas, priority, restart policy, and autostart choice.
- Optional command, environment-variable map, private-registry credentials, countries, networking, probes, queue connection, autoscaler, and scheduled scaling settings.
- Explicit user intent for an update that scales down, interrupts/replaces running replicas, changes the image or resources, weakens authentication/health controls, or stops/deletes a resource.
SALAD_REGISTRY_USERNAME, SALAD_REGISTRY_PASSWORD,
SALAD_REGISTRY_TOKEN, or SALAD_REGISTRY_SERVICE_KEY only when the selected registry schema requires them. Never echo
them or include them in evidence.
Authoritative sources
Use Managing Deployments,
Container Registries, and
Health Probes for product behavior.
Dynamic values to retrieve
- Exact existing group names and the current target representation, including
version,pending_change,replicas,current_state, container settings, priority, networking, probes, and queue settings. - Current quota, GPU class UUIDs, and CPU/GPU availability from Discover Scope and Preflight.
- Current instances and their versions when the update can roll out new configuration.
Preflight checks
- Complete the scope, duplicate, quota, hardware, and availability checks in the preflight runbook.
- Call
list_container_groupsand compare the exactname, notdisplay_name, with the intended name. - If the exact name exists, call
get_container_groupand compare current versus intended configuration. - If it does not exist, validate the create body against
ContainerGroupPrototype. Required fields arename,container,replicas,restart_policy, andautostart_policy;containerrequiresimageandresources; create resources requirecpuandmemory. - For an update, use
application/merge-patch+jsonand theContainerGroupPatchschema. Do not send response-only fields such asid,current_state,version,create_time, orupdate_time. - Record a redacted pre-change copy and success predicate. If a current secret value is masked or omitted and the planned update could replace it, stop for that value.
Procedure
Create a group
Create only when the exact-name list check proves the group is absent. This example is a schema-derived template; the image placeholder must be replaced, and GPU class UUIDs must come from the live API when GPUs are required.agent-example-group with the approved SALAD_CONTAINER_GROUP value when constructing the actual request; do
not execute the example name. Set autostart_policy: true only when the user intends creation to start capacity.
Update a group
- Read with
get_container_groupimmediately before the patch. - Build nested objects using only fields allowed by
ContainerGroupPatch, carrying forward any unrelated caller-managed values that the selected patch could replace. For environment variables, preserve unrelated key/value pairs locally and do not log secret values. - Send the smallest merge patch that has an unambiguous effect. For example, an approved scale-up from the observed replica count to 3 is:
- Call
get_container_groupafter the write. If runtime configuration changed, calllist_container_group_instancesand compare each instanceversionwith the groupversion. - Poll within the declared budget until the success condition is met or report partial/pending state.
Decision rules
Priority is
container.priority in create/update requests. Valid values are high, medium, low, and batch.
Select at most the approved countries through country_codes; omitting the field permits any country.
For a probe, choose the intended exec, grpc, http, or tcp handler and include all required timing fields.
Startup protects slow initialization; readiness controls whether work or gateway traffic should reach a running
instance; liveness detects an unrecoverable running application. Misconfigured startup or liveness probes can cause
reallocation, so validate the handler inside the image before enabling it.
Expected states and responses
- Create returns
201with a Container Group representation. With image preparation or autostart, status may progress throughpending,stopped,deploying, andrunning; use the live response, not a fixed sequence assumption. - Update returns
200.pending_change: truemeans requested configuration has not reached all containers. - Group status enum values are
pending,running,stopped,succeeded,failed, anddeploying. - Instance state enum values are
allocating,downloading,creating,running, andstopping. replicasis desired capacity. Compare it withcurrent_state.instance_status_countsand the instance list; ready capacity requiresstate: runningandready: truewhen readiness matters.
Retry behavior
Retry reads within a bounded budget. Do not retrycreate_container_group until an exact-name list/get reconciliation
proves the first request did not create the resource. Before retrying a patch, re-read and skip it if the desired state
already applied. Do not retry unchanged 400, 401, or 403 responses. Honor Retry-After on 429 when present.
Verification
Never claim deployment success solely from
201 or 200.
Rollback or recovery
- For an update, re-read, then merge-patch only changed fields back to captured pre-change values. Verify again.
- Image rollback for a private registry requires the prior image reference and usable registry credentials; stop if they are unavailable.
- If a create prepares but fails, retain it for logs and system events. Deletion requires explicit user intent.
- If availability or quota prevents convergence, do not silently relax hardware, countries, priority, or replicas.
Stop and escalation conditions
Stop for ambiguous names, missing required fields or secrets, insufficient quota/availability, unsupported patch fields, masked values that cannot be preserved, missing interruption authorization, persistentpending_change, a failed
group, or instances that do not converge before the polling budget. Continue with the
troubleshooting runbook before escalation.