iam.access-keys.migrate

Replace a legacy limited key: a dedicated service account with exactly what the key could do, and a new plain key

POST /iam/api/access-keys/{id}/migrateIAM iam:CreateAccessKeyChanges state

One transaction; needs iam:CreateUser, iam:CreatePolicy, iam:AttachUserPolicy and iam:CreateAccessKey, and the caller must be able to do every action handed out. The old key keeps working, limit and all, and is switched off (not deleted) once it has gone unused for 7 days since the migration. 409 for a key that can do nothing, a platform-made key, or one already migrated.

Request syntax

POST /iam/api/access-keys/{id}/migrate

Path parameters

  • idRequired

    string

    Constraints: uuid

Response

201; data is { account: { id, username }, policy: { id, name, document }, key: { id, accessKeyId, secretKey, expiresAt }, replaces: { id, accessKeyId, retiresAfterUnusedDays } }. The new secret is in this response only.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow iam:CreateAccessKey on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud iam access-keys migrate id

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_iam_access-keys_migrate.