Fix #2275: Support YAML for complex CLI parameters by Ashutosh0x · Pull Request #10051 · aws/aws-cli

added 2 commits

February 4, 2026 14:13
This fixes a long-standing issue where strings like '1e10' or '0755'
were being output without quotes by 'aws cloudformation package',
causing them to be misinterpreted as numbers when re-parsed.

Added a custom string representer to yaml_dump that identifies and
quotes ambiguous strings (scientific notation, octal, hex, binary,
and sexagesimal formats).
This change enables YAML support for all complex CLI parameters (structures, maps, and lists) by updating the argument unpacking logic in argprocess.py.

Previously, complex parameters only supported JSON for file or string inputs. Now, if the input is not clearly JSON (doesn't start with '{' or '['), the CLI will attempt to parse it as YAML.

This allows using YAML files for CloudFormation parameters and other nested CLI inputs:
- aws cloudformation create-stack --parameters file://params.yaml

Included unit tests in tests/unit/test_argprocess.py covering various YAML input scenarios.