

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建立或更新 EC2 啟動範本
<a name="working-with_networking_efa_create-lt"></a>

EFA 網路介面是在 AWS PCS 運算節點群組的 EC2 啟動範本中設定。如果有多個網路卡，則可以設定多個 EFAs。EFA 安全群組和選用的置放群組也包含在啟動範本中。

以下是具有兩個網路卡的執行個體啟動範本範例，例如 **hpc7a.96xlarge**。執行個體將在叢集置放群組 `subnet-{{SubnetID1}}` 的 中啟動`pg-{{PlacementGroupId1}}`。

 安全群組必須特別新增至每個 EFA 介面。每個 EFA 都需要啟用 EFA 流量的安全群組 (`sg-{{EfaSecGroupId}}`)。其他安全群組，尤其是處理一般流量的安全群組，例如 SSH 或 HTTPS，只需要連接到主要網路介面 （由 `DeviceIndex`的 指定`0`)。定義網路介面的啟動範本不支援使用 `SecurityGroupIds` 參數設定安全群組，您必須在您設定的每個網路介面`Groups`中設定 的值。

```
{
    "Placement": {
        "GroupId": "pg-{{PlacementGroupId1}}"
    },
    "NetworkInterfaces": [
        {
            "DeviceIndex": 0,
            "InterfaceType": "efa",
            "NetworkCardIndex": 0,
            "SubnetId": "subnet-{{SubnetId1}}",
            "Groups": [
                "sg-{{SecurityGroupId1}}",
                "sg-{{EfaSecGroupId}}"
            ]
        },
        {
            "DeviceIndex": 1,
            "InterfaceType": "efa",
            "NetworkCardIndex": 1,
            "SubnetId": "subnet-{{SubnetId1}}"
            "Groups": ["sg-{{EfaSecGroupId}}"]
        }
    ]
}
```