使用自訂精靈在 AWS CLI 中執行互動式命令 - AWS Command Line Interface

使用自訂精靈在 AWS CLI 中執行互動式命令

AWS Command Line Interface (AWS CLI) 會提供可將精靈用於部分命令的功能。若要檢視可用 AWS CLI 精靈的完整清單或對其提供貢獻,請參閱 GitHub 上的 AWS CLI 精靈資料夾

運作方式

與 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 + 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>