

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

# 使用 部署 AWS ParallelCluster API AWS CLI
<a name="api-reference-deploy-v3"></a>

在本節中，您將了解如何使用 部署 AWS CLI。

如果您尚未設定要與 CLI 搭配使用的 AWS 登入資料，請加以設定。

```
$ aws configure
```

執行下列命令來部署 API：

```
$ REGION=<region>
$ API_STACK_NAME=<stack-name>  # This can be any name
$ VERSION=3.15.0
$ aws cloudformation create-stack \
    --region ${REGION} \
    --stack-name ${API_STACK_NAME} \
    --template-url https://${REGION}-aws-parallelcluster.s3.${REGION}.amazonaws.com/parallelcluster/${VERSION}/api/parallelcluster-api.yaml \
    --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND
$ aws cloudformation wait stack-create-complete --stack-name ${API_STACK_NAME} --region ${REGION}
```

**自訂您的部署**

您可以使用範本公開的 CloudFormation 參數來自訂 API 部署。若要在透過 CLI 部署時設定參數的值，可以使用下列選項： `--parameters ParameterKey=KeyName,ParameterValue=Value`。

下列是選用參數：
+ **區域** - 使用 `Region` 參數指定 API 是否能夠控制所有 AWS 區域 （預設） 或單一 中的資源 AWS 區域。將此值設定為正在部署的 AWS 區域 API，以限制存取。
+ **ParallelClusterFunctionRole** - 這會覆寫指派給實作 功能的 AWS Lambda 函數的 AWS ParallelCluster IAM 角色。參數接受 IAM 角色的 ARN。此角色需要設定為將 AWS Lambda 作為 IAM 主體。此外，由於此角色將取代 API Lambda 函數的預設角色，因此它必須至少具有 API 所需的預設許可，如 中所列[AWS ParallelCluster 範例`pcluster`使用者政策](iam-roles-in-parallelcluster-v3.md#iam-roles-in-parallelcluster-v3-example-user-policies)。
+ **ParallelClusterFunctionAdditionalPolicies** - 要連接到 AWS ParallelCluster API 函數角色之其他 IAM 政策的 ARN。只能指定一個政策。
+ **CustomDomainName、 CustomDomainCertificate、 CustomDomainHostedZoneId** - 使用這些參數來設定 Amazon API Gateway 端點的自訂網域。 `CustomDomainName`  是要使用的網域名稱、 `CustomDomainCertificate` 此網域名稱的 受管憑證 ARN AWS ，以及 `CustomDomainHostedZoneId` 您要建立記錄的 [Amazon Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html) 託管區域 ID。
**警告**  
您可以設定自訂網域設定，以強制執行 API 的最低版本 Transport Layer Security (TLS)。如需詳細資訊，請參閱[在 API Gateway 中選擇自訂網域的最低 TLS 版本](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-custom-domain-tls-version.html)。
+ **EnableIamAdminAccess** - 根據預設， AWS Lambda 處理 AWS ParallelCluster API 操作的函數會設定 IAM 角色，以防止任何特殊權限的 IAM 存取 (`EnableIamAdminAccess=false`)。這使得 API 無法處理需要建立 IAM 角色或政策的操作。因此，只有在資源組態中提供 IAM 角色做為輸入時，才能成功建立叢集或自訂映像。

  當 `EnableIamAdminAccess` 設定為 `true` API 時， AWS ParallelCluster 會授予許可，以管理部署叢集或產生自訂 AMIs 所需的 IAM 角色建立。
**警告**  
將此設為 true 時，它會將 IAM 管理員權限授予處理 AWS ParallelCluster 操作的 AWS Lambda 函數。

  如需啟用此模式時可解除鎖定功能[AWS ParallelCluster 用於管理 IAM 資源的使用者範例政策](iam-roles-in-parallelcluster-v3.md#iam-roles-in-parallelcluster-v3-user-policy-manage-iam) 的其他詳細資訊，請參閱 。
+ **PermissionsBoundaryPolicy** - 此選用參數接受現有的 IAM 政策 ARN，該政策將設定為 PC API 基礎設施建立的所有 IAM 角色的許可界限，以及管理 IAM 許可的條件，以便只有具有此政策的角色可以由 PC API 建立。

  如需此模式所實施限制的其他詳細資訊，請參閱 [`PermissionsBoundary` 模式](iam-roles-in-parallelcluster-v3.md#iam-roles-in-parallelcluster-v3-permissionsboundary-mode) 。
+ **CreateApiUserRole** - 根據預設， AWS ParallelCluster API 的部署包括建立 IAM 角色，該角色設定為授權叫用 API 的唯一角色。Amazon API Gateway  端點已設定  資源型政策，以僅將叫用許可授予建立的使用者。 若要變更此項，請設定 `CreateApiUserRole=false` API 存取權，然後授予選取的 IAM 使用者。如需詳細資訊，請參閱《*Amazon API Gateway * [ API Gateway 開發人員指南》中的控制叫用 API 的存取](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html)。
**警告**  
當 `CreateApiUserRole=true` API 端點的存取不受 Amazon API Gateway 資源政策限制時，具有無限制 `execute-api:Invoke` 許可 的所有 IAM 角色都可以存取 AWS ParallelCluster 功能。如需詳細資訊，請參閱《 [ API Gateway 開發人員指南》中的使用 API Gateway 資源政策控制對 API 的存取](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-resource-policies.html)。 **
**警告**  
具有叫用所有 AWS ParallelCluster API `ParallelClusterApiUserRole` 操作的許可。若要限制對 API 資源子集的存取，請參閱[《 API Gateway 開發人員指南》中的使用 IAM 政策呼叫 API Gateway API 方法的控制](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html#api-gateway-who-can-invoke-an-api-method-using-iam-policies)。 **
+ **IAMRoleAndPolicyPrefix** - 此選用參數接受最多包含 10 個字元的字串，做為做為 PC API 基礎設施中建立之 IAM 角色和政策的字首。