

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

# 從 AWS 服務主控台在 CloudShell 中執行命令
<a name="cloudshell-commands"></a>

您可以透過 中的 [Amazon ElastiCache](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/WhatIs.html) 和 [Amazon DocumentDB （與 MongoDB 相容）](https://docs.aws.amazon.com/documentdb/latest/developerguide/what-is.html) 主控台，在 CloudShell 終端機中執行命令 AWS 管理主控台。

若要從其他 AWS Service 主控台在 CloudShell 中執行命令，指派給您角色的 IAM 政策必須包含`cloudshell:approveCommand`許可。

CloudShell 會在**主控台工具列**上開啟，而**執行命令**快顯視窗會顯示在 CloudShell 中。在**執行命令**快顯視窗上，命令會出現在命令方塊中。

若要在 CloudShell 終端機中執行命令，請選擇下列其中一個步驟：

1. 如果您尚未在 CloudShell 中建立 VPC 環境，請在**新環境名稱**方塊中輸入名稱。

   您可以根據資源的 VPC 詳細資訊來檢視 VPC 環境詳細資訊。

   1. 選擇 **Create and run (建立並執行)**。

      此步驟將建立新的 CloudShell VPC 環境，並在 CloudShell 終端機中執行 命令。

1. 如果您已經建立 CloudShell VPC 環境，您可以檢視 CloudShell 環境名稱。
**注意**  
如果您已有 CloudShell VPC 環境，則無法建立新的 VPC 環境。

   1. 選擇**執行**。

      此步驟會在所選 CloudShell VPC 環境中的 CloudShell 終端機中執行 命令。
**注意**  
如果您沒有檢視所建立 VPC 環境的許可，請聯絡您的管理員以新增`cloudshell:describeEnvironments`許可。如需詳細資訊，請參閱[使用 IAM 政策管理 AWS CloudShell 存取和使用](sec-auth-with-identities.md)。

您可以繼續在 CloudShell 終端機中執行命令。