> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/autofix-to/connect-private-packages/aws-codeartifact-private-packages.md).

# AWS CodeArtifact - プライベートパッケージ

Aikido の AutoFix で、AWS CodeArtifact 上でプライベートパッケージをホストしているレジストリへの接続を許可できます。

## Aikido での設定

Aikido は、AWS アカウント内に新しいロールを作成する CloudFormation テンプレートを提供します。このロールの権限は読み取り専用の CodeArtifact アクセスに限定されています。これは、Aikido の AWS アカウントに、あなたのアカウント内で新しく作成されたロールとの信頼関係を付与することで機能します。

ロールを作成した後、Aikido が開始に必要なのは特定の ARN だけで、アクセスキーもシークレットも不要です。

で [Aikido の UI](https://app.aikido.dev/issues/fix/settings)、AutoFix > Settings > Connect Registry に移動し、

<figure><img src="/files/4e00e9a22cd1223419c921d2a6e453ec19982b91" alt=""><figcaption></figcaption></figure>

モーダル内の手順に従ってください：

* IAM ロールとポリシーを作成
* CloudFormation の出力からロール ARN を貼り付け
* AWS コンソールで表示される CodeArtifact リポジトリのドメインを入力します（例: mydomain）
* CodeArtifact ドメインがホストされている AWS リージョンを選択します（例: us-east-1）

<figure><img src="/files/bf9ba3bc9fae6016c775c321c386b6b83bcae6eb" alt=""><figcaption></figcaption></figure>

Aikido AutoFix は `CODEARTIFACT_AUTH_TOKEN` という環境変数を処理中に設定します。この環境変数は、その後パッケージマネージャーが CodeArtifact レジストリに認証するために使用できます。必要となるレジストリ固有の設定については以下を参照してください。

## NPM と PNPM <a href="#npm--pnpm" id="npm--pnpm"></a>

基本的な `.npmrc` 設定は、プライベートパッケージをインストールしているリポジトリ（または Aikido の設定）に存在している必要があります。以下の情報を含め、プレースホルダーはあなたの情報に置き換えてください：

```
@pied-piper:registry=https://mydomain-123456789.d.codeartifact.us-east-1.amazonaws.com/npm/pied-piper
//mydomain-123456789.d.codeartifact.us-east-1.amazonaws.com/npm/pied-piper/:_authToken=${CODEARTIFACT_AUTH_TOKEN}
```

AutoFix の実行中、 `${CODEARTIFACT_AUTH_TOKEN}` は実際の認証トークンに置き換えられます。

## Poetry

Poetry に CodeArtifact の認証トークンを使用するよう指示するため、追加の環境変数を設定する必要があります。次を設定してください `POETRY_HTTP_BASIC_[SOURCE]_USERNAME` を次に設定します: `aws` . \[SOURCE] を `[SOURCE]` あなたの `pyproject.toml` のソース名（大文字）に置き換えてください。例：

```toml
[[tool.poetry.source]]
name = "artifact"
url = "https://repo-1234567890.d.codeartifact.eu-west-1.amazonaws.com/pypi/poetry/simple/"
```

例ではソース名は `artifact`です。したがって、 `POETRY_HTTP_BASIC_ARTIFACT_USERNAME` という環境変数を `aws`.

を設定することで、 `POETRY_HTTP_BASIC_[SOURCE]_USERNAME` を次に設定します: `aws` 、AutoFix は自動的に `POETRY_HTTP_BASIC_[SOURCE]_PASSWORD` を設定し、Poetry に AWS CodeArtifact リポジトリへのアクセスを提供します。

## UV

UV に CodeArtifact の認証トークンを使用するよう指示するため、追加の環境変数を設定する必要があります。次を設定してください `UV_INDEX_[INDEX]_USERNAME` を次に設定します: `aws` . \[SOURCE] を `[INDEX]` を `pyproject.toml` のソース名（大文字）に置き換えてください。例：

```toml
[[tool.uv.index]]
name = "artifact"
url = "https://repo-1234567890.d.codeartifact.eu-west-1.amazonaws.com/pypi/uv-example/simple/"
```

例ではインデックス名は `artifact`です。したがって、 `UV_INDEX_ARTIFACT_USERNAME` という環境変数を `aws`.

を設定することで、 `UV_INDEX_[INDEX]_USERNAME` を次に設定します: `aws` 、AutoFix は自動的に `UV_INDEX_[INDEX]_PASSWORD` を設定することで、UV に AWS CodeArtifact リポジトリへのアクセスを提供します。

## 設定を確認する方法

依存関係の AutoFix を作成するとき、進行状況のモーダルに次のメッセージが表示されるはずです：

* 3 個（またはそれ以上）の環境変数を設定しました
* AWS CodeArtifact 認証トークンの設定に成功しました

<figure><img src="/files/14c1f2e4db3d451096f5cc65e798e7e62b0f2973" alt=""><figcaption></figcaption></figure>

AWS 認証情報が正しくないか、権限が不足している場合、'AWS CodeArtifact への認証に失敗しました' という警告メッセージが表示されます：

<figure><img src="/files/7b2ece04fe7f98bc72f269c8f17b392f496fa612" alt=""><figcaption></figcaption></figure>

AWS CodeArtifact に関するメッセージが表示されない場合、設定が完了していないことを意味します。

## AWS アクセスキーを使用する（非推奨）

AWS CodeArtifact への接続を有効にするには、次の 4 つの環境変数を提供する必要があります：

* `AWS_CODE_ARTIFACT_ACCESS_KEY`: AWSCodeArtifactReadOnlyAccess を持つユーザーまたはロール用のアクセスキー `AWSCodeArtifactReadOnlyAccess` 権限
* `AWS_CODE_ARTIFACT_SECRET_KEY`: AWSCodeArtifactReadOnlyAccess を持つユーザーまたはロール用のシークレットキー `AWSCodeArtifactReadOnlyAccess` 権限
* `AWS_CODE_ARTIFACT_DOMAIN`: AWS コンソールで表示される CodeArtifact リポジトリのドメイン（例: mydomain）
* `AWS_CODE_ARTIFACT_REGION`: CodeArtifact ドメインがホストされている AWS リージョン（例: us-east-1）

これら 4 つの環境変数が設定されると、Aikido AutoFix は `CODEARTIFACT_AUTH_TOKEN` という環境変数を処理中に設定します。この環境変数は、その後パッケージマネージャーが CodeArtifact レジストリに認証するために使用できます。必要となるレジストリ固有の設定については以下を参照してください。

これらの環境変数は Autofix > Settings > Connect Registry > [環境変数を設定 から設定できます](/docs/docs-ja/autofix-to/connect-private-packages/custom-config-private-packages.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/autofix-to/connect-private-packages/aws-codeartifact-private-packages.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
