Core concepts
- Domains: top-level containers, typically used per organization (or per business unit). Domains deduplicate package storage across repositories — the same package version stored in multiple repositories is only kept once.
- Repositories: live inside domains and support one or more package formats (Maven, npm, PyPI, RubyGems, etc.). Repositories can be:
- Primary — host your own packages.
- Pass-through (upstream-enabled) — act as caches that fetch packages from upstream public registries.
- Upstream stores: configured public or private registries that CodeArtifact queries when a requested package is not present locally; the fetched package is then cached.



Repository details and console features
- Metadata: each repository displays metadata (ARN, tags, upstream stores, domain).
- Connection instructions: the console provides ready-made, tool-specific instructions for npm, Maven, pip, and more.
- Resource policies: apply resource-based repository policies to grant other AWS accounts access to a repository.


Cross-account access and encryption
- Cross-account access: to grant other AWS accounts access to resources in your CodeArtifact domain, you must use a customer-managed CMK (Customer Master Key). AWS-managed keys cannot be used for cross-account CodeArtifact access.
- Typical strings you will see when configuring endpoints and KMS ARNs:
- Domain policies are resource-based policies where the
Principalcan specify an account to grant permissions such asGetDomainPermissionsPolicy,ListRepositoriesInDomain,GetAuthorizationToken, andDescribeDomain.
Command-line usage and connection tips
CodeArtifact provides helper commands to configure package clients. Useaws codeartifact login to automatically configure npm or pip to use your repository endpoint.
Common pitfall: “Domain not found” errors typically happen when the CLI command omits the --region flag or the --domain-owner value for a cross-account domain. Always specify the correct --region and --domain-owner when targeting domains outside your default region or account.
If you see “Domain not found”, verify you are targeting the correct region and domain owner account. A missing
--region is a common cause.Maven connection instructions
The CodeArtifact console also provides exact steps to export an authorization token and add it to Maven’ssettings.xml.
Windows (CMD) example to set a token in an environment variable:
settings.xml server entry (use the CODEARTIFACT_AUTH_TOKEN as the password):
profiles section:
Quick reference
Note: In table examples, wrap any placeholders or angle-bracket values in backticks (e.g.,
--domain <domain>) when you copy and adapt commands.

Final notes
- Domains contain repositories; repositories can be primary or pass-through (upstream-enabled).
- Upstream-enabled repositories reduce external requests by caching packages fetched from public registries.
- Use customer-managed CMKs for cross-account access and ensure CLI commands include
--regionwhen working outside your default region.