

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

# 使用 的 Amazon EMR on EKS 範例 AWS CLI
<a name="cli_emr-containers_code_examples"></a>

下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 Amazon EMR on EKS 來執行動作和實作常見案例。

*Actions* 是大型程式的程式碼摘錄，必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數，但您可以在其相關情境中查看內容中的動作。

每個範例均包含完整原始碼的連結，您可在連結中找到如何設定和執行內容中程式碼的相關指示。

**Topics**
+ [動作](#actions)

## 動作
<a name="actions"></a>

### `update-role-trust-policy`
<a name="emr-containers_UpdateRoleTrustPolicy_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-role-trust-policy`。

**AWS CLI**  
**更新要與 Amazon EMR on EKS 搭配使用之 IAM 角色的信任政策**  
此範例命令會更新名為 **example\$1iam\$1role** 之角色的信任政策，以便與 EKS 上的 Amazon EMR (其中具有來自名為 **example\$1cluster** 之 EKS 叢集的 **example\$1namespace** 命名空間) 搭配使用。  
命令：  

```
aws emr-containers update-role-trust-policy \
    --cluster example_cluster \
    --namespace example_namespace \
    --role-name example_iam_role
```
輸出：  

```
If the trust policy has already been updated, then the output will be:
Trust policy statement already exists for role example_iam_role. No
changes were made!

If the trust policy has not been updated yet, then the output will be:
Successfully updated trust policy of role example_iam_role.
```
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateRoleTrustPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/emr-containers/update-role-trust-policy.html)。