

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# CloudShell 从 AWS 服务控制台中运行命令
<a name="cloudshell-commands"></a>

你可以通过[亚马逊 ElastiCache和亚马逊](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/WhatIs.html)[文档数据库（兼容 MongoDB）](https://docs.aws.amazon.com/documentdb/latest/developerguide/what-is.html)控制台在 CloudShell 终端中运行命令。 AWS 管理控制台

要 CloudShell 从其他 AWS 服务控制台运行命令，分配给您的角色的 IAM 策略必须包含`cloudshell:approveCommand`权限。

CloudShell 在**控制台工具栏**上打开并出现**运行命令**弹出窗口 CloudShell。在**运行命令**弹出窗口中，命令出现在命令框中。

要在 CloudShell 终端中运行命令，请选择以下步骤之一：

1. 如果您尚未**在新环境名称框中创建 VPC 环境**，请在 “新建环境名称” 框中输入名称 CloudShell。

   您可以查看基于您资源的 VPC 详情构建的 VPC 环境详情。

   1. 选择**创建并运行**。

      此步骤将创建一个新的 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 终端中运行命令。