s3.buckets.create-access-key

An access key for this bucket: a service account, a policy limited to the bucket on that account, and a plain key

POST /s3/api/buckets/{name}/access-keysIAM iam:CreateAccessKeyChanges state

Permissions live on the account: the policy is attached to the service account, the key carries no limit. In one transaction; needs iam:CreateUser (for a new account), iam:CreatePolicy, iam:AttachUserPolicy, iam:CreateAccessKey, and the caller must be able to do every action the policy hands out on this bucket (403 otherwise, and nothing is made).

Request syntax

POST /s3/api/buckets/{name}/access-keys
{
  "serviceAccountId": "string",
  "serviceAccountName": "string",
  "access": "enum",
  "prefix": "string",
  "description": "string",
  "expiresInDays": "number"
}

Path parameters

  • nameRequired

    string

    Constraints: 3-63 chars, /^[a-z0-9][a-z0-9-]*[a-z0-9]$/

Request body

  • serviceAccountIdOptional

    string

    An existing service account to give the key to; omitted: a new one is made

    Constraints: uuid

  • serviceAccountNameOptional

    string

    The new service account’s name; default <bucket>-access

    Constraints: 1-64 chars, /^[a-z0-9_-]+$/

  • accessOptional

    enum

    read: list and download; readwrite (default): also upload and delete

    One of: read, readwrite

  • prefixOptional

    string

    Only objects under this key prefix, e.g. uploads/

    Constraints: max 512 chars

  • descriptionOptional

    string

    What uses the key

    Constraints: max 256 chars

  • expiresInDaysOptional

    number

    Days until the key expires; default the organization’s default

    Constraints: integer, 1-3650

Response

201; data is { id, accessKeyId, secretKey, expiresAt, account: { id, username, created }, policy: { id, name, created, document } | null, reach }. The secret is in this response only. policy is null when the account already had this access.

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 s3 buckets create-access-key name

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