Skip to content

Better error handling for s3 configuration blocks #9469

@nickgardner-amazon

Description

@nickgardner-amazon

Describe the feature

Normally when you have an AWS configuration file error, you get a specific error message that points you in the right direction.

For example, normally bad AWS config file:

[default]
region = us-west-2

sjlkdfjlksdfjkljlkf

This results in expected error message, such as:

❯ aws sts get-caller-identity

Unable to parse config file: /home/gardnen/.aws/config

However, if you have a bad S3 configuration block :

[default]
region=us-west-2
s3=
endpoint_url=http://localhost:1234/

You instead get the following:

❯ aws sts get-caller-identity

'str' object has no attribute 'get'

This is very confusing as a user, because there is no reference to the fact that there's an issue with the config file, and I'm not running any commands which would have to use s3. The same error handling for normal config file parsing should also apply to special blocks like s3 configuration.

It might be a bit of a stretch, but getting specific error messages about which line in the config file is generating the syntax error would be great.

Use Case

I was trying to deploy some CDK, and kept getting nested errors where 'str' object has no attribute 'get' was buried in giant error blocks. It took quite a bit of chasing to figure out the issue was in the configuration file.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CLI version used

aws-cli/2.23.11 Python/3.9.21 Linux/6.1.132-147.221.amzn2023.x86_64 source/x86_64.amzn.2023

Environment details (OS name and version, etc.)

AL2023

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.configurationp2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions