Using Amazon Q CLI in CloudShell - AWS CloudShell

Using Amazon Q CLI in CloudShell

The Amazon Q CLI is a command-line interface that allows you to interact with Amazon Q. For more information, see Using Amazon Q Developer on the command line in the Amazon Q Developer User Guide.

Amazon Q CLI in CloudShell allows you to interact in natural language conversations, ask questions, and receive responses from Amazon Q all from your terminal. You can get the related shell command that reduces the need to search for, remember syntax, and receive command suggestions as you type in the terminal.

Note

Currently, Amazon Q CLI features in CloudShell are not available in your CloudShell VPC environment.

If you don’t see Amazon Q CLI features in CloudShell, contact your administrator to provide you IAM permissions. For more information, see Identity-based policy examples for Amazon Q Developer in the Amazon Q Developer User Guide.

Note

If you delete your CloudShell environment, Q CLI history will be removed as well.

This chapter explains how you can use Amazon Q CLI features in CloudShell.

Using Amazon Q inline suggestions in CloudShell

The Amazon Q inline suggestions in CloudShell provide you with command suggestions as you type in the terminal. For more information, see Amazon Q inline on the command line in the Amazon Q Developer User Guide.

To use Amazon Q inline suggestions in CloudShell

  1. From the AWS Management Console, Choose CloudShell.

  2. On the CloudShell terminal, switch to Z shell, and start typing. To switch to Z shell, type zsh in the terminal, and then press Enter.

    Note

    Currently, Amazon Q inline is only supported in Z shell.

    When you start typing your command, Amazon Q will make suggestions based on your current input and previous commands. Inline suggestions are automatically enabled.

To disable the inline suggestions, run the following command:

q inline disable

To enable the inline suggestions, run the following command:

q inline enable

Using Q chat command in CloudShell

The q chat command allows you to ask questions and receive responses from Amazon Q all from your terminal. To initiate a conversation with Amazon Q, run q chat command in the CloudShell terminal. For more information, see Chatting with Amazon Q in the CLI in the Amazon Q Developer User Guide.

Using Q translate command in CloudShell

The q translate command allows you to write natural language instruction. To translate with Amazon Q, run q translate command in the CloudShell terminal. For more information, see Translating from natural language to bash in the Amazon Q Developer User Guide.

Identity-based policy for Amazon Q CLI in CloudShell

To use Amazon Q CLI in CloudShell, make sure you have the required IAM permissions. For more information, see Identity-based policy examples for Amazon Q Developer in the Amazon Q Developer User Guide.