Skip to content

Upgrade the in-VM agent in place on one or more instances.

POST
/v1/projects/{projectId}/compute/instances/actions/refresh-agent
Code sample: Shell / cURL
curl --request POST \
--url https://stratum.example.com/v1/projects/example/compute/instances/actions/refresh-agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "instanceIds": [ "i-a8c2d4e6f0" ] }'

The “refresh agent” button. Re-fetches the current agent binary from IMDS and reinstalls the full systemd unit set on each target over its live Session Manager channel (no relaunch, no floating IP), so an instance launched before a unit existed (e.g. the inventory units) gains it. Requires a LIVE agent channel: an instance whose agent was never enabled at all has no rail to reach and still needs a relaunch — that is reported in-band in the per-instance error. Gates on the compute:RunCommand Cedar action in the project.

the rail is picked per instance from what its agent advertised on its session channel, never by trying one and waiting. An agent that supports it runs the refresh as root itself (method: agent-root, the self-update path, no login-user sudo) and checks the installed binary against the checksum the control plane serves. An older agent gets the previous run-command refresh (method: sudo-fallback), which needs the agent’s login user to hold passwordless sudo; when it does not, the result says so in error and nothing on the instance is changed. Every per-instance failure is in-band: the call answers 200 as long as the request is well-formed.

projectId
required
string
/^p-[a-z0-9-]+$/
Media typeapplication/json

Request to upgrade the in-VM agent in place on instances.

object
instanceIds
required

Target instance ids (i-…). Up to 100 per call.

Array<string>
>= 1 items <= 100 items

Example

[
"i-a8c2d4e6f0"
]

Per-instance refresh results.

Media typeapplication/json
object
results
required
Array<object>

One instance’s agent-refresh outcome. Carries the run-command result fields plus the rail the refresh took.

object
instanceId
required
string
method

The rail the refresh took. agent-root: the agent advertised the root refresh on its session channel and ran the served bootstrap as itself, the same path its heartbeat self-update takes, with no login-user sudo. sudo-fallback: the agent predates that, so the refresh ran as the agent’s login user through passwordless sudo. Absent when the refresh never reached an agent (instance not running, agent unavailable, channel busy); error then says why.

string
Allowed values: agent-root sudo-fallback
exitCode
required

Exit status of the refresh bootstrap on the instance.

integer
output
required

Combined stdout+stderr of the refresh, truncated to 64 KiB.

string
truncated
required

True when output was truncated at the 64 KiB cap.

boolean
error

Set whenever the refresh did not complete on this instance, naming the rail and the reason: not reachable, the login user has no passwordless sudo on the sudo-fallback rail, the bootstrap failed, or the installed agent did not match the checksum the control plane serves. Unlike run-command, a non-zero exitCode always comes with an error here.

string

Example

{
"results": [
{
"instanceId": "i-a8c2d4e6f0",
"method": "agent-root",
"exitCode": 0,
"error": "agent refresh via agent-root failed: the agent bootstrap exited 1 (see output)"
}
]
}

Bad request.

Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
>= 400 <= 599
detail
string
instance
string format: uri-reference
requestId
required
string
code
required
string
issues

The findings of a rejected IAM policy document (custom and resource policies).

Array<object>

One finding of a rejected IAM policy document. A rejection lists every finding, so the author fixes the document in one round trip.

object
code
required

The finding, e.g. INVALID_DOCUMENT, UNKNOWN_ACTION, ACTION_NOT_APPLICABLE.

string
statement
required

Index of the statement at fault; -1 for the document as a whole.

integer
>= -1
detail
required
string
action

The offending action, where one is at fault (ACTION_NOT_APPLICABLE).

string
errors

Field errors, for codes that carry them: each problem at its field (see FieldError). Documented on the responses that set it, e.g. approveNodeJoin’s INVALID_INPUT and JOIN_APPROVAL_REFUSED. Absent otherwise.

Array<object>

One field’s problem, the stage-2 installer API’s shape. field is the field’s path, message what is wrong with it.

object
field
required

The field’s path, e.g. links[0].interface, disks[1].confirm, mgmt.address or role; empty for the whole request.

string
message
required
string
details

Structured facts about the refusal, for codes that carry them. The shape is fixed per code and documented on the response that answers it, e.g. IMAGE_POOL_MISMATCH (see ImagePoolMismatchDetails) and IMAGE_IN_USE. Absent for codes that carry none.

object
key
additional properties
any

Example

{
"issues": [
{
"code": "ACTION_NOT_APPLICABLE",
"action": "compute:CreateVpc"
}
]
}

Authenticated but not authorized.

Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
>= 400 <= 599
detail
string
instance
string format: uri-reference
requestId
required
string
code
required
string
issues

The findings of a rejected IAM policy document (custom and resource policies).

Array<object>

One finding of a rejected IAM policy document. A rejection lists every finding, so the author fixes the document in one round trip.

object
code
required

The finding, e.g. INVALID_DOCUMENT, UNKNOWN_ACTION, ACTION_NOT_APPLICABLE.

string
statement
required

Index of the statement at fault; -1 for the document as a whole.

integer
>= -1
detail
required
string
action

The offending action, where one is at fault (ACTION_NOT_APPLICABLE).

string
errors

Field errors, for codes that carry them: each problem at its field (see FieldError). Documented on the responses that set it, e.g. approveNodeJoin’s INVALID_INPUT and JOIN_APPROVAL_REFUSED. Absent otherwise.

Array<object>

One field’s problem, the stage-2 installer API’s shape. field is the field’s path, message what is wrong with it.

object
field
required

The field’s path, e.g. links[0].interface, disks[1].confirm, mgmt.address or role; empty for the whole request.

string
message
required
string
details

Structured facts about the refusal, for codes that carry them. The shape is fixed per code and documented on the response that answers it, e.g. IMAGE_POOL_MISMATCH (see ImagePoolMismatchDetails) and IMAGE_IN_USE. Absent for codes that carry none.

object
key
additional properties
any

Example

{
"issues": [
{
"code": "ACTION_NOT_APPLICABLE",
"action": "compute:CreateVpc"
}
]
}

Request rate limit exceeded. The API-boundary throttle caps request throughput per principal and per project; code is RATE_LIMITED (distinct from the quota engine’s QUOTA_EXCEEDED). The Retry-After header carries the seconds to wait. Applies to any authenticated endpoint — it is enforced by middleware, not per-path.

Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
>= 400 <= 599
detail
string
instance
string format: uri-reference
requestId
required
string
code
required
string
issues

The findings of a rejected IAM policy document (custom and resource policies).

Array<object>

One finding of a rejected IAM policy document. A rejection lists every finding, so the author fixes the document in one round trip.

object
code
required

The finding, e.g. INVALID_DOCUMENT, UNKNOWN_ACTION, ACTION_NOT_APPLICABLE.

string
statement
required

Index of the statement at fault; -1 for the document as a whole.

integer
>= -1
detail
required
string
action

The offending action, where one is at fault (ACTION_NOT_APPLICABLE).

string
errors

Field errors, for codes that carry them: each problem at its field (see FieldError). Documented on the responses that set it, e.g. approveNodeJoin’s INVALID_INPUT and JOIN_APPROVAL_REFUSED. Absent otherwise.

Array<object>

One field’s problem, the stage-2 installer API’s shape. field is the field’s path, message what is wrong with it.

object
field
required

The field’s path, e.g. links[0].interface, disks[1].confirm, mgmt.address or role; empty for the whole request.

string
message
required
string
details

Structured facts about the refusal, for codes that carry them. The shape is fixed per code and documented on the response that answers it, e.g. IMAGE_POOL_MISMATCH (see ImagePoolMismatchDetails) and IMAGE_IN_USE. Absent for codes that carry none.

object
key
additional properties
any

Example

{
"issues": [
{
"code": "ACTION_NOT_APPLICABLE",
"action": "compute:CreateVpc"
}
]
}
Retry-After
integer

Seconds to wait before retrying.