# AWS ECR

*请确保已安装最新版本的 AWS CLI 和 Docker。*

### 您需要随手准备

* [x] 您 ECR 的 AWS 区域
* [x] 注册表 URI

### 要获取此信息，请转到 AWS 控制台

1. 转到您的 ECR 区域
2. 转到弹性容器注册表（Elastic Container Registry）
3. 然后转到存储库（Repositories）
4. 点击要从中获取镜像的存储库
5. 点击 **查看推送命令（View push commands）**.

### 拆分该 URI

默认情况下，AWS **URI** 包含注册表和镜像，您需要将它们拆分开来

想象一下有这样的内容 **URI**: **597351113950.dkr.ecr.ca-central-1.amazonaws.com/example**

您的 **仓库** 将是： **597351113950.dkr.ecr.ca-central-1.amazonaws.com**

而您的 **镜像** 将是： **示例**

### 获取密码

要获取您的 ECR 登录密码

```bash
aws ecr get-login-password --region ca-central-1
```

{% hint style="success" %}
您可以更改为您的区域（例如 us-east-1、us-west-1 等）。
{% endhint %}

#### 更多信息见 [**AWS 文档**](https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html)[**件说明**](https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html)

### 将应用添加到 Edgegap

#### API 示例

{% hint style="info" %}
用户名将始终为 AWS
{% endhint %}

```json
{
    [...]
    "docker_repository": "597351113950.dkr.ecr.ca-central-1.amazonaws.com",
    "docker_image": "example",
    "docker_tag": "v1",
    "private_username": "AWS",
    "private_token": "<ecr login-password>",
    [...]
}
```

#### 来自仪表板

在我们的仪表板中， **私有注册表令牌** 将是您的 **ecr 登录密码**

<figure><img src="/files/9ff19f09a06ab7ea9d565d6f118408a16a3dfcdd" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://docs.edgegap.com/zh/docs/tools-and-integrations/container/external-registries/aws-ecr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
