ecr.repositories.create

Create a repository

POST /ecr/api/repositoriesIAM ecr:CreateRepositoryChanges state

Public repositories serve anonymous pulls for their own images only; private is the default and is what a push creates.

Request syntax

POST /ecr/api/repositories
{
  "name": "string",
  "description": "string",
  "visibility": "enum",
  "tagMutability": "enum",
  "tagMutabilityExclusions": "array of string",
  "storageQuotaBytes": "number",
  "tags": "map of string"
}

Request body

  • nameRequired

    string

    Repository name, unique in the organization: 2–255 characters of lowercase path components joined by / (team/api), each letters and digits joined by . _ __ or -. blobs, manifests, tags, referrers and uploads may not be a component. A taken name is refused with 409

    Constraints: 2-255 chars, /^[a-z0-9]+(?:(?:\.|_|__|-+)[a-z0-9]+)*(?:\/[a-z0-9]+(?:(?:\.|_|__|-+)[a-z0-9]+)*)*$/

  • descriptionOptional

    string

    Free text shown with the repository, up to 256 characters; none when omitted

    Constraints: max 256 chars

  • visibilityOptional

    enum

    private: every pull needs a credential with ecr:PullImage. public: anyone can pull this repository’s images without credentials (read-only, and only the layers its own images reference). private when omitted

    One of: private, public

  • tagMutabilityOptional

    enum

    immutable: a push that would move an existing tag to a different image is refused (re-pushing the same image is fine; deleting the tag is still allowed). mutable when omitted

    One of: mutable, immutable

  • tagMutabilityExclusionsOptional

    array of string

    Up to 10 tag patterns (letters, digits, _ . - and * as a glob, 1–128 characters) that stay mutable in an immutable repository, e.g. ["latest", "main-*"]; none when omitted

    Constraints: 1-128 chars, /^[A-Za-z0-9_.*-]+$/

  • storageQuotaBytesOptional

    number

    Cap in bytes on every layer this repository holds, shared ones included: 1 MiB (1048576) to 1 PiB. null: no repository cap (the organization quota still applies). A push over it is refused; lowering it deletes nothing. No cap when omitted

    Constraints: integer, 1048576-1125899906842624

    May be null.

  • tagsOptional

    map of string

    Tags for the new resource, e.g. {"env": "prod", "project": "shop"}. Keys your organization marks required must be present, or the create is refused with the missing keys (GET /tags/api/keys lists them).

    Constraints: key=value

Response

201 with the new repository: id, name, description, visibility, tagMutability, tagMutabilityExclusions, lifecycleMode, lifecyclePolicy, storageQuotaBytes, upstreamRuleId and upstreamName (set on a pull-through cache repository), createdForAppId, createdAt, updatedAt. 409 when the name is taken, or with code QuotaExceeded when the organization is at its repository quota; 400 when a tag key your organization requires is missing.

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 ecr:CreateRepository 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 ecr repositories create --name example

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