- Domain: A top-level grouping for an organization (frequently one domain per company). Domains deduplicate package content across repositories within the domain so identical packages stored in multiple repositories are retained only once.
- Repository: Lives inside a domain and supports one or more package formats. Repositories can be primary (the authoritative store) or configured with upstreams to pass-through and cache packages from public or other CodeArtifact repositories.




- For cross-account access to CodeArtifact, you usually need a customer-managed KMS key (CMK) for repository/domain encryption. AWS-managed keys generally cannot be used for cross-account CodeArtifact access.
- Example formats (for clarity only):
- domain endpoint:
devops-demo-domain-598274344262.d.codeartifact.us-east-1.amazonaws.com - KMS alias ARN:
arn:aws:kms:us-east-1:598274344262:alias/devops-020-220-codeartifact
- domain endpoint:
When granting cross-account access, ensure the CMK key policy and the CodeArtifact domain/repository policies both allow the target account to access the encrypted artifacts. If the KMS policy blocks access, cross-account operations will fail even if the CodeArtifact policy appears correct.
If you see “Domain not found,” confirm your
--region and --domain-owner values. The AWS CLI defaults to the configured region; if the domain exists in another region you must add --region <region>.settings.xml with server credentials and repository URLs.
Windows cmd example to set an environment variable with the token:
<server> entry in settings.xml that references the token:

Key takeaways
- Domains contain repositories. Repositories can be primary (store your published packages) or pass-through (cache and proxy upstream public repositories).
- Repositories act as caches to bring packages closer to your build and deployment environments, improving reliability and speed.
- Use domain and repository resource policies to control access. For cross-account encryption scenarios, prefer a customer-managed KMS key (CMK) and ensure KMS key policies allow the target accounts access.
- Use the AWS CLI helpers to configure developer tools; always verify
--regionand--domain-ownerto avoid authentication errors.
- AWS CodeArtifact documentation: https://docs.aws.amazon.com/codeartifact/latest/ug/what-is-codeartifact.html
- Maven Central: https://search.maven.org
- CommonsWare: https://commonsware.com