Using the AWS CLI examples - AWS Command Line Interface

Python 2.7, 3.4, and 3.5 is being deprecated for the AWS CLI version 1. For more information see the AWS CLI version 1 section of About the AWS CLI versions.

Using the AWS CLI examples

The AWS Command Line Interface (AWS CLI) examples in this guide are formatted using the following conventions:

  • Prompt – The command prompt uses the Linux prompt and is displayed as ($ ). For commands that are Windows specific, C:\> is used as the prompt. Do not include the prompt when you type commands.

  • Directory – When commands must be executed from a specific directory, the directory name is shown before the prompt symbol.

  • User input – Command text that you enter at the command line is formatted as user input.

  • Replaceable text – Variable text, including names of resources that you choose, or IDs generated by AWS services that you must include in commands, is formatted as replaceable text. In multiple-line commands or commands where specific keyboard input is required, keyboard commands can also be shown as replaceable text.

  • Output – Output returned by AWS services is shown under user input, and is formatted as computer output.

The following aws configure command example demonstrates user input, replaceable text, and output:

  1. Enter aws configure at the command line, and then press Enter.

  2. The AWS CLI outputs lines of text, prompting you to enter additional information.

  3. Enter each of your access keys in turn, and then press Enter.

  4. Then, enter an AWS Region name in the format shown, press Enter, and then press Enter a final time to skip the output format setting.

  5. The final Enter command is shown as replaceable text because there is no user input for that line.

    $ aws configure AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-west-2 Default output format [None]: ENTER

The following example shows a simple command with output. To use this example, enter the full text of the command (the highlighted text after the prompt), and then press Enter. The name of the security group, my-sg, is replaceable to your desired security group name. The JSON document, including the curly braces, is output. If you configure your CLI to output in text or table format, the output will be formatted differently. JSON is the default output format.

$ aws ec2 create-security-group --group-name my-sg --description "My security group" { "GroupId": "sg-903004f8" }