

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

# 為您的 AWS PCS 叢集建立 VPC
<a name="working-with_networking_create-vpc"></a>

您可以在 AWS 平行運算服務 (AWS PCS) 中為叢集建立 Amazon Virtual Private Cloud (Amazon VPC)。

使用 Amazon VPC 將 VPC 資源啟動至您定義的虛擬網路。此虛擬網路非常近似於您在自有資料中心內運作的傳統網路。但是，它帶來了使用 Amazon Web 服務的可擴展基礎架構的好處。我們建議您在部署生產 VPC 叢集之前，先完全了解 Amazon VPC 服務。如需詳細資訊，請參閱[什麼是 Amazon VPC？](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html) 作者視覺化模式。*Amazon VPC 使用者指南*。

PCS 叢集、節點和支援的資源 （例如檔案系統和目錄服務） 會部署在您的 Amazon VPC 中。如果您想要將現有的 Amazon VPC 與 PCS [AWS PCS VPC 和子網路需求和考量事項](working-with_networking_vpc-requirements.md) 搭配使用，則必須符合中所述的要求。本主題說明如何使用 AWS提供的 CloudFormation 範本建立符合 PCS 要求的 VPC。部署範本後，您可以檢視範本所建立的資源，以確切了解其建立的資源以及這些資源的組態。

## 先決條件
<a name="working-with_networking_create-vpc_prereq"></a>

若要為 PCS 建立 Amazon VPC，您必須擁有必要的 IAM 許可才能建立 Amazon VPC 資源。這些資源包括 VPC、子網、安全群組、路由表和路由，以及網際網路和 NAT 閘道。如需詳細資訊，請參閱《Amazon [VPC 使用者指南》中的使用公有子網路建立](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-policy-examples.html#vpc-public-subnet-iam) VPC。 **若要檢閱 Amazon EC2 的完整清單，請參閱*《服務授權參考*》中的 [Amazon EC2 的動作、資源和條件索引鍵](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonec2.html)。

## 建立 Amazon VPC
<a name="working-with_networking_create-vpc_create"></a>

複製並貼上您將使用 PCS 之 的適當 URL AWS 區域 ，以建立 VPC。您也可以下載 CloudFormation 範本，並自行上傳至 [CloudFormation 主控台](https://console.aws.amazon.com/cloudformation)。
+ **US East (N. Virginia) (美國東部 (維吉尼亞北部))** (us-east-1)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **US East (Ohio) (美國東部 (俄亥俄))** (us-east-2)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **US West (Oregon) (美國西部 (奧勒岡))** (us-west-2)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **Asia Pacific (Mumbai) (亞太區域 (孟買))** (ap-south-1)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **Asia Pacific (Singapore) (亞太區域 (新加坡))** (ap-southeast-1)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **Asia Pacific (Sydney) (亞太區域 (雪梨))** (ap-southeast-2)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **Asia Pacific (Tokyo) (亞太區域 (東京))** (ap-northeast-1)

  ```
  https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （法蘭克福） (eu-central-1)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （愛爾蘭） (eu-west-1)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （倫敦） (eu-west-2)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （巴黎） (eu-west-3)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （米蘭） (eu-south-1)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-south-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （西班牙） (eu-south-2)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-south-2#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **歐洲 （斯德哥爾摩） (eu-north-1)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **AWS GovCloud （美國東部） (us-gov-east-1)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=us-gov-east-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **AWS GovCloud （美國西部） (us-gov-west-1)**

  ```
  https://console.aws.amazon.com/cloudformation/home?region=us-gov-west-1#/stacks/create/review?stackName=hpc-networking&templateURL=https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```
+ **僅範本**

  ```
  https://aws-hpc-recipes.s3.us-east-1.amazonaws.com/main/recipes/net/hpc_large_scale/assets/main.yaml
  ```

**為 PCS 建立 Amazon VPC**

1. 在 [CloudFormation 主控台](https://console.aws.amazon.com/cloudformation)中開啟 範本。
**注意**  
 這些項目會預先填入範本中，讓您可以直接將它們保留為預設值。

1. 在**提供堆疊名稱**，然後**堆疊名稱**下，輸入 `hpc-networking`。

1. 在**參數**下，輸入下列詳細資訊：

   1. 在 **VPC** 下，接著輸入 **CidrBlock** `10.3.0.0/16`

   1. **在子網路 A** 下：

      1. 然後 **CidrPublicSubnetA**，輸入 `10.3.0.0/20`

      1. 然後 **CidrPrivateSubnetA**，輸入 `10.3.128.0/20`

   1. 在**子網路 B** 下：

      1. 然後 **CidrPublicSubnetB**，輸入 `10.3.16.0/20`

      1. 然後 **CidrPrivateSubnetA**，輸入 ` 10.3.144.0/20`

   1. 在**子網路 C** 下：

      1. 針對 **ProvisionSubnetsC**，選取 `True`。
**注意**  
如果您要在可用區域少於三個的區域中建立 VPC，如果將 設定為 ，則會忽略此選項`True`。

      1. 然後 **CidrPublicSubnetB**，輸入 `10.3.32.0/20`

      1. 然後 **CidrPrivateSubnetA**，輸入 `10.3.160.0/20`

1. 在**功能**下，勾選**我確認 AWS CloudFormation 可能會建立 IAM 資源**的核取方塊。

監控 CloudFormation 堆疊的狀態。到達 時`CREATE_COMPLETE`，VPC 資源已準備好供您使用。

**注意**  
若要查看 CloudFormation 範本建立的所有資源，請開啟 [CloudFormation 主控台](https://console.aws.amazon.com/cloudformation)。選擇 `hpc-networking` 堆疊，然後選擇 **Resources** (資源) 索引標籤。