

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

# 變更掛載目標安全群組
<a name="manage-fs-access-update-mount-target-config-sg"></a>

安全群組會定義傳入和傳出存取。當您變更與掛載目標相關聯的安全群組時，請確保您授予必要的傳入和傳出存取權限。這樣做可讓您的 EC2 執行個體與檔案系統通訊。如需安全群組的詳細資訊，請參閱[使用 VPC 安全群組](network-access.md)。

您可以使用 AWS 管理主控台、 AWS CLI或以程式設計方式使用 AWS SDKs 來新增或移除檔案系統掛載目標的安全群組。

## 使用主控台
<a name="mount-target-"></a>

**修改掛載目標的安全群組**

使用下列程序來新增或移除現有 EFS 檔案系統的掛載目標安全群組。

1. 前往 [https://console.aws.amazon.com/efs/](https://console.aws.amazon.com/efs/) 開啟 Amazon Elastic File System 主控台。

1. 在左側導覽窗格中，選擇**檔案系統**，然後選取您要管理掛載目標的檔案系統。

1. 選擇**網路**，然後選擇**管理**以顯示檔案系統的掛載目標。

1. 若要從裝載目標移除安全群組，請選擇安全群組 ID 旁邊的 **X**。

1. 若要將安全群組新增至掛載目標，請從安全群組清單中選擇**安全群組**。

1. 選擇**儲存**。

## 使用 AWS CLI
<a name="modify-mount-target-sg-cli"></a>

若要修改掛載目標有效的安全群組，請使用 `modify-mount-target-security-group` AWS CLI 命令 （對應的操作為 [ModifyMountTargetSecurityGroups](API_ModifyMountTargetSecurityGroups.md)) 取代任何現有的安全群組，如下所示。

```
$ aws efs modify-mount-target-security-groups \
--mount-target-id mount-target-ID-whose-configuration-to-update \
--security-groups  security-group-ids-separated-by-space \
--region aws-region-where-mount-target-exists \
--profile adminuser
```

以下是含有範例資料的範例。

```
$ aws efs modify-mount-target-security-groups \
--mount-target-id fsmt-5751852e \
--security-groups  sg-1004395a sg-1114433a \
--region us-east-2
```