

# 在 AWS CLI 中使用自定义向导运行交互式命令
<a name="cli-usage-wizard"></a>

AWS Command Line Interface (AWS CLI) 提供了使用向导执行某些命令的能力。要完善或查看可用 AWS CLI 向导的完整列表，请参阅 GitHub 上的 [AWS CLI 向导文件夹](https://github.com/aws/aws-cli/tree/v2/awscli/customizations/wizard/wizards)。

## 工作原理
<a name="cli-usage-wizard-how"></a>

与 AWS 控制台类似，AWS CLI 有一个 UI 向导，可指导您完成 AWS 资源管理。要使用向导，请在命令中的服务名称后调用 `wizard` 子命令和向导名称。命令结构如下：

**语法：**

```
$ aws <command> wizard <wizardName>
```

以下示例调用向导来创建新的 `dynamodb` 表。

```
$ aws dynamodb wizard new-table
```

`aws configure` 是唯一没有向导名称的向导。运行向导时，如以下示例所示，运行 `aws configure wizard` 命令：

```
$ aws configure wizard
```

调用向导后，将显示 Shell 中的表单。对于每个参数，都会为您提供一个可供选择的选项列表，或者提示您在字符串中输入。要从列表中进行选择，请使用向上和向下箭头键，然后按 **ENTER** 键。要查看选项的详细信息，请按向右箭头键。填写完参数后，按 **ENTER** 键。

```
$ aws configure wizard
What would you like to configure
> Static Credentials
  Assume Role
  Process Provider
  Additional CLI configuration
Enter the name of the profile: 
Enter your Access Key Id: 
Enter your Secret Access Key:
```

要编辑先前的提示，请使用 **SHIFT** \$1 **TAB**。对于某些向导，在填写所有提示后，您可以预览填充有您信息的 AWS CloudFormation 模板或 AWS CLI 命令。此预览模式对于学习 AWS CLI、服务 API 和创建脚本模板非常有用。

预览后，按 **ENTER** 键或最后一个提示符运行最终命令。

```
$ aws configure wizard
What would you like to configure
Enter the name of the profile: testWizard
Enter your Access Key Id: AB1C2D3EF4GH5I678J90K
Enter your Secret Access Key: ab1c2def34gh5i67j8k90l1mnop2qr3s45tu678v90
<ENTER>
```