How to set the default output format in AWS CLI

Setting a default output format in AWS CLI keeps repeated commands consistent without adding --output to every invocation. That matters when one profile is mainly used for automation that expects stable machine-readable output, while another profile is used interactively and is easier to read as yaml or table.

The AWS CLI stores the profile-level output setting in the shared config file, normally ~/.aws/config. Running aws configure set output VALUE writes that preference locally without making an AWS API call, and current AWS documentation lists json, text, table, yaml, yaml-stream, and off as supported output values.

The saved value is only the profile default. AWS_DEFAULT_OUTPUT in the current environment overrides the config file, and an explicit --output flag overrides both, so unexpected formatting usually comes from a higher-precedence override rather than a failed write. The output key belongs in the shared config file instead of the shared credentials file.

Steps to set the default output format in AWS CLI:

  1. Choose the output format that matches the normal job for the target profile.
    Format Typical use
    json Structured output for automation and downstream parsers
    yaml Readable structured output for interactive review
    yaml-stream Incremental YAML documents for larger responses
    text Flat tab-delimited output after the command already returns the exact fields needed
    table Human-readable terminal output for quick inspection
    off No stdout output when only the exit status matters

    Prefer json or yaml while building --query expressions, and switch to text only after the command already returns the exact scalar or flat list needed.

  2. Save the preferred format for the default profile.
    $ aws configure set output yaml

    This writes

    output = yaml

    under the

    [default]

    section in the shared config file. Replace yaml with the value chosen in the previous step when another format fits better.

  3. Save a different format for a named profile when that profile serves a separate workflow.
    $ aws configure set output table --profile work

    The --profile flag writes the setting under

    [profile work]

    instead of changing

    [default]

    .

  4. Read the saved value back from each profile that was changed.
    $ aws configure get output
    yaml
    $ aws configure get output --profile work
    table

    An empty result means that profile does not have an explicit output value saved yet, so the effective format will come from a higher-precedence override or the CLI default.

  5. Inspect the shared config file when the wrong profile appears to have been updated or an older value needs to be removed manually.
    $ sed -n '1,40p' ~/.aws/config
    [default]
    output = yaml
    
    [profile work]
    output = table

    The output format belongs in the config file, not in ~/.aws/credentials. On Windows, inspect

    %UserProfile%\.aws\config

    instead.

  6. Run a local skeleton command without --output to confirm that the saved profile default is shaping command output.
    $ aws s3api list-buckets --generate-cli-skeleton output
    Buckets:
    - BucketArn: BucketArn
      BucketRegion: BucketRegion
      CreationDate: 1970-01-01 00:00:00
      Name: Name
    ContinuationToken: ContinuationToken
    Owner:
      DisplayName: DisplayName
      ID: ID
    Prefix: Prefix
    
    $ aws s3api list-buckets --generate-cli-skeleton output --profile work
    ----------------------------------------------------------------
    |                          ListBuckets                         |
    +-----------------------------------------+--------------------+
    |            ContinuationToken            |      Prefix        |
    +-----------------------------------------+--------------------+
    |  ContinuationToken                      |  Prefix            |
    +-----------------------------------------+--------------------+
    ##### snipped #####

    --generate-cli-skeleton output renders locally, so it is useful for confirming the selected format even before live credentials are configured or a service call is made.