Search code examples
amazon-web-servicesamazon-s3command-line-interfaceaws-climanpage

How to get meaningful help pages for aws CLI subcommands like `aws s3 cp`?


I'm trying to figure out what options there are for the aws s3 cp CLI command but neither of the following work.

When I use --help or -h I get the following useless CLI output that doesn't say anything about s3, let alone s3 cp subcommands:

$ aws s3 cp --help
     
usage: aws [-h] [--profile PROFILE] [--debug]

options:
  -h, --help         show this help message and exit
  --profile PROFILE
  --debug

Neither can I find man pages using man aws, man aws-s3 or man aws-s3-cp.

I know I can find the docs online: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html but how do I get similar information directly in my terminal?


Solution

  • The unintuitive answer is to type help without the --. When you type:

    aws s3 cp help
    

    you get the appropriate man page to open in a pager:

    CP()                                                                      CP()
    
    
    
    NAME
           cp -
    
    DESCRIPTION
           Copies a local file or S3 object to another location locally or in S3.
    
    SYNOPSIS
                cp
              <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>
              [--dryrun]
              [--quiet]
              [--include <value>]
              [--exclude <value>]
    ...
    

    I don't quite understand why aws decided to not accept the nearly universal standard -h for subcommands. Maybe someone can enlighten me in the comments.

    Adding help works everywhere, even on a raw aws as aws help which again opens a manpage. Strange that this help addition is not listed when passing -h.