> 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]` を、あなたの `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`.

と設定すると、AutoFix が自動的に `POETRY_HTTP_BASIC_[SOURCE]_USERNAME` を `aws` 、 `POETRY_HTTP_BASIC_[SOURCE]_PASSWORD` を設定し、Poetry が AWS CodeArtifact リポジトリにアクセスできるようにします。

## UV

UV に CodeArtifact 認証トークンを使わせるには、追加の環境変数を設定する必要があります。以下を設定してください `UV_INDEX_[INDEX]_USERNAME` を `aws` 。 `[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`.

と設定すると、AutoFix が自動的に `UV_INDEX_[INDEX]_USERNAME` を `aws` 、 `UV_INDEX_[INDEX]_PASSWORD` です。これにより、UV が AWS CodeArtifact リポジトリにアクセスできるようになります。

## Maven

AWS CodeArtifact 接続を設定した後、 `CODEARTIFACT_AUTH_TOKEN` 環境変数を `settings.xml` で使用できます。settings.xml ファイルは Maven Private Registry の設定で指定できます。例:

{% code title="settings.xml" %}

```
<servers>
    <server>
        <id>codeartifact</id>
        <username>aws</username>
        <password>${env.CODEARTIFACT_AUTH_TOKEN}</password>
    </server>
</servers>
```

{% endcode %}

## 設定の確認方法

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

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

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

AWS の認証情報が正しくないか、権限が不足している場合は、'Failed to authenticate to AWS CodeArtifact' という警告メッセージが表示されます:

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

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

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

AWS CodeArtifact との接続を有効にするには、以下の 4 つの環境変数を指定する必要があります:

* `AWS_CODE_ARTIFACT_ACCESS_KEY`： `AWSCodeArtifactReadOnlyAccess` 権限
* `AWS_CODE_ARTIFACT_SECRET_KEY`： `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.
