

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 创建或更新 EC2 启动模板
<a name="working-with_networking_efa_create-lt"></a>

EFA 网络接口是在 AWS PCS 计算节点组的 EC2 启动模板中设置的。如果有多个网卡，则可以配置多个 EFA。EFA 安全组和可选置放群组也包含在启动模板中。

以下是带有两张网卡的实例的启动模板示例，例如 **hpc** 7a.96xlarge。实例将在集群置放群组`subnet-{{SubnetID1}}`中启动`pg-{{PlacementGroupId1}}`。

 必须专门向每个 EFA 接口添加安全组。每个 EFA 都需要启用 EFA 流量的安全组 (`sg-{{EfaSecGroupId}}`)。其他安全组，尤其是处理常规流量（如 SSH 或 HTTPS）的安全组，只需连接到主网络接口（由 a `DeviceIndex` of 指定`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}}"]
        }
    ]
}
```