Source, packages, images, and build outputs
An artifactAn artifact is a file or collection of files consumed or produced by a pipeline action. is a file or collection of files consumed or produced during a release pipeline. Source repositories, package repositories, image registries and object storage serve different release assets. Choose storage by how the next tool will consume the asset.
How it works
- Keep Git source and review history in a source repositoryA repository stores a collection of source files, packages or images for tools to retrieve and manage. such as CodeCommit. Git tracks changes using branches; a pull requestA pull request lets collaborators review and comment on source changes before merging them into a branch. asks reviewers to approve changes before merging.
- Resolve or publish reusable packages through CodeArtifact using the relevant package managerA package manager publishes and retrieves versioned software dependencies from a package repository., such as npm, Maven, pip or NuGet. Authenticate with a CodeArtifact authorization token.
- Run build commands through CodeBuild. Its buildspecA buildspec contains the commands and settings CodeBuild uses to run a build., the file containing build commands and settings, selects output files through
artifacts/filesandartifacts/base-directory. - Store container images in ECR. A registryA registry stores container images that container tools can push and pull. is a service from which container tools push and pull images. Tag immutabilityTag immutability prevents an existing protected image tag from being overwritten. can prevent a release tag from being overwritten; check any configured exclusions.
- Pass pipeline files through S3 artifact buckets. CodePipeline needs an artifact bucket in each action Region. S3 source location buckets and pipeline artifact buckets serve different purposes.
- Apply retention to the correct asset: preview ECR image lifecycle rules; use S3 versioning for recovery and lifecycle rules for transition or expiration. Explicitly manage noncurrent versionsA noncurrent version is an older S3 object version retained after a newer version becomes current., the older versions retained after an object changes.
| Asset or need | Service | Relevant control |
|---|---|---|
| Source branches and code review | CodeCommit | IAM access; encryption at rest and in transit |
| Reusable versioned packages | CodeArtifact | Authorization tokens; upstreamAn upstream repository makes its CodeArtifact packages available through a downstream repository endpoint. repositories and external connectionsAn external connection lets CodeArtifact retrieve packages from a public repository. |
| Container images | ECR | Repository access, tag immutability, lifecycle preview |
| Pipeline files and build outputs | S3 | KMS artifact encryption, versioning, lifecycle rules |
A CodeArtifact domainA CodeArtifact domain contains repositories that can share packages. contains repositories. An upstream is another CodeArtifact repository in the same domain. An external connection reaches a public package repository and caches packages on demand. These options let one repository endpoint serve shared internal and public dependencies.
Exam cues
- If the question says cache public dependencies alongside internal libraries, think CodeArtifact, because it integrates package managers with upstreams and external connections.
- If the question says prevent a container release tag from changing, think ECR tag immutability, because it prevents overwrites for protected tags.
- If the question says recover an overwritten build output, think S3 Versioning, because it preserves earlier object versions.
- If the question says share encrypted CodePipeline artifacts across accounts, think a customer managed symmetric KMS key, because the cross-account artifact configuration requires it.
Remember
- CodeArtifact requires authentication; repositories cannot be public.
- CodePipeline needs artifact storage in each action Region.
- CodePipeline supports symmetric KMS keys for artifact encryption.
- ECR expiration occurs within 24 hours after an image meets the policy criteria.
- S3 Versioning is disabled by default. Use noncurrent-version expiration to remove retained old versions.
Trap: S3 Versioning preserves recovery copies. It does not replace lifecycle rules for cleaning up old versions.
Source input
Publish selected files
From the AWS docs (18)
- CodePipeline artifacts are files consumed or produced by pipeline actions, including source files and built application files.
- CodeCommit hosts private Git repositories with branches and pull requests for reviewing changes before merging.
- CodeCommit encrypts repositories at rest and in transit and integrates access with IAM.
- CodeArtifact stores software packages for package managers including npm, Maven, pip and NuGet; a repository can contain multiple supported package types.
- Each CodeArtifact repository belongs to one domain, and upstream repositories share package access within that domain.
- CodeArtifact external connections fetch and store requested packages from public repositories on demand.
- CodeArtifact upstream repositories let clients access packages from other CodeArtifact repositories through one endpoint; an external connection points to a public repository.
- CodeArtifact requires an authorization token based on AWS credentials to publish or consume package versions; its repositories cannot be public.
- ECR stores Docker and OCI container images and OCI-compatible artifacts; IAM and resource-based policies control access to private repositories.
- ECR tag immutability prevents overwriting an existing image tag, with separately configurable exclusion filters.
- ECR lifecycle policy previews show which images match cleanup rules before applying them; eligible images expire within 24 hours.
- A CodeBuild buildspec contains build commands and settings; its artifacts/files and artifacts/base-directory settings select build output files.
- CodePipeline transfers input and output artifacts through an S3 artifact bucket; it is distinct from an S3 source location bucket.
- CodePipeline requires an artifact bucket in its account and Region, plus an artifact bucket for each additional action Region.
- CodePipeline S3 artifact encryption supports symmetric KMS keys; cross-account pipelines require a customer managed key.
- S3 Versioning preserves object versions for recovery from overwrites and deletions; versioning is disabled by default.
- S3 Lifecycle can transition objects between storage classes or expire them.
- Versioned S3 buckets need noncurrent-version expiration to permanently remove older object versions through lifecycle rules.
Flashcards
Nothing to review here right now. Pick other topics or another filter.
·
All 9 cards as a list
Which release assets belong in CodeCommit, CodeArtifact, ECR and S3?
CodeCommit: Git source. CodeArtifact: versioned software packages. ECR: container images. S3: pipeline artifacts and build output files.
A build team needs one package-manager endpoint for private libraries and cached public dependencies. Which AWS repository service fits?
CodeArtifact. Use upstream CodeArtifact repositories for internal sharing and an external connection for on-demand public packages.
A pipeline action in another Region needs input artifacts. Does its CodePipeline pipeline need another artifact bucket?
Yes. Provide an artifact bucket for each additional Region where actions execute.
A team enables S3 Versioning on its build artifact bucket. Will a lifecycle rule for current objects permanently remove all older versions?
No. Configure noncurrent-version expiration for older versions. Versioning preserves versions for recovery.
An ECR repository must prevent a published release tag from pointing to a replacement image. Which setting fits?
Tag immutability. Ensure exclusion filters do not permit updates to the release tags that must be protected.
How should a team review an ECR image cleanup policy before enabling it?
Run a lifecycle policy preview and inspect affected images. Once enabled, images that meet expiration criteria expire within 24 hours.
A CodePipeline pipeline shares encrypted S3 artifacts across AWS accounts. What type of KMS key should it use?
A customer managed symmetric KMS key. CodePipeline artifact encryption does not support asymmetric KMS keys.
Which CodeBuild buildspec settings select files to publish as build artifacts?
artifacts/files selects output paths, and artifacts/base-directory sets the base location for selecting them.
Can AWS CodeArtifact publish a repository for anonymous public package downloads?
No. Publishing and consuming package versions require authentication with an authorization token based on AWS credentials.