Skip to content

CodeArtifact: Add documentation #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"awslocal",
"codeartifact",
"quickstart"
]
}
14 changes: 14 additions & 0 deletions content/en/references/coverage/coverage_codeartifact/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "CodeArtifact"
linkTitle: "codeartifact"
description: >
Implementation details for API codeartifact
hide_readingtime: true
draft: true
---

## Coverage Overview
{{< localstack_coverage_table service="codeartifact" >}}

## Testing Details
{{< localstack_coverage_details service="codeartifact" >}}
269 changes: 269 additions & 0 deletions content/en/user-guide/aws/codeartifact/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
---
title: CodeArtifact
linkTitle: CodeArtifact
description: >
Get started with CodeArtifact on LocalStack
tags: ["Pro image"]
---
{{< callout >}}
CodeArtifact is under active development and available in LocalStack as a preview feature.
{{< /callout >}}
## Introduction

CodeArtifact is a fully managed artifact repository service that makes it easy to securely store, publish, and share software packages used in your development process.

On AWS, CodeArtifact supports common package formats such as Maven, npm, Python (pip), and NuGet.
You can configure it to work with public repositories or use it to store your private packages.

LocalStack provides mocking support for several CodeArtifact API operations.
You can find supported operations on the [API coverage page]({{< ref "coverage_codeartifact" >}}).

## Getting Started

This guide will help you create a domain, repository, and manage package publishing workflows using the `awslocal` CLI.

Basic knowledge of the AWS CLI and the [`awslocal`](https://github.com/localstack/awscli-local) wrapper is expected.

Start LocalStack using your preferred method.

### Domains

Domains are the top-level containers for repositories in CodeArtifact.

Create a domain with the [CreateDomain](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_CreateDomain.html) operation:

{{< command >}}
$ awslocal codeartifact create-domain --domain demo-domain
{{< /command >}}

The following output is displayed:

```json
{
"domain": {
"name": "demo-domain",
"owner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:domain/demo-domain",
"status": "Active",
"createdTime": "2025-05-20T11:30:52.073202+02:00",
"repositoryCount": 0,
"assetSizeBytes": 0
}
}
```

You can use [DescribeDomain](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DescribeDomain.html), [UpdateDomain](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_UpdateDomain.html), and [DeleteDomain](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DeleteDomain.html) for domain management.

{{< command >}}
$ awslocal codeartifact describe-domain --domain demo-domain
{{< /command >}}

The following output is displayed:

```json
{
"domain": {
"name": "demo-domain",
"owner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:domain/demo-domain",
"status": "Active",
"createdTime": "2025-05-20T11:30:52.073202+02:00",
"repositoryCount": 0,
"assetSizeBytes": 0
}
}
```

You can list all domains using [ListDomains](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListDomains.html).

{{< command >}}
$ awslocal codeartifact list-domains
{{< /command >}}

The following output is displayed:

```json
{
"domains": [
{
"name": "demo-domain",
"owner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:domain/demo-domain",
"status": "Active",
"createdTime": "2025-05-20T11:30:52.073202+02:00"
}
]
}
```

### Repositories

Repositories store packages and are associated with a domain.

Create a repository using [CreateRepository](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_CreateRepository.html):

{{< command >}}
$ awslocal codeartifact create-repository --domain demo-domain \
--repository demo-repo
{{< /command >}}

The following output is displayed:

```json
{
"repository": {
"name": "demo-repo",
"administratorAccount": "000000000000",
"domainName": "demo-domain",
"domainOwner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:repository/demo-domain/demo-repo",
"upstreams": [],
"externalConnections": [],
"createdTime": "2025-05-20T11:34:27.712367+02:00"
}
}
```

You can use [DescribeRepository](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DescribeRepository.html), [UpdateRepository](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_UpdateRepository.html), and [DeleteRepository](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DeleteRepository.html) to manage repositories.

{{< command >}}
$ awslocal codeartifact describe-repository --domain demo-domain \
--repository demo-repo
{{< /command >}}

The following output is displayed:

```json
{
"repository": {
"name": "demo-repo",
"administratorAccount": "000000000000",
"domainName": "demo-domain",
"domainOwner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:repository/demo-domain/demo-repo",
"upstreams": [],
"externalConnections": [],
"createdTime": "2025-05-20T11:34:27.712367+02:00"
}
}
```

Use [ListRepositories](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListRepositories.html) to view all of the repositories.

{{< command >}}
$ awslocal codeartifact list-repositories
{{< /command >}}

The following output is displayed:

```json
{
"repositories": [
{
"name": "demo-repo",
"administratorAccount": "000000000000",
"domainName": "demo-domain",
"domainOwner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:repository/demo-domain/demo-repo",
"createdTime": "2025-05-20T11:34:27.712367+02:00"
}
]
}
```

Otherwise, list repositories in a specific domain using [ListRepositoriesInDomain](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListRepositoriesInDomain.html):

{{< command >}}
$ awslocal codeartifact list-repositories-in-domain --domain demo-domain
{{< /command >}}

The following output is displayed:

```json
{
"repositories": [
{
"name": "demo-repo",
"administratorAccount": "000000000000",
"domainName": "demo-domain",
"domainOwner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:repository/demo-domain/demo-repo",
"createdTime": "2025-05-20T11:34:27.712367+02:00"
}
]
}
```

### External Connections and Upstream Repositories

Repositories can be associated with external connections using [AssociateExternalConnection](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_AssociateExternalConnection.html) and [DisassociateExternalConnection](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DisassociateExternalConnection.html).

{{< command >}}
$ awslocal codeartifact associate-external-connection --domain demo-domain \
--repository demo-repo \
--external-connection "public:npmjs"
{{< /command >}}

The following output is displayed:

```json
{
"repository": {
"name": "demo-repo",
"administratorAccount": "000000000000",
"domainName": "demo-domain",
"domainOwner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:repository/demo-domain/demo-repo",
"upstreams": [],
"externalConnections": [
{
"externalConnectionName": "public:npmjs",
"packageFormat": "npm",
"status": "AVAILABLE"
}
],
"createdTime": "2025-05-20T14:03:27.539994+02:00"
}
}
```

Alternatively, repositories can be configured with upstream repositories using the `upstreams` property of [CreateRepository](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_CreateRepository.html) and [UpdateRepository](https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_UpdateRepository.html).

{{< command >}}
$ awslocal codeartifact create-repository --domain demo-domain \
--repository demo-repo2 \
--upstreams repositoryName=demo-repo
{{< /command >}}

The following output is displayed:

```json
{
"repository": {
"name": "demo-repo2",
"administratorAccount": "000000000000",
"domainName": "demo-domain",
"domainOwner": "000000000000",
"arn": "arn:aws:codeartifact:eu-central-1:000000000000:repository/demo-domain/demo-repo2",
"upstreams": [
{
"repositoryName": "demo-repo"
}
],
"externalConnections": [],
"createdTime": "2025-05-20T14:07:56.741333+02:00"
}
}
```

{{< callout "note">}}
Please note, a repository can have one or more upstream repositories, or an external connection.
{{< /callout >}}

## Current Limitations

LocalStack doesn't support the following features yet:

- Domain and repository permission policies
- Packages and package groups handlers
- Retrieving repository endpoints
Loading