Easy ReviewDOP-C02
SDLC Automation26

ECR

Store container images and control tags, vulnerability scanning, retention and replication.

Este conteúdo de estudo ainda não foi traduzido, então aparece em inglês. Ajude a traduzir

Amazon ECR stores container images in repositories. Private repositories use IAM and repository permissions; public repositories allow anyone to pull images.

Repositories and image tags

Amazon ECR stores container images in repositories. A registryA collection of container-image repositories associated with an account. is the collection of repositories for an account. An image tagA name used to select a container image from a repository. is a name used to select an image; an image digestThe SHA-256 content identifier of an image manifest. is the SHA-256 content identifier of its manifestThe image description identified by its digest and used when retrieving a container image., the image description used to retrieve it.

How it works

  1. Use a private repositoryA named storage location for container images and compatible artifacts. for controlled image access. Authenticate the Docker client before private pushes or pulls.
  2. Push an image with a tag and choose the repository’s tag mutability setting. Mutability determines whether a later push can reuse that tag for different content.
  3. Pull by tag for a named reference or by digest for a specific manifest.
Setting Tags that can be overwritten
MUTABLE All tags; default when omitted in CreateRepository
IMMUTABLE No tags

Exam cues

  • If the question says release tags must never move, think IMMUTABLE, because it rejects overwriting an existing tag.
  • If the question says pull a specific image manifest, think image digest, because it identifies the manifest by its SHA-256 digest.

Remember

  • With basic scanning, configure scan-on-push filters for automatic scans. Unmatched repositories require manual scans.

  • CreateRepository defaults to MUTABLE.

  • Reusing an immutable tag returns ImageTagAlreadyExistsException.

Trap: A mutable tag can be overwritten. Use an immutable tag to prevent reuse, or pull by digest to select a specific manifest.

Da documentação da AWS (9)
  • An ECR private registry contains private image repositories; each AWS account has a default private registry.
  • An ECR repository stores Docker images, OCI images and compatible artifacts.
  • A private ECR image can be pulled using a tag or an image digest.
  • An ECR image digest is the SHA-256 digest of the image manifest.
  • ECR CreateRepository defaults imageTagMutability to MUTABLE when omitted, allowing tag overwrites.
  • IMMUTABLE prevents overwriting image tags; a push using an existing immutable tag returns ImageTagAlreadyExistsException.
  • AWS documented tag immutability exclusion patterns in July 2025.
  • Private ECR push and pull operations require Docker client authentication and IAM permissions.
  • With Amazon ECR basic scanning, only repositories matched by scan-on-push filters scan newly pushed images automatically; unmatched repositories require a manual scan.

Image scanning

ECR image scanning finds software vulnerabilities, flaws that may let software be attacked. A CVEAn identifier for a publicly known software vulnerability., or Common Vulnerabilities and Exposures entry, identifies a publicly known vulnerability. A findingA report describing a vulnerability detected in a software package. is a reported vulnerability in an image package.

How it works

  1. Choose basic or enhanced scanning and configure repositoryA named storage location for container images and compatible artifacts. filters, rules selecting which repository names receive each scan frequency.
  2. Basic scanning checks operating system packages. Run it manually or configure scanning on image push. Repositories outside push filters use manual scanning.
  3. Enhanced scanning uses Inspector to check operating system and programming language packages. Continuous mode rescans eligible images when relevant new CVEs appear. Scan-on-push mode scans on a push.
  4. Consume findings through DescribeImageScanFindings. Inspector also sends enhanced-scan completion and finding-change events to EventBridge.
  5. Check coverage duration. Continuous scanning follows configured eligibility periods; its defaults depend on when the account activated ECR scanning.
Scan choice Package coverage Frequency
Basic Operating system Manual or on push
Enhanced, on push Operating system and language packages On push
Enhanced, continuous Operating system and language packages On push and when relevant new CVEs appear while eligible

Exam cues

  • If the question says detect newly disclosed language-package vulnerabilities after image creation, think continuous enhanced scanning, because Inspector updates eligible image findings.
  • If the question says a repository matches both enhanced frequency filters, think continuous scanning, because it takes precedence over scan on push.
  • If the question says findings disappear after changing scan types, think switch back to view the earlier scans, because changing types makes them unavailable rather than permanently deleting them.

Remember

  • Basic scanning allows one scan per image per 24 hours, including its push scan.
  • Enhanced repositories outside all filters are Off. There is no manual enhanced-scan fallback.
  • For activations from October 15, 2026, default push-date and re-scan durations are 7 days, based on last use. Activations from May 16, 2024 through October 14, 2026 use 14 days; earlier activations use 90 days and last pull date.
  • AWS completed the migration from Clair to AWS native basic scanning in February 2026.
  • Enhanced scanning incurs Inspector charges.

Trap: A clean scan describes what was known at that scan. Continuous scanning can find later CVEs, but the image must remain eligible for scanning.

Continuous vulnerability scanning
12ECR repositoryiInspectoriFinding eventsi
  1. Inspector scans the selected repository images while eligible.

  2. Inspector sends finding changes to EventBridge.

Detalhes das caixas (3)
ECR repository

Select the repository for continuous enhanced scanning.

Inspector

Scan operating system and language packages; rescan eligible images for relevant new CVEs.

Finding events

Inspector emits events when findings are created, updated or closed.

Da documentação da AWS (16)
  • ECR basic scanning uses AWS native technology to identify operating system package vulnerabilities.
  • Basic scanning supports manual and scan-on-push modes; repositories outside scan-on-push filters use manual scanning.
  • A basic-scanning image can be scanned once per 24 hours, counting both push and manual scans.
  • Enhanced scanning uses Amazon Inspector for operating system and programming language package vulnerabilities.
  • Enhanced repository scan filters select scan-on-push or continuous scanning.
  • Continuous Inspector scanning rescans eligible images when relevant new CVEs enter its database.
  • Inspector emits EventBridge events when an initial enhanced scan completes or a finding is created, updated or closed.
  • Enhanced repositories that match no filter have scanning Off; manual enhanced scans are unsupported.
  • Continuous scanning takes precedence when both continuous and scan-on-push enhanced filters match a repository.
  • Switching basic and enhanced scanning makes earlier scans unavailable, but switching back makes the earlier scans available again.
  • Current basic scanning returns findings through DescribeImageScanFindings rather than DescribeImages scan-summary fields.
  • For Inspector ECR scanning activated on or after October 15, 2026, image push-date and re-scan duration defaults are both 7 days, with re-scans based on last-in-use date.
  • Inspector scanning activated from May 16, 2024 through October 14, 2026 defaults to 14-day push-date and re-scan durations; earlier activations default to 90 days and use last pull date.
  • AWS completed migration from Clair to AWS native ECR basic scanning in February 2026.
  • A CVE is a named entry describing a publicly known software vulnerability.
  • Enhanced scanning incurs Amazon Inspector scanning charges.

Lifecycle policies

An ECR lifecycle policyRepository rules that expire or archive images when retention criteria are met. removes images that meet retention rules, so a repositoryA named storage location for container images and compatible artifacts. does not keep every build indefinitely. Expiration means deleting an image. A preview shows the affected images before the policy takes effect.

How it works

  1. Select tagged images, untagged images, or any images with tagStatus. For tagged images, choose either a wildcard pattern list or a prefix list. A wildcard matches variable text; a prefix is the beginning of a tagA name used to select a container image from a repository..
  2. Choose count-based or age-based retention. imageCountMoreThan keeps the configured count. sinceImagePushed uses countNumber days of age and countUnit: days. Use expire for deletion.
  3. Preview the rules. ECR evaluates every rule before applying priority, with smaller rulePriority values first. Each image receives at most one action.
  4. Put an any rule last. An image matching a higher-priority rule’s tag requirements is protected from lower-priority expiration even when multiple rules select it.
  5. Apply the policy after reviewing the preview. Expiration should occur within 24 hours after eligibility. A manifest listA list referencing images commonly built for different operating systems or processor architectures., a reference to multiple platform-specific images, must be deleted or archived before its referenced images can expire.

Exam cues

  • If the question says retain only the required number of builds, think imageCountMoreThan, because it caps retained image count.
  • If the question says delete images older than a retention period, think sinceImagePushed, because it uses image age.
  • If the question says overlapping rules may delete release images, think preview and priority, because higher-priority tag matches constrain lower-priority expiration.

Remember

  • Smaller priority number means higher priority; values must be unique.
  • tagStatus: any must have the largest priority number.
  • Expiration should occur within 24 hours, rather than immediately.
  • A rule uses tagPatternList or tagPrefixList, never both.

Trap: One image can match several selections, but ECR takes at most one lifecycle action on it. Do not treat each rule as an independent deletion pass.

Da documentação da AWS (14)
  • ECR lifecycle rules automate image expiration in a private repository.
  • Lifecycle policy preview shows affected images before the policy is applied.
  • ECR evaluates all lifecycle rules together, then applies them by priority.
  • Lower rulePriority numbers have higher priority; priority values must be unique.
  • An image is expired or archived by zero or one lifecycle rules.
  • An image matching the tagging requirements of a higher-priority rule cannot be expired by a lower-priority rule.
  • Images should expire within 24 hours after meeting lifecycle expiration criteria.
  • tagStatus accepts tagged, untagged or any; tagged selects a tagPatternList or tagPrefixList, and untagged omits both lists.
  • A tagStatus any rule must have the highest rulePriority value and run last.
  • imageCountMoreThan retains the configured image count; sinceImagePushed uses image age with countNumber and countUnit days.
  • A lifecycle rule can specify tagPatternList or tagPrefixList, but not both; all specified tag filters must match.
  • An image referenced by a manifest list cannot expire until the manifest list is deleted or archived.
  • A manifest list references several images, commonly for different operating systems or processor architectures.
  • The expire lifecycle action deletes selected images.

Cross-account access

Cross-account ECR access lets a workload pull an image owned by another account. A principalThe role or user making an AWS request. is the role or user making the request. The caller’s identity policyA policy attached to an identity that grants or denies its actions. grants actions to that principal; the repositoryA named storage location for container images and compatible artifacts.’s resource policyA policy attached to a resource that controls access to it. grants access to the image owner account’s repository.

How it works

  1. Allow image-pull operations on the target repository in both the caller identity policy and the target repository policy. Pull actions include ecr:BatchGetImage and ecr:GetDownloadUrlForLayer; the ECS execution managed policy also includes ecr:BatchCheckLayerAvailability.
  2. Separately allow ecr:GetAuthorizationToken through IAM. The token has the caller’s permissions and is valid for 12 hours.
  3. Authenticate Docker to each registryA collection of container-image repositories associated with an account. using get-login-password and username AWS. Authentication identifies the caller; repository authorization determines what it may do.
  4. For Fargate image pulls, grant permissions to the task execution roleThe IAM role that grants the ECS or Fargate agent permission to pull images and perform other task setup actions. used by the agent. The task role supplies permissions to application code inside the containers.

Exam cues

  • If the question says a repository policy permits access but login fails, think IAM token permission, because registry authentication needs ecr:GetAuthorizationToken.
  • If the question says a Fargate task cannot pull from another account, think execution role plus repository policy, because the agent performs the pull before application code runs.
  • If the question says an allow exists but access is still denied, think applicable explicit denies, because an allow cannot override them.

Remember

  • Cross-account pull access needs permission on both sides.
  • Private authorization tokens last 12 hours and retain the caller’s permission scope.
  • Docker login uses username AWS.

Trap: Giving the application task role ECR permissions does not fix a Fargate agent pull failure. Check the task execution role.

Cross-account pull authorization
Caller accountImage owner accountpull1Execution roleIAM token + pull accessiECR repositoryPolicy permits calleri
  1. After registry authentication, ECR permits the cross-account pull only if both account policy evaluations allow it.

Detalhes das caixas (2)
Execution role

For Fargate, the task execution role authenticates and pulls the image through the agent.

ECR repository

The owner repository policy permits the caller role to perform image-pull actions.

Da documentação da AWS (10)
  • An ECR repository policy is a resource policy controlling who may perform actions on that repository.
  • Cross-account access requires the requester identity policy and the target resource policy to allow access.
  • Authenticating to a private ECR registry requires ecr:GetAuthorizationToken through an IAM policy.
  • An ECR authorization token has the retrieving principal permissions and is valid for 12 hours.
  • Docker login uses username AWS and a password obtained with ecr get-login-password; authenticate separately to each registry.
  • ECR pull access uses ecr:BatchGetImage and ecr:GetDownloadUrlForLayer.
  • The AmazonECSTaskExecutionRolePolicy includes ecr:GetAuthorizationToken, ecr:BatchCheckLayerAvailability, ecr:GetDownloadUrlForLayer and ecr:BatchGetImage.
  • For Fargate tasks pulling private ECR images, including cross-account images, the task execution role supplies the agent permissions.
  • The ECS task role supplies application code permissions inside containers; execution-role credentials are used by the agent.
  • An explicit deny in an applicable ECR IAM or repository policy overrides an allow.

Image replication

ECR replication copies container images between accounts or Regions using private registryA collection of container-image repositories associated with an account. rules. The source selects where images go; a destination account grants permission to receive them. A registry policy controls registry-level access, while a repositoryA named storage location for container images and compatible artifacts. policy controls an individual repository.

How it works

  1. Configure source registry rules with destinations and optional repository-name prefixes. No special source repository or registry replication policy is required, but the configuring principalThe role or user making an AWS request. needs ECR permissions.
  2. For another account, grant the source ecr:ReplicateImage in the destination registry policy. Also grant ecr:CreateRepository, or precreate destination repositories with matching names.
  3. ECR copies newly pushed or restored content. Repository names remain unchanged. For older images, start replication backfillAn operation that copies preexisting images matching current replication rules to a selected destination., which copies existing images matching the current rules to the selected destination.
  4. Configure destination repository settings and retention. Policies do not copy automatically; repository creation templates can supply settings when ECR creates destination repositories.
  5. Configure every required destination at the source. A replicated image does not trigger another replication hop. Deletes propagate only when the rule enables replication of deletes (since November 16, 2026); archive actions never do.

Exam cues

  • If the question says cross-account replication is denied, think destination registry policy, because that account must authorize incoming replication.
  • If the question says image copies fail only when a destination repository is missing, think ecr:CreateRepository or precreation, because replication needs a repository with the same name.
  • If the question says old images are absent after enabling replication, think backfill, because replication does not automatically copy preexisting images.

Remember

  • Each push or restore produces one replication hop.
  • Backfill targets one destination per backfill; AWS documented it in October 2026.
  • Policies and archive actions do not propagate; deletes propagate only with deleteReplication on the rule (November 2026).

Trap: A tagA name used to select a container image from a repository. collision at an immutable destination does not necessarily stop the image copy. The image can arrive without the conflicting tag and be untagged.

Destination permissions for cross-account replication
Source account / RegionTarget account / Regionreplicate1Source registryReplication rulesiTarget registryRegistry policyi
  1. ECR copies matching images into the destination with its registry permission; destination policies and retention are configured separately.

Detalhes das caixas (2)
Source registry

Rules select direct destinations and optional repository-name prefixes.

Target registry

Allow ReplicateImage and allow CreateRepository or precreate repositories with matching names.

Da documentação da AWS (15)
  • ECR private registry replication rules select destination Regions and accounts.
  • Cross-account replication requires a destination registry policy allowing the source ecr:ReplicateImage.
  • ecr:CreateRepository permits automatic destination repository creation; without it, matching destination repositories must already exist.
  • The source configures replication rules and its configuring principal needs ECR permissions; no special source repository or registry replication policy is required.
  • Replication applies to content pushed or restored after configuration; preexisting images are not automatically copied.
  • Replication backfill copies existing images that match current replication rules to one selected destination per backfill.
  • AWS documented replication backfill in October 2026.
  • ECR replication keeps the repository name unchanged.
  • An ECR replication action occurs only once per image push or restore; replicated images do not trigger another replication hop.
  • By default, ECR registry replication does not replicate deletions, and it never replicates archive actions.
  • Repository and lifecycle policies are not replicated; repository creation templates can configure settings for newly created destination repositories.
  • If a destination immutable tag already exists, the replicated image arrives without that duplicate tag and may be untagged.
  • Replication rules can select repositories using a repository-name prefix.
  • Pull through cache rules sync the contents of an upstream registry, such as Amazon ECR Public or Quay, with an Amazon ECR private registry.
  • Since November 16, 2026, an ECR replication rule with deleteReplication enabled replicates image deletions, tag removals and lifecycle expirations to its destinations; a cross-account destination must also grant ecr:ReplicateImageDelete.

Tag exclusions and image delivery

Amazon ECR supports tagA name used to select a container image from a repository. exclusions, public image access and image push triggers for delivery pipelines. These settings let a team choose which tags can move, who can publish an image and how an image push starts a pipeline.

How it works

  1. Choose an exclusion setting. With IMMUTABLE_WITH_EXCLUSION, matching tags can be updated. With MUTABLE_WITH_EXCLUSION, matching tags are protected from updates.
  2. Anyone can pull from a public repositoryA named storage location for container images and compatible artifacts.. To push, authenticate the Docker client and have the required permissions.
  3. Use an ECR source action to trigger CodePipeline on an image push. Add another source action when the pipeline also needs deployment files from source control.

Exam cues

  • If the question says release tags must stay protected while latest can move, think IMMUTABLE_WITH_EXCLUSION with a filter matching latest, because excluded tags can be updated.
  • If the question says an image push should start a pipeline that also needs deployment files, think an ECR source action plus another source action, because each can supply its respective source.

Remember

  • IMMUTABLE_WITH_EXCLUSION allows updates to matching excluded tags.
  • MUTABLE_WITH_EXCLUSION protects matching excluded tags.
  • Public image pushes require Docker authentication and permission.

Trap: Anyone can pull a public image, but public access does not allow anonymous pushes. A push still requires an authenticated Docker client and permission.

Da documentação da AWS (3)
  • IMMUTABLE_WITH_EXCLUSION permits updates to matching excluded tags, while MUTABLE_WITH_EXCLUSION protects matching excluded tags.
  • Anyone can pull images from an ECR public repository; pushing requires Docker client authentication and appropriate permissions.
  • An ECR source action can trigger CodePipeline on image pushes and can be combined with another source action for other deployment artifacts.

Flashcards

toque para virar
Resposta

·

Todos os 26 flashcards em lista

A team must prevent release tags in an ECR repository from being overwritten. Which setting should it use?

Set image tag mutability to IMMUTABLE. Pushes that reuse existing tags fail with ImageTagAlreadyExistsException. Pull by digest when an exact image manifest is required.

A team pushes images to an Amazon ECR repository using basic scanning, but the repository matches no scan-on-push filter. Are the images scanned automatically?

No. The repository uses manual scanning until it matches a scan-on-push filter.

How do ECR basic and enhanced scanning differ in package coverage?

Basic scans operating system packages using AWS native technology. Enhanced uses Inspector and covers both operating system and programming language packages.

Which scan frequencies does ECR support for basic versus enhanced scanning?

Basic: manual or scan on push. Enhanced: scan on push or continuous. Enhanced scanning does not support manual scans.

An ECR image had no reported vulnerabilities when pushed. Will that result remain valid as new vulnerabilities are discovered?

Not necessarily. Use continuous enhanced scanning to rescan eligible images for relevant newly published CVEs, and monitor finding events. Check that the image remains within scanning eligibility.

An ECR repository uses enhanced scanning but matches neither scan filter. Will it receive manual scans as a fallback?

No. Its scan frequency is Off. Manual scanning is not supported for enhanced scanning.

A team switches an ECR registry from basic to enhanced scanning and can no longer see its basic results. Were those results permanently deleted by the switch?

No. Earlier scans are unavailable under the other scan type, but become available again if the team switches back.

A security pipeline reads ECR DescribeImages but receives no current basic scan summary. Which API should it call?

DescribeImageScanFindings. Current basic scanning no longer uses the DescribeImages scan-summary fields to return scan results.

Old build images are filling an ECR repository. Which managed feature should the team configure?

An ECR lifecycle policy with image count or age rules and the expire action. Preview the rules before applying them. Expiration should occur within 24 hours after eligibility.

How does ECR resolve lifecycle policy rules with overlapping selections?

Evaluate all rules together, then apply priorities with lower numbers first. An image receives at most one action. A higher-priority tag match prevents lower-priority rules from expiring it.

An ECR lifecycle rule with tagStatus any has higher priority than specific release-tag rules. How should it be corrected?

Give the any rule the largest rulePriority number so it runs last. Rule priority values must be unique.

An ECR image is old enough for expiration but is referenced by a multi-architecture manifest list. Why might it remain?

The manifest list must be deleted or archived first. Referenced images cannot expire while that dependency remains.

A role in another account must pull an image from a private ECR repository. What permissions are needed?

Allow repository pull actions in the target repository policy and caller identity policy. The caller also needs ecr:GetAuthorizationToken through IAM to authenticate. For Fargate, grant the execution role used by the agent.

An ECR repository policy permits a remote role to pull, but the role cannot authenticate. Which separate permission should the team check?

ecr:GetAuthorizationToken in the role identity policy. A repository policy does not supply this authentication permission.

A Fargate task cannot pull a cross-account ECR image even though its application task role has ECR permissions. Which role should be checked?

The task execution role. It gives the Fargate agent image-pull permissions; the task role is for application code. Also check the repository policy.

How long is an ECR private registry authorization token valid, and does it grant permissions beyond the caller?

12 hours. Its permission scope matches the principal that obtained it.

How should a team configure ECR cross-account replication, including images that predate the rules?

Set source registry replication rules. Allow ecr:ReplicateImage in the destination registry policy; allow ecr:CreateRepository or precreate matching repositories. Use backfill for preexisting images. Policies are not automatically replicated.

A team grants ecr:ReplicateImage but not ecr:CreateRepository in an ECR destination registry. Can replication still work?

Yes, if destination repositories with the same names already exist. CreateRepository is required for automatic creation, not for copying into existing repositories.

ECR replicates images from Region A to B and has another rule from B to C. Will a push in A reach C through B?

No. Replication is one hop per push or restore. Configure C as a direct destination for A when it needs that image.

An ECR source lifecycle policy deletes an image. Will registry replication delete the destination copy?

Not by default. Since November 16, 2026, a rule with deleteReplication enabled replicates the deletion, including lifecycle expirations; otherwise configure destination retention separately, because lifecycle policies are not replicated.

An ECR replication rule is enabled after a repository already contains images. How can the existing images be copied without repushing them?

Start replication backfill for the configured destination. It includes existing images that match current replication rules.

A company wants its clusters to pull public base images through its own Amazon ECR private registry. Which ECR feature fits?

A pull through cache rule, which syncs the upstream registry into the private registry.

Images expired by an ECR lifecycle policy in the source Region must also disappear from the cross-account replica registry. What configuration does this need?

Enable deleteReplication on the replication rule (available since November 16, 2026), and grant ecr:ReplicateImageDelete in the destination registry policy.

A team wants ECR release tags protected but wants its latest tag to remain movable. What can it configure?

Use IMMUTABLE_WITH_EXCLUSION and an exclusion filter matching latest. Matching excluded tags can be updated.

Can anonymous users push images to an ECR public repository because anonymous pulls are allowed?

No. Public pulls are available to anyone, but Docker pushes require authentication and permission.

A release pipeline must start when an image is pushed to ECR and also needs deployment files from source control. How should its source stage be configured?

Use an ECR source action alongside another source action for the deployment files. The ECR source action triggers on an image push.

Você concluiu todos os tópicos da DOP-C02!

Seu badge ficou dourado. Próximo passo: agendar a prova na AWS. Depois de passar, adicione-se ao Quem passou.

Compartilhar

Conte que você concluiu esta certificação

Concluí todos os tópicos da AWS Certified DevOps Engineer - Professional (DOP-C02) no Easy Review. Venha estudar também!