aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.46k stars 4.1k forks source link

Error: Random number return #3984

Closed jeffPOG closed 5 years ago

jeffPOG commented 5 years ago

For some reason, regardless what I do using the aws-cli I get a random output prints a the same string of characters. I'm not sure what this about. Any ideas?

Here are a few examples:

User% aws s3 ls --profile=xa-at-ec2-admin '7c6c81215dd22b82ab3183df71e97bc1c3a2d5bb'

aws ec2 stop-instances --instance-ids i-048f3544c878897a --profile=xa-at-ec2-admin '7c6c81215dd22b82ab3183df71e97bc1c3a2d5bb'

screen shot 2019-03-05 at 3 11 13 pm
JordonPhillips commented 5 years ago

Could you append --debug to see what the full stack trace is?

jeffPOG commented 5 years ago

@JordonPhillips sure thing. This is the output that I got

` TauCeti% aws ec2 start-instances --instance-ids i-043854035c828d97a --profile=xa-at-ec2-admin --debug 2019-03-06 09:14:00,139 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.16.100 Python/3.7.2 Darwin/18.2.0 botocore/1.12.90 2019-03-06 09:14:00,140 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['ec2', 'start-instances', '--instance-ids', 'i-048850034c878d97a', '--profile=xa-at-ec2-admin', '--debug'] 2019-03-06 09:14:00,140 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x10fb8d620> 2019-03-06 09:14:00,140 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x10f5f46a8> 2019-03-06 09:14:00,140 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x10f62f268> 2019-03-06 09:14:00,147 - MainThread - botocore.credentials - DEBUG - Skipping environment variable credential check because profile name was explicitly set. 2019-03-06 09:14:00,147 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x10fa55840> 2019-03-06 09:14:00,150 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/data/ec2/2016-11-15/service-2.json 2019-03-06 09:14:00,185 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.ec2: calling handler <function register_retries_for_service at 0x10f128378> 2019-03-06 09:14:00,185 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: ec2 2019-03-06 09:14:00,192 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ec2: calling handler functools.partial(<function _remove_commands at 0x10fb20d08>, commands_to_remove=['import-instance', 'import-volume']) 2019-03-06 09:14:00,192 - MainThread - awscli.customizations.removals - DEBUG - Removing operation: import-instance 2019-03-06 09:14:00,192 - MainThread - awscli.customizations.removals - DEBUG - Removing operation: import-volume 2019-03-06 09:14:00,192 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ec2: calling handler <function add_waiters at 0x10fb94ae8> 2019-03-06 09:14:00,202 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/data/ec2/2016-11-15/waiters-2.json 2019-03-06 09:14:00,204 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('instance-ids', <awscli.arguments.ListArgument object at 0x111f91a20>), ('additional-info', <awscli.arguments.CLIArgument object at 0x111fa3f28>), ('dry-run', <awscli.arguments.BooleanArgument object at 0x111fa3f98>), ('no-dry-run', <awscli.arguments.BooleanArgument object at 0x111fb2048>)]) 2019-03-06 09:14:00,204 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler <function add_streaming_output_arg at 0x10fb8d8c8> 2019-03-06 09:14:00,204 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler <function rename_arg.._rename_arg at 0x10fbacd08> 2019-03-06 09:14:00,204 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler <function rename_arg.._rename_arg at 0x10fbacd90> 2019-03-06 09:14:00,204 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler functools.partial(<function pull_up_bool at 0x10fb94598>, event_handler=<botocore.hooks.EventAliaser object at 0x10e4ca908>) 2019-03-06 09:14:00,205 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler <function add_cli_input_json at 0x10f62f950> 2019-03-06 09:14:00,205 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler <function unify_paging_params at 0x10fb11b70> 2019-03-06 09:14:00,215 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/data/ec2/2016-11-15/paginators-1.json 2019-03-06 09:14:00,216 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ec2.start-instances: calling handler <function add_generate_skeleton at 0x10faef950> 2019-03-06 09:14:00,216 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ec2.start-instances: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x111fb20f0>> 2019-03-06 09:14:00,217 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ec2.start-instances: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x111fb2080>> 2019-03-06 09:14:00,218 - MainThread - botocore.hooks - DEBUG - Event operation-args-parsed.ec2.start-instances: calling handler functools.partial(<function validate_boolean_mutex_groups at 0x10fb94620>, boolean_pairs=[]) 2019-03-06 09:14:00,218 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.ec2.start-instances.instance-ids: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10fc6d7f0> 2019-03-06 09:14:00,218 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.ec2.start-instances: calling handler <awscli.argprocess.ParamShorthandParser object at 0x10f5edcc0> 2019-03-06 09:14:00,218 - MainThread - awscli.arguments - DEBUG - Unpacked value of ['i-048850034c878d97a'] for parameter "instance_ids": ['i-048850034c878d97a'] 2019-03-06 09:14:00,218 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.ec2.start-instances.additional-info: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10fc6d7f0> 2019-03-06 09:14:00,218 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.ec2.start-instances.dry-run: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10fc6d7f0> 2019-03-06 09:14:00,218 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.ec2.start-instances.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10fc6d7f0> 2019-03-06 09:14:00,219 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.ec2.start-instances.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10fc6d7f0> 2019-03-06 09:14:00,219 - MainThread - botocore.hooks - DEBUG - Event calling-command.ec2.start-instances: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x111fb20f0>> 2019-03-06 09:14:00,219 - MainThread - botocore.hooks - DEBUG - Event calling-command.ec2.start-instances: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x111fb2080>> 2019-03-06 09:14:00,219 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role 2019-03-06 09:14:00,219 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/data/endpoints.json 2019-03-06 09:14:00,223 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x10f0fe620> 2019-03-06 09:14:00,235 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.ec2: calling handler <function add_generate_presigned_url at 0x10f0c3158> 2019-03-06 09:14:00,235 - MainThread - botocore.args - DEBUG - The s3 config key is not a dictionary type, ignoring its value of: None 2019-03-06 09:14:00,321 - MainThread - botocore.endpoint - DEBUG - Setting ec2 timeout as (60, 60) 2019-03-06 09:14:00,323 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: ec2 2019-03-06 09:14:00,324 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.ec2.StartInstances: calling handler <bound method ParameterAlias.alias_parameter_in_call of <botocore.handlers.ParameterAlias object at 0x10f12c438>> 2019-03-06 09:14:00,324 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.ec2.StartInstances: calling handler <function generate_idempotent_uuid at 0x10f11bc80> 2019-03-06 09:14:00,325 - MainThread - botocore.hooks - DEBUG - Event before-call.ec2.StartInstances: calling handler <function inject_api_version_header_if_needed at 0x10f1297b8> 2019-03-06 09:14:00,325 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=StartInstances) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': 'aws-cli/1.16.100 Python/3.7.2 Darwin/18.2.0 botocore/1.12.90'}, 'body': {'Action': 'StartInstances', 'Version': '2016-11-15', 'InstanceId.1': 'i-048850034c878d97a'}, 'url': 'https://ec2.us-gov-west-1.amazonaws.com/', 'context': {'client_region': 'us-gov-west-1', 'client_config': <botocore.config.Config object at 0x11211bd30>, 'has_streaming_input': False, 'auth_type': None}} 2019-03-06 09:14:00,325 - MainThread - botocore.hooks - DEBUG - Event request-created.ec2.StartInstances: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x11211bb00>> 2019-03-06 09:14:00,325 - MainThread - botocore.hooks - DEBUG - Event choose-signer.ec2.StartInstances: calling handler <function set_operation_specific_signer at 0x10f11bb70> 2019-03-06 09:14:00,326 - MainThread - botocore.credentials - WARNING - Refreshing temporary credentials failed during mandatory refresh period. Traceback (most recent call last): File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 203, in getitem with open(actual_key) as f: PermissionError: [Errno 13] Permission denied: '/Users/jeff.sikala.i/.aws/cli/cache/7c6c81215dd22b82ab3183df71e97bc1c3a2d5bb.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 429, in _protected_refresh metadata = self._refresh_using() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 566, in fetch_credentials return self._get_cached_credentials() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 574, in _get_cached_credentials response = self._load_from_cache() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 592, in _load_from_cache creds = deepcopy(self._cache[self._cache_key]) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 206, in getitem raise KeyError(cache_key) KeyError: '7c6c81215dd22b82ab3183df71e97bc1c3a2d5bb' 2019-03-06 09:14:00,329 - MainThread - awscli.clidriver - DEBUG - Exception caught in main() Traceback (most recent call last): File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 203, in getitem with open(actual_key) as f: PermissionError: [Errno 13] Permission denied: '/Users/jeff.sikala.i/.aws/cli/cache/7c6c81215dd22b82ab3183df71e97bc1c3a2d5bb.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/awscli/clidriver.py", line 207, in main return command_table[parsed_args.command](remaining, parsed_args) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/awscli/clidriver.py", line 348, in call return command_table[parsed_args.operation](remaining, parsed_globals) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/awscli/clidriver.py", line 520, in call call_parameters, parsed_globals) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/awscli/clidriver.py", line 640, in invoke client, operation_name, parameters, parsed_globals) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/awscli/clidriver.py", line 652, in _make_client_call parameters) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/client.py", line 648, in _make_api_call operation_model, request_dict, request_context) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/client.py", line 667, in _make_request return self._endpoint.make_request(operation_model, request_dict) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/endpoint.py", line 102, in make_request return self._send_request(request_dict, operation_model) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/endpoint.py", line 132, in _send_request request = self.create_request(request_dict, operation_model) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/endpoint.py", line 116, in create_request operation_name=operation_model.name) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit return self._emitter.emit(aliased_event_name, kwargs) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit return self._emit(event_name, kwargs) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit response = handler(kwargs) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/signers.py", line 90, in handler return self.sign(operation_name, request) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/signers.py", line 149, in sign auth = self.get_auth_instance(kwargs) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/signers.py", line 229, in get_auth_instance frozen_credentials = self._credentials.get_frozen_credentials() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 518, in get_frozen_credentials self._refresh() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 413, in _refresh self._protected_refresh(is_mandatory=is_mandatory_refresh) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 429, in _protected_refresh metadata = self._refresh_using() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 566, in fetch_credentials return self._get_cached_credentials() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 574, in _get_cached_credentials response = self._load_from_cache() File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 592, in _load_from_cache creds = deepcopy(self._cache[self._cache_key]) File "/usr/local/Cellar/awscli/1.16.100/libexec/lib/python3.7/site-packages/botocore/credentials.py", line 206, in getitem raise KeyError(cache_key) KeyError: '7c6c81215dd22b82ab3183df71e97bc1c3a2d5bb' 2019-03-06 09:14:00,335 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255 `

jeffPOG commented 5 years ago

I figured it out. The reason it didn't work was because the first time I ran the awscli command, I was sudo. So the aws cli cache located in /user/aws/cli/cache cached the new command to root and not user, so everytime I ran that command as user I got the randomly generated number that corresponded to the cached json output located in /user/aws/cli/cache.

sam-som commented 4 months ago

Hi @jeffPOG How did you fix this issue?

jeffPOG commented 4 months ago

@sam-som look at the comment above.

sam-som commented 3 months ago

closing the loop on this and for any future people. my issue is related to awcli cache https://github.com/aws/aws-cli/issues/5528 the solution was to delete the corrupted cached

rm ~/.aws/cli/cache/<random-string>.json the random string here is the one in the error message