> For the complete documentation index, see [llms.txt](https://www.axisnow.io/zh/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.axisnow.io/zh/docs/multi-edge/integrations/esa.md). Agents can also search and read this documentation through its [MCP server](https://www.axisnow.io/zh/docs/~gitbook/mcp).

# 集成阿里云 ESA

用 RAM role 或 AccessKey 授权 AxisNow 管理阿里云 ESA

集成 ESA 推荐使用 **RAM 角色**：AxisNow 以跨账号角色的方式临时获得权限，您的账号里不存在长期有效的密钥；也可以使用 RAM 用户的 **AccessKey**。

## 准备 <a href="#prepare" id="prepare"></a>

* 一个阿里云账号。国际站（alibabacloud.com）和中国站（aliyun.com）是两套账号体系，集成时需要选择正确的一方。
* 业务域名所属的站点已经在 ESA 中创建并完成验证。AxisNow 在站点下添加记录，不会创建站点。

## 使用 RAM 角色（推荐） <a href="#ram-role" id="ram-role"></a>

集成表单中的 **用 ROS 创建角色** 会打开阿里云 ROS 的创建资源栈页面，模板和 External ID 已预填。资源栈创建完成后，在 **输出** 中复制 `RoleARN` 填回表单。

* 创建前确认当前登录的账号与表单中选择的登录站点（国际站或中国站）一致。
* 默认角色名为 `axisnow-esa-role`。同一个阿里云账号再次集成时，需要换一个未使用的角色名。
* 核对输出的 `ExternalId` 与表单中显示的一致。

无法使用 ROS 链接时，用表单中的信任策略和权限策略在 RAM 控制台手动创建角色，角色 ARN 形如 `acs:ram::<账号 ID>:role/<角色名>`。

## 使用 AccessKey <a href="#accesskey" id="accesskey"></a>

用集成表单给出的策略，在阿里云 RAM 控制台完成三步：

1. **创建权限策略**：选择 **脚本编辑**，粘贴表单中的策略。
2. **创建用户**：访问方式只勾选 **OpenAPI 调用访问**。
3. **为用户授权**：在用户的 **权限管理** 中绑定第一步的策略。

AccessKey Secret 只在创建完成时显示一次，请立即保存。

## 所需权限 <a href="#required-permissions" id="required-permissions"></a>

权限策略包含以下操作：

<table data-search="false"><thead><tr><th width="240">用途</th><th>操作</th></tr></thead><tbody><tr><td>读取站点</td><td>esa:ListSites<br>esa:GetSite</td></tr><tr><td>管理域名记录</td><td>esa:ListRecords<br>esa:CreateRecord<br>esa:UpdateRecord<br>esa:DeleteRecord</td></tr><tr><td>证书</td><td>esa:ListCertificatesByRecord<br>esa:GetCertificateQuota<br>esa:SetCertificate<br>esa:DeleteCertificate</td></tr><tr><td>缓存规则</td><td>esa:ListCacheRules<br>esa:CreateCacheRule<br>esa:UpdateCacheRule<br>esa:DeleteCacheRule</td></tr><tr><td>回源规则</td><td>esa:ListOriginRules<br>esa:CreateOriginRule<br>esa:UpdateOriginRule<br>esa:DeleteOriginRule</td></tr><tr><td>强制 HTTPS</td><td>esa:*HttpsApplicationConfiguration*</td></tr><tr><td>WAF / 限速</td><td>esa:ListWafRulesets<br>esa:CreateWafRuleset<br>esa:DeleteWafRuleset<br>esa:ListWafRules<br>esa:GetWafRule<br>esa:CreateWafRule<br>esa:UpdateWafRule<br>esa:DeleteWafRule</td></tr><tr><td>响应头</td><td>esa:ListHttpResponseHeaderModificationRules<br>esa:CreateHttpResponseHeaderModificationRule<br>esa:UpdateHttpResponseHeaderModificationRule<br>esa:DeleteHttpResponseHeaderModificationRule</td></tr><tr><td>缓存清除</td><td>esa:PurgeCaches</td></tr><tr><td>流量报表</td><td>esa:DescribeSiteTimeSeriesData</td></tr><tr><td>访问控制和限速报表（推荐）</td><td>esa:DescribeSiteWafTimeSeriesData<br>esa:DescribeSiteWafTopData</td></tr><tr><td>权限核实（推荐）</td><td>ram:ListPoliciesForUser<br>ram:ListGroupsForUser<br>ram:ListPoliciesForGroup<br>ram:ListPoliciesForRole<br>ram:GetPolicy</td></tr></tbody></table>

ESA 的 API 地址由登录站点决定（中国站杭州、国际站新加坡），AxisNow 自动选择，不需要填写地域。最后一组 RAM 操作为推荐权限，用于核实写权限，作用见[集成账号](https://www.axisnow.io/zh/docs/multi-edge/integrations.md#integrate-account)。

访问控制和限速报表的两项操作同样为推荐权限。角色或用户缺少它们时，[仪表盘](https://www.axisnow.io/zh/docs/multi-edge/services/dashboard.md#access-control-and-rate-limiting)的访问控制和限速卡片没有 ESA 的数据，其他功能不受影响；在 RAM 控制台为对应的权限策略补上这两项即可。

## 在服务中使用 <a href="#use-in-service" id="use-in-service"></a>

以配置同步（Provision）方式把 ESA 加入服务后，AxisNow 按业务域名的主域名自动匹配站点，然后在该站点下：

* 为每个域名创建指向源站的**加速记录**，ESA 为它分配的 CNAME 即这家边缘的接入地址。
* 把服务的证书上传到站点证书池并绑定到域名记录；证书更新后上传新证书，并回收被替代的旧证书，避免占满证书池配额。
* 把回源、缓存等配置写入站点规则，规则按域名限定范围。

从服务中移除 ESA 并选择同时删除配置时，AxisNow 删除它创建的记录、证书和规则，站点本身保留。


---

# 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://www.axisnow.io/zh/docs/multi-edge/integrations/esa.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.
