diff --git a/awscli/shorthand.py b/awscli/shorthand.py index 8d71354e771a..374b12d08f03 100644 --- a/awscli/shorthand.py +++ b/awscli/shorthand.py @@ -153,8 +153,8 @@ def _keyval(self): return {key: values} def _key(self): - # key = 1*(alpha / %x30-39) ; [a-zA-Z0-9\-] - valid_chars = string.ascii_letters + string.digits + '-' + # key = 1*(alpha / %x30-39 / %x5f) ; [a-zA-Z0-9\-_] + valid_chars = string.ascii_letters + string.digits + '-_' start = self._index while not self._at_eof(): if self._current() not in valid_chars: diff --git a/tests/unit/test_shorthand.py b/tests/unit/test_shorthand.py index 4aac48960eb4..72437eb9dc62 100644 --- a/tests/unit/test_shorthand.py +++ b/tests/unit/test_shorthand.py @@ -50,6 +50,9 @@ def test_parse(): # Dashes are allowed in key names. yield (_can_parse, 'with-dash=bar', {'with-dash': 'bar'}) + # Underscore are also allowed. + yield (_can_parse, 'with_underscore=bar', {'with_underscore': 'bar'}) + # Explicit lists. yield (_can_parse, 'foo=[]', {'foo': []}) yield (_can_parse, 'foo=[a]', {'foo': ['a']})