> 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 - プライベートパッケージ

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

## 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="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-41ca4312f4bd4145a75b1a0d2d2592b033728f8b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-08e22089753d33ec38b2e878f5d54c98df86ae6f%2Fimage.png?alt=media" 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`.

に設定する必要があります。 `POETRY_HTTP_BASIC_[SOURCE]_USERNAME` を `aws` を設定することで、AutoFix は自動的に `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`.

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

## Maven

AWS CodeArtifact 接続を設定した後は、 `CODEARTIFACT_AUTH_TOKEN` 環境変数を `settings.xml` で使用できます。settings.xml ファイルは Maven のプライベートレジストリ設定で、たとえば次のように設定できます:

{% 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="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-227073883cb65dbc6b5191a907fa6ed1a8c008c0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-8e70adb1c6adeeb453e43ee36edf27658fde2084%2Fimage.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
