Repository: aws/aws-cli

Issue:
Version 1.11.17 and above breaks EC2 describe volumes with JSON input
Related Issue: #1976 

JSON File:
```json
{
  "VolumeIds": [
    "vol-<id>"
  ]
}
```

Command:
```
aws ec2 describe-volumes --region <region> --cli-input-json file://<file-name>.json
```

Error Message:
```
An error occurred (InvalidParameterCombination) when calling the DescribeVolumes operation: The parameter volumeSet cannot be used with the parameter maxResults
```

OS Release:
```
NAME="Amazon Linux AMI"
VERSION="2016.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2016.09"
PRETTY_NAME="Amazon Linux AMI 2016.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2016.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
```

Works:
```
python27-botocore-1.4.46-1.58.amzn1.noarch
aws-cli-1.10.56-1.41.amzn1.noarch
```

Breaks:
```
python27-botocore-1.4.74-1.60.amzn1.noarch
aws-cli-1.11.17-1.43.amzn1.noarch
```
```
python27-botocore-1.4.86-1.62.amzn1.noarch
aws-cli-1.11.29-1.45.amzn1.noarch
```



Discussion:
Yeah this looks related to the issue you linked, but is a regression specifically for ``--cli-input-json`` and automatically paginating some of the ec2 commands. We will look into fixing this. In the meantime, I would recommend using ``--volume-ids`` parameter if possible as it should not have this issue.

Resolving patch:
diff --git a/awscli/customizations/cliinputjson.py b/awscli/customizations/cliinputjson.py
--- a/awscli/customizations/cliinputjson.py
+++ b/awscli/customizations/cliinputjson.py
@@ -50,7 +50,7 @@ def __init__(self, session):
 
     def _register_argument_action(self):
         self._session.register(
-            'calling-command', self.add_to_call_parameters)
+            'calling-command.*', self.add_to_call_parameters)
         super(CliInputJSONArgument, self)._register_argument_action()
 
     def add_to_call_parameters(self, call_parameters, parsed_args,


Test patch:
diff --git a/tests/functional/ec2/test_describe_volumes.py b/tests/functional/ec2/test_describe_volumes.py
--- a/tests/functional/ec2/test_describe_volumes.py
+++ b/tests/functional/ec2/test_describe_volumes.py
@@ -10,13 +10,25 @@
 # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 # ANY KIND, either express or implied. See the License for the specific
 # language governing permissions and limitations under the License.
+import json
+import shutil
+
 from awscli.testutils import BaseAWSCommandParamsTest
+from awscli.testutils import FileCreator
 
 
 class TestDescribeVolumes(BaseAWSCommandParamsTest):
 
     prefix = 'ec2 describe-volumes'
 
+    def setUp(self):
+        super(TestDescribeVolumes, self).setUp()
+        self.file_creator = FileCreator()
+
+    def tearDown(self):
+        super(TestDescribeVolumes, self).tearDown()
+        shutil.rmtree(self.file_creator.rootdir)
+
     def test_max_results_set_by_default(self):
         command = self.prefix
         params = {'MaxResults': 1000}
@@ -39,3 +51,11 @@ def test_max_results_not_overwritten(self):
 
         command = self.prefix + ' --page-size 5'
         self.assert_params_for_cmd(command, params)
+
+    def test_max_results_with_cli_input_json(self):
+        params = {'VolumeIds': ['vol-12345']}
+        file_path = self.file_creator.create_file(
+            'params.json', json.dumps(params))
+
+        command = self.prefix + ' --cli-input-json file://%s' % file_path
+        self.assert_params_for_cmd(command, params)
diff --git a/tests/unit/customizations/test_cliinputjson.py b/tests/unit/customizations/test_cliinputjson.py
--- a/tests/unit/customizations/test_cliinputjson.py
+++ b/tests/unit/customizations/test_cliinputjson.py
@@ -40,7 +40,7 @@ def tearDown(self):
 
     def test_register_argument_action(self):
         register_args = self.session.register.call_args_list
-        self.assertEqual(register_args[0][0][0], 'calling-command')
+        self.assertEqual(register_args[0][0][0], 'calling-command.*')
         self.assertEqual(register_args[0][0][1],
                          self.argument.add_to_call_parameters)