We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
--associate-public-ip-address option does not work
when runnning aws ec2 run-instances as follows

> aws ec2 run-instances --output text \
> --image-id ami-xxxxxxxx \
> --key-name ap-southeast-2 \
> --security-group-ids sg-zzzzzzzz \
> --instance-type t1.micro \
> --subnet-id subnet-yyyyyyyy \
> --disable-api-termination \
> --no-ebs-optimized \
> --associate-public-ip-address  \
> --count 1 \
> --region ap-southeast-2 --debug

the error message is shown like below.

> Network interfaces and an instance-level subnet ID may not be specified on the same request

I compared the https API request between ec2-api-tools and awscli and in this case there are some differences between them as follow. It seems that the paramers such as subnet-id and security-group-ids is not handled correctly.

ec2-api-tools

> NetworkInterface.1.AssociatePublicIpAddress=true&
> NetworkInterface.1.DeviceIndex=0&
> NetworkInterface.1.SecurityGroupId.1=sg-zzzzzzzz&
> NetworkInterface.1.SubnetId=subnet-yyyyyyyy&

awscli

> NetworkInterface.1.AssociatePublicIpAddress=true&
> NetworkInterface.1.DeviceIndex=0&
> SecurityGroupId.1=sg-zzzzzzzz&
> SubnetId=subnet-yyyyyyyy&


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `awscli/customizations/ec2runinstances.py`
Content:
```
1 # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"). You
4 # may not use this file except in compliance with the License. A copy of
5 # the License is located at
6 #
7 #     http://aws.amazon.com/apache2.0/
8 #
9 # or in the "license" file accompanying this file. This file is
10 # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 # ANY KIND, either express or implied. See the License for the specific
12 # language governing permissions and limitations under the License.
13 """
14 This customization adds two new parameters to the ``ec2 run-instance``
15 command.  The first, ``--secondary-private-ip-addresses`` allows a list
16 of IP addresses within the specified subnet to be associated with the
17 new instance.  The second, ``--secondary-ip-address-count`` allows you
18 to specify how many additional IP addresses you want but the actual
19 address will be assigned for you.
20 
21 This functionality (and much more) is also available using the
22 ``--network-interfaces`` complex argument.  This just makes two of
23 the most commonly used features available more easily.
24 """
25 from awscli.arguments import CustomArgument
26 
27 
28 # --secondary-private-ip-address
29 SECONDARY_PRIVATE_IP_ADDRESSES_DOCS = (
30     '[EC2-VPC] A secondary private IP address for the network interface '
31     'or instance. You can specify this multiple times to assign multiple '
32     'secondary IP addresses.  If you want additional private IP addresses '
33     'but do not need a specific address, use the '
34     '--secondary-private-ip-address-count option.')
35 
36 # --secondary-private-ip-address-count
37 SECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS = (
38     '[EC2-VPC] The number of secondary IP addresses to assign to '
39     'the network interface or instance.')
40 
41 # --associate-public-ip-address
42 ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS = (
43     '[EC2-VPC] If specified a public IP address will be assigned '
44     'to the new instance in a VPC.')
45 
46 
47 
48 def _add_params(argument_table, operation, **kwargs):
49     arg = SecondaryPrivateIpAddressesArgument(
50         name='secondary-private-ip-addresses',
51         help_text=SECONDARY_PRIVATE_IP_ADDRESSES_DOCS)
52     argument_table['secondary-private-ip-addresses'] = arg
53     arg = SecondaryPrivateIpAddressCountArgument(
54         name='secondary-private-ip-address-count',
55         help_text=SECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS)
56     argument_table['secondary-private-ip-address-count'] = arg
57     arg = AssociatePublicIpAddressArgument(
58         name='associate-public-ip-address',
59         help_text=ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS,
60         action='store_true', group_name='associate_public_ip')
61     argument_table['associate-public-ip-address'] = arg
62     arg = NoAssociatePublicIpAddressArgument(
63         name='no-associate-public-ip-address',
64         help_text=ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS,
65         action='store_false', group_name='associate_public_ip')
66     argument_table['no-associate-public-ip-address'] = arg
67 
68 
69 def _check_args(parsed_args, **kwargs):
70     # This function checks the parsed args.  If the user specified
71     # the --network-interfaces option with any of the scalar options we
72     # raise an error.
73     arg_dict = vars(parsed_args)
74     if arg_dict['network_interfaces']:
75         for key in ('secondary_private_ip_addresses',
76                     'secondary_private_ip_address_count',
77                     'associate_public_ip_address'):
78             if arg_dict[key]:
79                 msg = ('Mixing the --network-interfaces option '
80                        'with the simple, scalar options is '
81                        'not supported.')
82                 raise ValueError(msg)
83 
84 EVENTS = [
85     ('building-argument-table.ec2.run-instances', _add_params),
86     ('operation-args-parsed.ec2.run-instances', _check_args),
87     ]
88 
89 
90 def register_runinstances(event_handler):
91     # Register all of the events for customizing BundleInstance
92     for event, handler in EVENTS:
93         event_handler.register(event, handler)
94 
95 
96 def _build_network_interfaces(params, key, value):
97     # Build up the NetworkInterfaces data structure
98     if 'network_interfaces' not in params:
99         params['network_interfaces'] = [{'DeviceIndex': 0}]
100 
101     if key == 'PrivateIpAddresses':
102         if 'PrivateIpAddresses' not in params['network_interfaces'][0]:
103             params['network_interfaces'][0]['PrivateIpAddresses'] = value
104     else:
105         params['network_interfaces'][0][key] = value
106 
107 
108 class SecondaryPrivateIpAddressesArgument(CustomArgument):
109 
110     def add_to_parser(self, parser, cli_name=None):
111         parser.add_argument(self.cli_name, dest=self.py_name,
112                             default=self._default, nargs='*')
113 
114     def add_to_params(self, parameters, value):
115         if value:
116             value = [{'PrivateIpAddress': v, 'Primary': False} for
117                      v in value]
118             _build_network_interfaces(parameters,
119                                       'PrivateIpAddresses',
120                                       value)
121 
122 
123 class SecondaryPrivateIpAddressCountArgument(CustomArgument):
124 
125     def add_to_parser(self, parser, cli_name=None):
126         parser.add_argument(self.cli_name, dest=self.py_name,
127                             default=self._default, type=int)
128 
129     def add_to_params(self, parameters, value):
130         if value:
131             _build_network_interfaces(parameters,
132                                       'SecondaryPrivateIpAddressCount',
133                                       value)
134 
135 
136 class AssociatePublicIpAddressArgument(CustomArgument):
137 
138     def add_to_params(self, parameters, value):
139         if value is True:
140             _build_network_interfaces(parameters,
141                                       'AssociatePublicIpAddress',
142                                       value)
143 
144 
145 class NoAssociatePublicIpAddressArgument(CustomArgument):
146 
147     def add_to_params(self, parameters, value):
148         if value is False:
149             _build_network_interfaces(parameters,
150                                       'AssociatePublicIpAddress',
151                                       value)
152
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/awscli/customizations/ec2runinstances.py b/awscli/customizations/ec2runinstances.py
--- a/awscli/customizations/ec2runinstances.py
+++ b/awscli/customizations/ec2runinstances.py
@@ -24,7 +24,6 @@
 """
 from awscli.arguments import CustomArgument
 
-
 # --secondary-private-ip-address
 SECONDARY_PRIVATE_IP_ADDRESSES_DOCS = (
     '[EC2-VPC] A secondary private IP address for the network interface '
@@ -43,8 +42,6 @@
     '[EC2-VPC] If specified a public IP address will be assigned '
     'to the new instance in a VPC.')
 
-
-
 def _add_params(argument_table, operation, **kwargs):
     arg = SecondaryPrivateIpAddressesArgument(
         name='secondary-private-ip-addresses',
@@ -81,9 +78,23 @@
                        'not supported.')
                 raise ValueError(msg)
 
+
+def _fix_subnet(operation, endpoint, params, **kwargs):
+    # If the user has supplied a --subnet-id option AND we also
+    # have inserted an AssociatePublicIpAddress into the network_interfaces
+    # structure, we need to move the subnetId value down into the
+    # network_interfaces structure or we will get a client error from EC2.
+    if 'network_interfaces' in params:
+        ni = params['network_interfaces']
+        if 'AssociatePublicIpAddress' in ni[0]:
+            if 'subnet_id' in params:
+                ni[0]['SubnetId'] = params['subnet_id']
+                del params['subnet_id']
+
 EVENTS = [
     ('building-argument-table.ec2.run-instances', _add_params),
     ('operation-args-parsed.ec2.run-instances', _check_args),
+    ('before-parameter-build.ec2.RunInstances', _fix_subnet),
     ]

{"golden_diff": "diff --git a/awscli/customizations/ec2runinstances.py b/awscli/customizations/ec2runinstances.py\n--- a/awscli/customizations/ec2runinstances.py\n+++ b/awscli/customizations/ec2runinstances.py\n@@ -24,7 +24,6 @@\n \"\"\"\n from awscli.arguments import CustomArgument\n \n-\n # --secondary-private-ip-address\n SECONDARY_PRIVATE_IP_ADDRESSES_DOCS = (\n     '[EC2-VPC] A secondary private IP address for the network interface '\n@@ -43,8 +42,6 @@\n     '[EC2-VPC] If specified a public IP address will be assigned '\n     'to the new instance in a VPC.')\n \n-\n-\n def _add_params(argument_table, operation, **kwargs):\n     arg = SecondaryPrivateIpAddressesArgument(\n         name='secondary-private-ip-addresses',\n@@ -81,9 +78,23 @@\n                        'not supported.')\n                 raise ValueError(msg)\n \n+\n+def _fix_subnet(operation, endpoint, params, **kwargs):\n+    # If the user has supplied a --subnet-id option AND we also\n+    # have inserted an AssociatePublicIpAddress into the network_interfaces\n+    # structure, we need to move the subnetId value down into the\n+    # network_interfaces structure or we will get a client error from EC2.\n+    if 'network_interfaces' in params:\n+        ni = params['network_interfaces']\n+        if 'AssociatePublicIpAddress' in ni[0]:\n+            if 'subnet_id' in params:\n+                ni[0]['SubnetId'] = params['subnet_id']\n+                del params['subnet_id']\n+\n EVENTS = [\n     ('building-argument-table.ec2.run-instances', _add_params),\n     ('operation-args-parsed.ec2.run-instances', _check_args),\n+    ('before-parameter-build.ec2.RunInstances', _fix_subnet),\n     ]\n", "issue": "--associate-public-ip-address option does not work\nwhen runnning aws ec2 run-instances as follows\n\n> aws ec2 run-instances --output text \\\n> --image-id ami-xxxxxxxx \\\n> --key-name ap-southeast-2 \\\n> --security-group-ids sg-zzzzzzzz \\\n> --instance-type t1.micro \\\n> --subnet-id subnet-yyyyyyyy \\\n> --disable-api-termination \\\n> --no-ebs-optimized \\\n> --associate-public-ip-address  \\\n> --count 1 \\\n> --region ap-southeast-2 --debug\n\nthe error message is shown like below.\n\n> Network interfaces and an instance-level subnet ID may not be specified on the same request\n\nI compared the https API request between ec2-api-tools and awscli and in this case there are some differences between them as follow. It seems that the paramers such as subnet-id and security-group-ids is not handled correctly.\n\nec2-api-tools\n\n> NetworkInterface.1.AssociatePublicIpAddress=true&\n> NetworkInterface.1.DeviceIndex=0&\n> NetworkInterface.1.SecurityGroupId.1=sg-zzzzzzzz&\n> NetworkInterface.1.SubnetId=subnet-yyyyyyyy&\n\nawscli\n\n> NetworkInterface.1.AssociatePublicIpAddress=true&\n> NetworkInterface.1.DeviceIndex=0&\n> SecurityGroupId.1=sg-zzzzzzzz&\n> SubnetId=subnet-yyyyyyyy&\n\n", "before_files": [{"content": "# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n#     http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n\"\"\"\nThis customization adds two new parameters to the ``ec2 run-instance``\ncommand.  The first, ``--secondary-private-ip-addresses`` allows a list\nof IP addresses within the specified subnet to be associated with the\nnew instance.  The second, ``--secondary-ip-address-count`` allows you\nto specify how many additional IP addresses you want but the actual\naddress will be assigned for you.\n\nThis functionality (and much more) is also available using the\n``--network-interfaces`` complex argument.  This just makes two of\nthe most commonly used features available more easily.\n\"\"\"\nfrom awscli.arguments import CustomArgument\n\n\n# --secondary-private-ip-address\nSECONDARY_PRIVATE_IP_ADDRESSES_DOCS = (\n    '[EC2-VPC] A secondary private IP address for the network interface '\n    'or instance. You can specify this multiple times to assign multiple '\n    'secondary IP addresses.  If you want additional private IP addresses '\n    'but do not need a specific address, use the '\n    '--secondary-private-ip-address-count option.')\n\n# --secondary-private-ip-address-count\nSECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS = (\n    '[EC2-VPC] The number of secondary IP addresses to assign to '\n    'the network interface or instance.')\n\n# --associate-public-ip-address\nASSOCIATE_PUBLIC_IP_ADDRESS_DOCS = (\n    '[EC2-VPC] If specified a public IP address will be assigned '\n    'to the new instance in a VPC.')\n\n\n\ndef _add_params(argument_table, operation, **kwargs):\n    arg = SecondaryPrivateIpAddressesArgument(\n        name='secondary-private-ip-addresses',\n        help_text=SECONDARY_PRIVATE_IP_ADDRESSES_DOCS)\n    argument_table['secondary-private-ip-addresses'] = arg\n    arg = SecondaryPrivateIpAddressCountArgument(\n        name='secondary-private-ip-address-count',\n        help_text=SECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS)\n    argument_table['secondary-private-ip-address-count'] = arg\n    arg = AssociatePublicIpAddressArgument(\n        name='associate-public-ip-address',\n        help_text=ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS,\n        action='store_true', group_name='associate_public_ip')\n    argument_table['associate-public-ip-address'] = arg\n    arg = NoAssociatePublicIpAddressArgument(\n        name='no-associate-public-ip-address',\n        help_text=ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS,\n        action='store_false', group_name='associate_public_ip')\n    argument_table['no-associate-public-ip-address'] = arg\n\n\ndef _check_args(parsed_args, **kwargs):\n    # This function checks the parsed args.  If the user specified\n    # the --network-interfaces option with any of the scalar options we\n    # raise an error.\n    arg_dict = vars(parsed_args)\n    if arg_dict['network_interfaces']:\n        for key in ('secondary_private_ip_addresses',\n                    'secondary_private_ip_address_count',\n                    'associate_public_ip_address'):\n            if arg_dict[key]:\n                msg = ('Mixing the --network-interfaces option '\n                       'with the simple, scalar options is '\n                       'not supported.')\n                raise ValueError(msg)\n\nEVENTS = [\n    ('building-argument-table.ec2.run-instances', _add_params),\n    ('operation-args-parsed.ec2.run-instances', _check_args),\n    ]\n\n\ndef register_runinstances(event_handler):\n    # Register all of the events for customizing BundleInstance\n    for event, handler in EVENTS:\n        event_handler.register(event, handler)\n\n\ndef _build_network_interfaces(params, key, value):\n    # Build up the NetworkInterfaces data structure\n    if 'network_interfaces' not in params:\n        params['network_interfaces'] = [{'DeviceIndex': 0}]\n\n    if key == 'PrivateIpAddresses':\n        if 'PrivateIpAddresses' not in params['network_interfaces'][0]:\n            params['network_interfaces'][0]['PrivateIpAddresses'] = value\n    else:\n        params['network_interfaces'][0][key] = value\n\n\nclass SecondaryPrivateIpAddressesArgument(CustomArgument):\n\n    def add_to_parser(self, parser, cli_name=None):\n        parser.add_argument(self.cli_name, dest=self.py_name,\n                            default=self._default, nargs='*')\n\n    def add_to_params(self, parameters, value):\n        if value:\n            value = [{'PrivateIpAddress': v, 'Primary': False} for\n                     v in value]\n            _build_network_interfaces(parameters,\n                                      'PrivateIpAddresses',\n                                      value)\n\n\nclass SecondaryPrivateIpAddressCountArgument(CustomArgument):\n\n    def add_to_parser(self, parser, cli_name=None):\n        parser.add_argument(self.cli_name, dest=self.py_name,\n                            default=self._default, type=int)\n\n    def add_to_params(self, parameters, value):\n        if value:\n            _build_network_interfaces(parameters,\n                                      'SecondaryPrivateIpAddressCount',\n                                      value)\n\n\nclass AssociatePublicIpAddressArgument(CustomArgument):\n\n    def add_to_params(self, parameters, value):\n        if value is True:\n            _build_network_interfaces(parameters,\n                                      'AssociatePublicIpAddress',\n                                      value)\n\n\nclass NoAssociatePublicIpAddressArgument(CustomArgument):\n\n    def add_to_params(self, parameters, value):\n        if value is False:\n            _build_network_interfaces(parameters,\n                                      'AssociatePublicIpAddress',\n                                      value)\n", "path": "awscli/customizations/ec2runinstances.py"}], "after_files": [{"content": "# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n#     http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n\"\"\"\nThis customization adds two new parameters to the ``ec2 run-instance``\ncommand.  The first, ``--secondary-private-ip-addresses`` allows a list\nof IP addresses within the specified subnet to be associated with the\nnew instance.  The second, ``--secondary-ip-address-count`` allows you\nto specify how many additional IP addresses you want but the actual\naddress will be assigned for you.\n\nThis functionality (and much more) is also available using the\n``--network-interfaces`` complex argument.  This just makes two of\nthe most commonly used features available more easily.\n\"\"\"\nfrom awscli.arguments import CustomArgument\n\n# --secondary-private-ip-address\nSECONDARY_PRIVATE_IP_ADDRESSES_DOCS = (\n    '[EC2-VPC] A secondary private IP address for the network interface '\n    'or instance. You can specify this multiple times to assign multiple '\n    'secondary IP addresses.  If you want additional private IP addresses '\n    'but do not need a specific address, use the '\n    '--secondary-private-ip-address-count option.')\n\n# --secondary-private-ip-address-count\nSECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS = (\n    '[EC2-VPC] The number of secondary IP addresses to assign to '\n    'the network interface or instance.')\n\n# --associate-public-ip-address\nASSOCIATE_PUBLIC_IP_ADDRESS_DOCS = (\n    '[EC2-VPC] If specified a public IP address will be assigned '\n    'to the new instance in a VPC.')\n\ndef _add_params(argument_table, operation, **kwargs):\n    arg = SecondaryPrivateIpAddressesArgument(\n        name='secondary-private-ip-addresses',\n        help_text=SECONDARY_PRIVATE_IP_ADDRESSES_DOCS)\n    argument_table['secondary-private-ip-addresses'] = arg\n    arg = SecondaryPrivateIpAddressCountArgument(\n        name='secondary-private-ip-address-count',\n        help_text=SECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS)\n    argument_table['secondary-private-ip-address-count'] = arg\n    arg = AssociatePublicIpAddressArgument(\n        name='associate-public-ip-address',\n        help_text=ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS,\n        action='store_true', group_name='associate_public_ip')\n    argument_table['associate-public-ip-address'] = arg\n    arg = NoAssociatePublicIpAddressArgument(\n        name='no-associate-public-ip-address',\n        help_text=ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS,\n        action='store_false', group_name='associate_public_ip')\n    argument_table['no-associate-public-ip-address'] = arg\n\n\ndef _check_args(parsed_args, **kwargs):\n    # This function checks the parsed args.  If the user specified\n    # the --network-interfaces option with any of the scalar options we\n    # raise an error.\n    arg_dict = vars(parsed_args)\n    if arg_dict['network_interfaces']:\n        for key in ('secondary_private_ip_addresses',\n                    'secondary_private_ip_address_count',\n                    'associate_public_ip_address'):\n            if arg_dict[key]:\n                msg = ('Mixing the --network-interfaces option '\n                       'with the simple, scalar options is '\n                       'not supported.')\n                raise ValueError(msg)\n\n\ndef _fix_subnet(operation, endpoint, params, **kwargs):\n    # If the user has supplied a --subnet-id option AND we also\n    # have inserted an AssociatePublicIpAddress into the network_interfaces\n    # structure, we need to move the subnetId value down into the\n    # network_interfaces structure or we will get a client error from EC2.\n    if 'network_interfaces' in params:\n        ni = params['network_interfaces']\n        if 'AssociatePublicIpAddress' in ni[0]:\n            if 'subnet_id' in params:\n                ni[0]['SubnetId'] = params['subnet_id']\n                del params['subnet_id']\n\nEVENTS = [\n    ('building-argument-table.ec2.run-instances', _add_params),\n    ('operation-args-parsed.ec2.run-instances', _check_args),\n    ('before-parameter-build.ec2.RunInstances', _fix_subnet),\n    ]\n\n\ndef register_runinstances(event_handler):\n    # Register all of the events for customizing BundleInstance\n    for event, handler in EVENTS:\n        event_handler.register(event, handler)\n\n\ndef _build_network_interfaces(params, key, value):\n    # Build up the NetworkInterfaces data structure\n    if 'network_interfaces' not in params:\n        params['network_interfaces'] = [{'DeviceIndex': 0}]\n\n    if key == 'PrivateIpAddresses':\n        if 'PrivateIpAddresses' not in params['network_interfaces'][0]:\n            params['network_interfaces'][0]['PrivateIpAddresses'] = value\n    else:\n        params['network_interfaces'][0][key] = value\n\n\nclass SecondaryPrivateIpAddressesArgument(CustomArgument):\n\n    def add_to_parser(self, parser, cli_name=None):\n        parser.add_argument(self.cli_name, dest=self.py_name,\n                            default=self._default, nargs='*')\n\n    def add_to_params(self, parameters, value):\n        if value:\n            value = [{'PrivateIpAddress': v, 'Primary': False} for\n                     v in value]\n            _build_network_interfaces(parameters,\n                                      'PrivateIpAddresses',\n                                      value)\n\n\nclass SecondaryPrivateIpAddressCountArgument(CustomArgument):\n\n    def add_to_parser(self, parser, cli_name=None):\n        parser.add_argument(self.cli_name, dest=self.py_name,\n                            default=self._default, type=int)\n\n    def add_to_params(self, parameters, value):\n        if value:\n            _build_network_interfaces(parameters,\n                                      'SecondaryPrivateIpAddressCount',\n                                      value)\n\n\nclass AssociatePublicIpAddressArgument(CustomArgument):\n\n    def add_to_params(self, parameters, value):\n        if value is True:\n            _build_network_interfaces(parameters,\n                                      'AssociatePublicIpAddress',\n                                      value)\n\n\nclass NoAssociatePublicIpAddressArgument(CustomArgument):\n\n    def add_to_params(self, parameters, value):\n        if value is False:\n            _build_network_interfaces(parameters,\n                                      'AssociatePublicIpAddress',\n                                      value)\n", "path": "awscli/customizations/ec2runinstances.py"}]}