Aws-cli: --cli-input-json error message very misleading

Created on 6 Aug 2018  路  12Comments  路  Source: aws/aws-cli

I am new to aws cli, and recently discovered the --cli-input-json parameters. I admit that I jumped in without fully read the document, but then, when I firstly specified a file name of my JSON document to the parameter (I guess lots programmers will do the same in the first attempt without reading the documentation), as follows:

aws dynamodb create-table --cli-input-json awscli-jsons/dynamodb-create-table-contact.json

The error message I received would be like:

Error parsing parameter 'cli-input-json': Invalid JSON: No JSON object could be decoded
JSON received: awscli-jsons/dynamodb-create-table-contact.json

In every way the message seems like indicates the file format was wrong, not a valid JSON file, and cannot be parsed. I studied the documents from "aws dynamodb create-table help" and still was given no clue. Much time was spent until I find that I should issue the command as:

aws dynamodb create-table --cli-input-json file://awscli-jsons/dynamodb-create-table-contact.json

Firstly, such important information (using file://), which is different from the norm (in most cases we expect providing the file name), should be mentioned in the command help. Then, the error message is very misleading, points to a wrong direction.

Please enhance this behavior.

Thanks

Bing

confusing-error enhancement

Most helpful comment

+1 for the sheer weirdness of having to prepend file:// to my filename. Doing this fixed the problem.

All 12 comments

@bing - thank you for your post. Without knowing the CLI version or seeing a 鈥攄ebug log, it's hard to tell why that's happening. I would say try first upgrading to the latest version of the CLI and re-test. If there is still an issue, please use the 鈥攄ebug option and please post a sanitized debug log so we can look into this issue further. Thanks.

I upgraded to the latest version and the misleading error still exists. Below is output with --debug option.

bing@bingstp:~/git/aws-serverless-roundtrip-option1$ aws dynamodb create-table --cli-input-json cli-input-json/dynamodb-create-table-contact.json --debug
2018-08-06 21:44:59,904 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.15.71 Python/2.7.15rc1 Linux/4.15.0-29-generic botocore/1.10.70
2018-08-06 21:44:59,904 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['dynamodb', 'create-table', '--cli-input-json', 'cli-input-json/dynamodb-create-table-contact.json', '--debug']
2018-08-06 21:44:59,904 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x7f211045d1b8>
2018-08-06 21:44:59,904 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x7f2112154668>
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f210d5f57d0>
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable credentials_file from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable config_file from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_timeout from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_num_attempts from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x7f210d1fa0c8>
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:44:59,905 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2018-08-06 21:44:59,907 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/dynamodb/2012-08-10/service-2.json
2018-08-06 21:44:59,917 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.dynamodb: calling handler <function register_retries_for_service at 0x7f210e375cf8>
2018-08-06 21:44:59,917 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: dynamodb
2018-08-06 21:44:59,919 - MainThread - botocore.hooks - DEBUG - Event building-command-table.dynamodb: calling handler <function add_waiters at 0x7f21104665f0>
2018-08-06 21:44:59,921 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/dynamodb/2012-08-10/waiters-2.json
2018-08-06 21:44:59,922 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'attribute-definitions', <awscli.arguments.ListArgument object at 0x7f210cd1b650>), (u'table-name', <awscli.arguments.CLIArgument object at 0x7f210cd1b690>), (u'key-schema', <awscli.arguments.ListArgument object at 0x7f210cd1b6d0>), (u'local-secondary-indexes', <awscli.arguments.ListArgument object at 0x7f210cd1b710>), (u'global-secondary-indexes', <awscli.arguments.ListArgument object at 0x7f210cd1b750>), (u'provisioned-throughput', <awscli.arguments.CLIArgument object at 0x7f210cd1b790>), (u'stream-specification', <awscli.arguments.CLIArgument object at 0x7f210cd1b7d0>), (u'sse-specification', <awscli.arguments.CLIArgument object at 0x7f210cd1b810>)])
2018-08-06 21:44:59,922 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function add_streaming_output_arg at 0x7f211045d7d0>
2018-08-06 21:44:59,922 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function add_cli_input_json at 0x7f210d5fd488>
2018-08-06 21:44:59,923 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function unify_paging_params at 0x7f21104ec6e0>
2018-08-06 21:44:59,925 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/dynamodb/2012-08-10/paginators-1.json
2018-08-06 21:44:59,925 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function add_generate_skeleton at 0x7f21104d81b8>
2018-08-06 21:44:59,925 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.dynamodb.create-table: calling handler <bound method CliInputJSONArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7f210cd1b850>>
2018-08-06 21:44:59,925 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.dynamodb.create-table: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f210cd1ba10>>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.attribute-definitions: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.table-name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.key-schema: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.local-secondary-indexes: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.global-secondary-indexes: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.provisioned-throughput: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.stream-specification: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.sse-specification: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f210cdcdbd0>
2018-08-06 21:44:59,926 - MainThread - botocore.hooks - DEBUG - Event calling-command.dynamodb.create-table: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7f210cd1b850>>
2018-08-06 21:44:59,927 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 208, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 345, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 496, in __call__
    parsed_globals=parsed_globals
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 594, in _emit_first_non_none_response
    name, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 724, in emit_first_non_none_response
    responses = self._events.emit(event_name, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/awscli/customizations/cliinputjson.py", line 74, in add_to_call_parameters
    % (e, retrieved_json))
ParamError: Error parsing parameter 'cli-input-json': Invalid JSON: No JSON object could be decoded
JSON received: cli-input-json/dynamodb-create-table-contact.json
2018-08-06 21:44:59,927 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

Error parsing parameter 'cli-input-json': Invalid JSON: No JSON object could be decoded
JSON received: cli-input-json/dynamodb-create-table-contact.json
bing@bingstp:~/git/aws-serverless-roundtrip-option1$ 

Below is output with --debug option and correct parameter. The command executes successfully.

bing@bingstp:~/git/aws-serverless-roundtrip-option1$ aws dynamodb create-table --cli-input-json file://cli-input-json/dynamodb-create-table-contact.json --debug
2018-08-06 21:47:58,430 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.15.71 Python/2.7.15rc1 Linux/4.15.0-29-generic botocore/1.10.70
2018-08-06 21:47:58,430 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['dynamodb', 'create-table', '--cli-input-json', 'file://cli-input-json/dynamodb-create-table-contact.json', '--debug']
2018-08-06 21:47:58,430 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x7f0f6698e1b8>
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x7f0f68685668>
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f0f63b267d0>
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable credentials_file from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable config_file from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_timeout from defaults.
2018-08-06 21:47:58,430 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,431 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_num_attempts from defaults.
2018-08-06 21:47:58,431 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,431 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x7f0f6372b0c8>
2018-08-06 21:47:58,431 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,431 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,431 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2018-08-06 21:47:58,432 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/dynamodb/2012-08-10/service-2.json
2018-08-06 21:47:58,442 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.dynamodb: calling handler <function register_retries_for_service at 0x7f0f648a6cf8>
2018-08-06 21:47:58,443 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: dynamodb
2018-08-06 21:47:58,445 - MainThread - botocore.hooks - DEBUG - Event building-command-table.dynamodb: calling handler <function add_waiters at 0x7f0f669975f0>
2018-08-06 21:47:58,447 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/dynamodb/2012-08-10/waiters-2.json
2018-08-06 21:47:58,448 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'attribute-definitions', <awscli.arguments.ListArgument object at 0x7f0f6324c650>), (u'table-name', <awscli.arguments.CLIArgument object at 0x7f0f6324c690>), (u'key-schema', <awscli.arguments.ListArgument object at 0x7f0f6324c6d0>), (u'local-secondary-indexes', <awscli.arguments.ListArgument object at 0x7f0f6324c710>), (u'global-secondary-indexes', <awscli.arguments.ListArgument object at 0x7f0f6324c750>), (u'provisioned-throughput', <awscli.arguments.CLIArgument object at 0x7f0f6324c790>), (u'stream-specification', <awscli.arguments.CLIArgument object at 0x7f0f6324c7d0>), (u'sse-specification', <awscli.arguments.CLIArgument object at 0x7f0f6324c810>)])
2018-08-06 21:47:58,448 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function add_streaming_output_arg at 0x7f0f6698e7d0>
2018-08-06 21:47:58,448 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function add_cli_input_json at 0x7f0f63b2e488>
2018-08-06 21:47:58,448 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function unify_paging_params at 0x7f0f66a1d6e0>
2018-08-06 21:47:58,451 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/dynamodb/2012-08-10/paginators-1.json
2018-08-06 21:47:58,451 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.create-table: calling handler <function add_generate_skeleton at 0x7f0f66a091b8>
2018-08-06 21:47:58,451 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.dynamodb.create-table: calling handler <bound method CliInputJSONArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7f0f6324c850>>
2018-08-06 21:47:58,451 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.dynamodb.create-table: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f0f6324ca10>>
2018-08-06 21:47:58,452 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.attribute-definitions: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,452 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.table-name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,452 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.key-schema: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,452 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.local-secondary-indexes: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,452 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.global-secondary-indexes: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,452 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.provisioned-throughput: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,453 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.stream-specification: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,453 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.sse-specification: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,453 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,453 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.create-table.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f0f632febd0>
2018-08-06 21:47:58,453 - MainThread - botocore.hooks - DEBUG - Event calling-command.dynamodb.create-table: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7f0f6324c850>>
2018-08-06 21:47:58,453 - MainThread - botocore.hooks - DEBUG - Event calling-command.dynamodb.create-table: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f0f6324ca10>>
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable region from config file with value 'us-east-1'.
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable ca_bundle from defaults.
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,453 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2018-08-06 21:47:58,453 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2018-08-06 21:47:58,454 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2018-08-06 21:47:58,454 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2018-08-06 21:47:58,454 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2018-08-06 21:47:58,454 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python2.7/dist-packages/botocore/data/endpoints.json
2018-08-06 21:47:58,468 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:58,468 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f0f648a6500>
2018-08-06 21:47:58,469 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.dynamodb: calling handler <function add_generate_presigned_url at 0x7f0f648dbaa0>
2018-08-06 21:47:58,469 - MainThread - botocore.args - DEBUG - The s3 config key is not a dictionary type, ignoring its value of: None
2018-08-06 21:47:58,471 - MainThread - botocore.endpoint - DEBUG - Setting dynamodb timeout as (60, 60)
2018-08-06 21:47:58,472 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: dynamodb
2018-08-06 21:47:58,472 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.dynamodb.CreateTable: calling handler <function generate_idempotent_uuid at 0x7f0f648a6758>
2018-08-06 21:47:58,473 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=CreateTable) (verify_ssl=True) with params: {'body': '{"ProvisionedThroughput": {"WriteCapacityUnits": 5, "ReadCapacityUnits": 5}, "TableName": "contact", "AttributeDefinitions": [{"AttributeName": "id", "AttributeType": "N"}], "KeySchema": [{"KeyType": "HASH", "AttributeName": "id"}]}', 'url': u'https://dynamodb.us-east-1.amazonaws.com/', 'headers': {'User-Agent': 'aws-cli/1.15.71 Python/2.7.15rc1 Linux/4.15.0-29-generic botocore/1.10.70', 'Content-Type': u'application/x-amz-json-1.0', 'X-Amz-Target': u'DynamoDB_20120810.CreateTable'}, 'context': {'auth_type': None, 'client_region': 'us-east-1', 'has_streaming_input': False, 'client_config': <botocore.config.Config object at 0x7f0f62e38ed0>}, 'query_string': '', 'url_path': '/', 'method': u'POST'}
2018-08-06 21:47:58,473 - MainThread - botocore.hooks - DEBUG - Event request-created.dynamodb.CreateTable: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f0f62e38e50>>
2018-08-06 21:47:58,473 - MainThread - botocore.hooks - DEBUG - Event choose-signer.dynamodb.CreateTable: calling handler <function set_operation_specific_signer at 0x7f0f648a6668>
2018-08-06 21:47:58,473 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2018-08-06 21:47:58,474 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.0
host:dynamodb.us-east-1.amazonaws.com
x-amz-date:20180806T114758Z
x-amz-target:DynamoDB_20120810.CreateTable

content-type;host;x-amz-date;x-amz-target
117c1e1d1e96b738ef5fea5ff0048057da79f40ddc76e6a870658895c676a166
2018-08-06 21:47:58,474 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20180806T114758Z
20180806/us-east-1/dynamodb/aws4_request
5c77113970d7a14f695b36aaa04c58708956b76d1445cdb7049eb06c93585da7
2018-08-06 21:47:58,474 - MainThread - botocore.auth - DEBUG - Signature:
bd8d655c5551ae561e946d990507f1bff46d00193db90176d3c9e5abd51296cd
2018-08-06 21:47:58,475 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [POST]>
2018-08-06 21:47:58,475 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): dynamodb.us-east-1.amazonaws.com
2018-08-06 21:47:59,525 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST / HTTP/1.1" 200 474
2018-08-06 21:47:59,526 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-requestid': 'P0HS2R8B7M0ODJETM37D4R0PO3VV4KQNSO5AEMVJF66Q9ASUAAJG', 'content-length': '474', 'server': 'Server', 'connection': 'keep-alive', 'x-amz-crc32': '2912022485', 'date': 'Mon, 06 Aug 2018 11:47:59 GMT', 'content-type': 'application/x-amz-json-1.0'}
2018-08-06 21:47:59,527 - MainThread - botocore.parsers - DEBUG - Response body:
{"TableDescription":{"AttributeDefinitions":[{"AttributeName":"id","AttributeType":"N"}],"CreationDateTime":1.533556079401E9,"ItemCount":0,"KeySchema":[{"AttributeName":"id","KeyType":"HASH"}],"ProvisionedThroughput":{"NumberOfDecreasesToday":0,"ReadCapacityUnits":5,"WriteCapacityUnits":5},"TableArn":"arn:aws:dynamodb:us-east-1:482175935212:table/contact","TableId":"0cb8555c-800a-4403-a675-a7683d688dda","TableName":"contact","TableSizeBytes":0,"TableStatus":"CREATING"}}
2018-08-06 21:47:59,531 - MainThread - botocore.hooks - DEBUG - Event needs-retry.dynamodb.CreateTable: calling handler <botocore.retryhandler.RetryHandler object at 0x7f0f62fbf410>
2018-08-06 21:47:59,531 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2018-08-06 21:47:59,532 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:59,532 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2018-08-06 21:47:59,532 - MainThread - botocore.session - DEBUG - Loading variable output from config file with value 'json'.
2018-08-06 21:47:59,532 - MainThread - awscli.formatter - DEBUG - RequestId: P0HS2R8B7M0ODJETM37D4R0PO3VV4KQNSO5AEMVJF66Q9ASUAAJG
{
    "TableDescription": {
        "TableArn": "arn:aws:dynamodb:us-east-1:482175935212:table/contact", 
        "AttributeDefinitions": [
            {
                "AttributeName": "id", 
                "AttributeType": "N"
            }
        ], 
        "ProvisionedThroughput": {
            "NumberOfDecreasesToday": 0, 
            "WriteCapacityUnits": 5, 
            "ReadCapacityUnits": 5
        }, 
        "TableSizeBytes": 0, 
        "TableName": "contact", 
        "TableStatus": "CREATING", 
        "TableId": "0cb8555c-800a-4403-a675-a7683d688dda", 
        "KeySchema": [
            {
                "KeyType": "HASH", 
                "AttributeName": "id"
            }
        ], 
        "ItemCount": 0, 
        "CreationDateTime": 1533556079.401
    }
}
bing@bingstp:~/git/aws-serverless-roundtrip-option1$ 

And the content of the JSON file:

bing@bingstp:~/git/aws-serverless-roundtrip-option1$ cat cli-input-json/dynamodb-create-table-contact.json 
{
    "TableName": "contact",
    "AttributeDefinitions": [{
        "AttributeName": "id",
        "AttributeType": "N"
    }],
    "ProvisionedThroughput": {
        "WriteCapacityUnits": 5,
        "ReadCapacityUnits": 5
    },
    "KeySchema": [{
        "KeyType": "HASH",
        "AttributeName": "id"
    }]
}bing@bingstp:~/git/aws-serverless-roundtrip-option1$ 

As a "for your consideration" to the aws-cli team: several utilities (including curl) choose to use an @ prefix after an option value to signal that the option should contain the dereferenced filename rather than the string literal beginning with @. I think that would be a huge improvement, if for no other reason than it's shorter than file://.

@mdaniel - Thank you for your feedback. I am labeling this as confusing error pending further investigation.

@bingtimren & @mdaniel - I'm looking into what areas in our documentation could be improved. Please let us know what other documentation was reviewed other than studying the documents from "aws dynamodb create-table help".

I cannot remember what other documentation was reviewed other than studying the command line help, but I guess must be the official document:

https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-skeleton.html

Or most probably from Google search.

Same confusing generic error is occurring with the codepipeline create-pipeline command:

aws codepipeline create-pipeline --cli-input-json pipeline.json

It works if you change to:

aws codepipeline create-pipeline --cli-input-json file://pipeline.json

It's confusing as most cli tools don't require the file:// prefix, I guess that's because you can supply an http source. But either way the message could be clearer e.g. File not found?

+1 for the sheer weirdness of having to prepend file:// to my filename. Doing this fixed the problem.

I spent 2 hours looking around and finally found out it's the missing file://. It's a "see it but not perceive it" issue.
I suggest simply improve the error message from Error parsing parameter 'cli-input-json': Invalid JSON received. to Error parsing parameter 'cli-input-json': Invalid JSON received. You might miss the prefix "file://" or "https://".

I found the word parsing was the thing that misled me. I though it was a missing comma or so and jumped to check the json file format immediately.

The file:// is even weird when operating in awscli's docker container.

You'll need triple slash file:///data/... for a file at directory /data, while it's common to consider an absolute path /data is represented as file://data.

Example for such command: docker run --rm -it -v ~/.aws:/root/.aws -v $(pwd):/data amazon/aws-cli dynamodb create-table --cli-input-json file:///data/min_schema.json

Was this page helpful?
0 / 5 - 0 ratings