# API - 连接到 AWS Direct Connect 使用Fabric和AWS Direct Connect在您的IBX Colocated资产与Amazon Web Services (AWS)资源之间建立直接的第2层连接。使用API从端口,Network Edge设备或Fabric Cloud Router创建连接。 ![](https://docs.equinix.com/zh-Hans/assets/images/connectToAWS-e4d5112e10b97bf9a1a7d753bf90b11b.png) 如果您有AWS提供的服务令牌,请参阅[使用服务令牌连接到目标](https://docs.equinix.com/zh-Hans/fabric/fabric-api/connect-using-service-token.md)。 ## API 先决条件[​](#api-先决条件 "直接链接至API 先决条件") 1. 身份验证 - 提交您的 OAuth2 用户凭据、客户端 ID 和客户端密钥 验证。有关如何致电OAuth API以验证和验证您的凭据的说明,请参阅[API验证](https://docs.equinix.com/zh-Hans/equinix-api/api-authentication.md)。 2. 确定A侧信息。以下任一项: * 向端点发送请求[`/fabric/v4/ports`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getports.md),以确定您的Equinix Fabric端口信息`GET`。端口UUID和链路协议类型(Dot1q或QinQ), 或 * 通过向端点发送请求[`/fabric/v4/serviceTokens`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Tokens/operation/getServiceTokens)来检索A端服务令牌`GET`。您需要令牌的UUID。A端令牌提供配置连接A端的相关信息。 或 * 确定您的Network Edge设备信息。向端点发送请求[`/ne/v1/devices`](https://docs.equinix.com/zh-Hans/api-catalog/network-edgev1/virtual-device/getvirtualdevices),以检查可用的虚拟设备和集群`GET`。您需要设备UUID。向端点发送`GET`请求[`/ne/v1/devices/{device_id}`](https://docs.equinix.com/zh-Hans/api-catalog/network-edgev1/virtual-device/getvirtualdevicebyuuid)以获取设备详情。您可以在设备上选择任何可用接口进行连接。如果不指定接口,连接将自动分配给下一个可用接口。 或 * 确定您的Fabric Cloud Router信息。向端点发送请求[`/fabric/v4/routers/search`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/cloud-routers/searchcloudrouters.md),以检查可用的云路由器`POST`。您需要路由器的UUID。 3. 识别AWS Direct Connect服务配置文件和位置信息。您应该选择哪种服务配置文件的详细信息,请参见[AWS Direct Connect概述](https://docs.equinix.com/zh-Hans/fabric-marketplace/connecting-to-service-provider/aws/direct-connect-overview.md)页面。 * AWS Direct Connect UUID -`69ee618d-be52-468d-bc99-00566f2dd2b9` * AWS Direct Connect大容量UUID -`de55ca94-df3b-4680-845f-6f7093f76bef` * AWS Direct Connect冗余UUID -`8b5cbdbd-53da-4d37-9bfc-cc988eb522f1` * AWS Direct Connect -高容量冗余-`ed48616a-c182-40b4-a462-a78ba812e961` 要查找位置信息,请使用其中一个AWS Direct Connect服务配置文件IDS向端点发送`GET`请求[`/fabric/v4/serviceProfiles/{service_profile_ID}`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Profiles/operation/getServiceProfileByUuid)。`metros`响应中的对象包含Equinix都会区及其关联的AWS区域列表。您需要两者才能建立连接。 4. 识别并验证您的亚马逊账户ID。登录 AWS 管理控制台并找到您的账号。有关如何查找账号的说明,请参阅[AWS文档](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html)。向端点发送`POST`请求[`/fabric/v4/connections/validate`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/validateconnections.md),以验证您的AWS账户ID是否可用于在给定都会区创建与选定服务配置文件的连接。 ## 从 DOT1Q端口连接[​](#从-dot1q端口连接 "直接链接至从 DOT1Q端口连接") 要创建从您的Dot1q端口到AWS的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。连接`type`为`EVPL_VC`。 在对象中提供您的端口信息`aSide`,包括: * `accessPoint.type`AS`COLO` * 将您的端口UUID提供给`port.uuid` * LinkProtocol.type AS`DOT1Q` * 将VLAN ID提供给`linkProtocol.vlanTag` 在对象中提供您的AWS Direct Connect详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的AWS服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 在中指定与Equinix都会区关联的AWS区域`sellerRegion`。此信息可从端点找到[`/fabric/v4/serviceProfiles/{service_profile_ID}`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Profiles/operation/getServiceProfileByUuid)。请参阅[API先决条件](#api-prerequisites)端点。有关详细信息,请参阅[API先决条件](#api-prerequisites)。 * 设置`authenticationKey`为您的AWS账户ID。 `redundancy`在请求正文中指定任何其他连接配置详情,包括`bandwidth`和。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。 cURL 请求示例: ``` curl -X POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": , "redundancy": { "priority": "" },   "aSide": {    "accessPoint": {      "type": "COLO",       "port": {        "uuid": ""       },       "linkProtocol": {         "type": "DOT1Q",         "vlanTag":       }     }   }, "zSide": { "accessPoint": { "type": "SP", "profile": { "type": "L2_PROFILE", "uuid": "" }, "location": { "metroCode": "" }, "sellerRegion": "", "authenticationKey": "" } }, "project": { "projectId": "" }, "notifications": [ { "type": "ALL", "emails": [ "" ] } ] }' ``` ## 从 QINQ端口连接[​](#从-qinq端口连接 "直接链接至从 QINQ端口连接") 要建立从QinQ端口到AWS的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。连接`type`为`EVPL_VC`。 在对象中提供您的端口信息`aSide`,包括: * 设置`accessPoint.type`为`COLO` * 将您的端口UUID提供给`port.uuid` * `linkProtocol.type` AS`QINQ` * 向提供内部标记ID`linkProtocol.vlanCTag` * 向提供外部标记ID`linkProtocol.vlanSTag` 在对象中提供您的AWS Direct Connect详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的AWS服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 在中指定与Equinix都会区关联的AWS区域`sellerRegion`。此信息可从端点找到[`/fabric/v4/serviceProfiles/{service_profile_ID}`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Profiles/operation/getServiceProfileByUuid)。请参阅[API先决条件](#api-prerequisites)端点。有关详细信息,请参阅[API先决条件](#api-prerequisites)。 * 设置`authenticationKey`为您的AWS账户ID。 `redundancy`在请求正文中指定任何其他连接配置详情,包括`bandwidth`和。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。 cURL 请求示例: ``` curl -X POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": , "redundancy": { "priority": "" },   "aSide": {    "accessPoint": { "type": "COLO",       "port": {        "uuid": ""       },       "linkProtocol": {        "type": "QINQ",         "vlanCTag": ,         "vlanSTag":       } }   }, "zSide": { "accessPoint": { "type": "SP", "profile": { "type": "L2_PROFILE", "uuid": "" }, "location": { "metroCode": "" }, "sellerRegion": "", "authenticationKey": "" } }, "project": { "projectId": "" }, "notifications": [ { "type": "ALL", "emails": [ "" ] } ] } ``` ## 使用服务令牌进行连接[​](#使用服务令牌进行连接 "直接链接至使用服务令牌进行连接") 要使用A侧服务令牌建立连接至AWS,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。连接`type`为`EVPL_VC`。 在对象中提供服务令牌UUID`aSide`。服务令牌提供建立连接所需的所有其他必要信息。 在对象中提供您的AWS Direct Connect详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的AWS服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 在中指定与Equinix都会区关联的AWS区域`sellerRegion`。此信息可从端点找到[`/fabric/v4/serviceProfiles/{service_profile_ID}`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Profiles/operation/getServiceProfileByUuid)。请参阅[API先决条件](#api-prerequisites)端点。有关详细信息,请参阅[API先决条件](#api-prerequisites)。 * 设置`authenticationKey`为您的AWS账户ID。 `redundancy`在请求正文中指定任何其他连接配置详情,包括`bandwidth`和。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。 cURL 请求示例: ``` curl -X POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": , "redundancy": { "priority": "" },   "aSide": {    "serviceToken": { "uuid": "20d32a80-0d61-4333-bc03-707b591ae2f4" } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "type": "L2_PROFILE", "uuid": "" }, "location": { "metroCode": "" }, "sellerRegion": "", "authenticationKey": "" } }, "project": { "projectId": "" }, "notifications": [ { "type": "ALL", "emails": [ "" ] } ] } ``` ## 从Network Edge设备连接[​](#从network-edge设备连接 "直接链接至从Network Edge设备连接") 要建立从Network Edge设备到AWS的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。连接`type`为`EVPL_VC`。 在对象中定义您的Network Edge设备`aSide`,包括: * `accessPoint.type` as `VD` * `virtualDevice.type`AS`EDGE` * `virtualDevice.uuid` 设备的UUID 在对象中提供您的AWS Direct Connect详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的AWS服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 在中指定与Equinix都会区关联的AWS区域`sellerRegion`。此信息可从端点找到[`/fabric/v4/serviceProfiles/{service_profile_ID}`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Profiles/operation/getServiceProfileByUuid)。请参阅[API先决条件](#api-prerequisites)端点。有关详细信息,请参阅[API先决条件](#api-prerequisites)。 * 设置`authenticationKey`为您的AWS账户ID。 `redundancy`在请求正文中指定任何其他连接配置详情,包括`bandwidth`和。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。 cURL 请求示例: ``` curl -X POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": , "redundancy": { "priority": "" }, "aSide": { "accessPoint": { "type": "VD", "virtualDevice": { "type": "EDGE", "uuid": "" } } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "type": "L2_PROFILE", "uuid": "" }, "location": { "metroCode": "" }, "sellerRegion": "", "authenticationKey": "" } }, "project": { "projectId": "" }, "notifications": [ { "type": "ALL", "emails": [ "" ] } ] }' ``` ## 从Fabric Cloud Router连接[​](#从fabric-cloud-router连接 "直接链接至从Fabric Cloud Router连接") 要创建从Fabric Cloud Router到AWS的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/createconnection.md)。连接`type`为`IP_VC`。 在对象中定义Fabric Cloud Router`aSide`,包括: * 设置`accessPoint.type`为`CLOUD_ROUTER`。 * 设置`router.uuid`为路由器的UUID。 在对象中提供您的AWS Direct Connect详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的AWS服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 在中指定与Equinix都会区关联的AWS区域`sellerRegion`。此信息可从端点找到[`/fabric/v4/serviceProfiles/{service_profile_ID}`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Profiles/operation/getServiceProfileByUuid)。请参阅[API先决条件](#api-prerequisites)端点。有关详细信息,请参阅[API先决条件](#api-prerequisites)。 * 设置`authenticationKey`为您的AWS账户ID cURL 请求示例: ``` curl -X POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "IP_VC", "name": "", "bandwidth": , "redundancy": { "priority": "" }, "aSide": { "accessPoint": { "type": "CLOUD_ROUTER", "router": { "uuid": "" } } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "type": "L2_PROFILE", "uuid": "" }, "location": { "metroCode": "" }, "sellerRegion": "", "authenticationKey": "" } }, "project": { "projectId": "" }, "notifications": [ { "type": "ALL", "emails": [ "" ] } ] }' ``` ## 监控连接状态[​](#监控连接状态 "直接链接至监控连接状态") 向端点发送`GET`监控连接状态的请求[`fabric/v4/connections/{connection_id}`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/connections/getconnectionbyuuid.md)。 | `equinixStatus`属性值 | `providerStatus`属性值 | **AWS Direct Connect州** | **描述** | | --------------------- | ---------------------- | ------------------------ | ------------------------ | | `PROVISIONING` | `PROVISIONING` | | 连接请求尚未发送到 AWS。 | | `PROVISIONED` | `PENDING_APPROVAL` | 订购 -> 已请求 | 该连接等待确认。 | | `PROVISIONED` | `PROVISIONING` | 待定 | 连接正在建立中。 | | `PROVISIONED` | `PROVISIONED` | 待定 -> 可用 | 连接已成功。 |