amazon web services – AWS CLI: Error parsing parameter ‘cli-input-json’: Invalid JSON received

I am trying to pass a json file as parameters to aws cli command but am greeted with an error:
Error parsing parameter ‘cli-input-json’: Invalid JSON received.
Which stems from the error:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I am using the latest AWS CLI version I am running the commands through windows powershell.

The command I am running is:
aws quicksight create-data-source --cli-input-json file://mytemplate.json --debug

The json file I am parsing [mytemplate.json]is generated from the –generate-cli-skeleton command:
aws quicksight create-data-source --generate-cli-skeleton > mytemplate.json

The error I get from debug output I get is:

2022-04-21 14:14:35,115 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.5.7 Python/3.9.11 Windows/10 exe/AMD64
2022-04-21 14:14:35,115 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['quicksight', 'create-data-source', '--cli-input-json', 'file://mytemplate.json', '--debug']
2022-04-21 14:14:35,171 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_s3 at 0x0000022F31F308B0>
2022-04-21 14:14:35,172 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_ddb at 0x0000022F31D89790>
2022-04-21 14:14:35,172 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.configure.configure.ConfigureCommand'>>
2022-04-21 14:14:35,172 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x0000022F31D2BAF0>
2022-04-21 14:14:35,172 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x0000022F31D32C10>
2022-04-21 14:14:35,172 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function alias_opsworks_cm at 0x0000022F31F44280>
2022-04-21 14:14:35,172 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_history_commands at 0x0000022F31DD53A0>
2022-04-21 14:14:35,173 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.devcommands.CLIDevCommand'>>
2022-04-21 14:14:35,174 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_waiters at 0x0000022F31F3C4C0>
2022-04-21 14:14:35,174 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:Program FilesAmazonAWSCLIV2awsclidatacli.json
2022-04-21 14:14:35,179 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_types at 0x0000022F31E86280>
2022-04-21 14:14:35,179 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function no_sign_request at 0x0000022F31E86DC0>
2022-04-21 14:14:35,179 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_verify_ssl at 0x0000022F31E86D30>
2022-04-21 14:14:35,179 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_read_timeout at 0x0000022F31E86EE0>
2022-04-21 14:14:35,179 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_connect_timeout at 0x0000022F31E86E50>
2022-04-21 14:14:35,180 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <built-in method update of dict object at 0x0000022F31FDD3C0>
2022-04-21 14:14:35,181 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.5.7 Python/3.9.11 Windows/10 exe/AMD64 prompt/off
2022-04-21 14:14:35,181 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['quicksight', 'create-data-source', '--cli-input-json', 'file://mytemplate.json', '--debug']
2022-04-21 14:14:35,181 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x0000022F31F30EE0>
2022-04-21 14:14:35,182 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x0000022F31A89CA0>
2022-04-21 14:14:35,182 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x0000022F31FA1700>
2022-04-21 14:14:35,183 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x0000022F31A75160>
2022-04-21 14:14:35,183 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x0000022F31B37B80>
2022-04-21 14:14:35,184 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2022-04-21 14:14:35,185 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x0000022F31DD5280>
2022-04-21 14:14:35,185 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x0000022F31D87670>
2022-04-21 14:14:35,238 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:Program FilesAmazonAWSCLIV2awsclibotocoredataquicksight2018-04-01service-2.json
2022-04-21 14:14:35,253 - MainThread - botocore.hooks - DEBUG - Event building-command-table.quicksight: calling handler <function add_waiters at 0x0000022F31F3C4C0>
2022-04-21 14:14:35,306 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('aws-account-id', <awscli.arguments.CLIArgument object at 0x0000022F322C9340>), ('data-source-id', <awscli.arguments.CLIArgument object at 0x0000022F322C9550>), ('name', <awscli.arguments.CLIArgument object at 0x0000022F322C9580>), ('type', <awscli.arguments.CLIArgument object at 0x0000022F322C95B0>), ('data-source-parameters', <awscli.arguments.CLIArgument object at 0x0000022F322C9610>), ('credentials', <awscli.arguments.CLIArgument object at 0x0000022F322C95E0>), ('permissions', <awscli.arguments.ListArgument object at 0x0000022F322C9640>), ('vpc-connection-properties', <awscli.arguments.CLIArgument object at 0x0000022F322C9670>), ('ssl-properties', <awscli.arguments.CLIArgument object at 0x0000022F322C96A0>), ('tags', <awscli.arguments.ListArgument object at 0x0000022F322C96D0>)])
2022-04-21 14:14:35,307 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.quicksight.create-data-source: calling handler <function add_streaming_output_arg at 0x0000022F31F351F0>
2022-04-21 14:14:35,307 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.quicksight.create-data-source: calling handler <function add_cli_input_json at 0x0000022F31B3C3A0>
2022-04-21 14:14:35,307 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.quicksight.create-data-source: calling handler <function add_cli_input_yaml at 0x0000022F31B3C5E0>
2022-04-21 14:14:35,308 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.quicksight.create-data-source: calling handler <function unify_paging_params at 0x0000022F31D89D30>
2022-04-21 14:14:35,376 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:Program FilesAmazonAWSCLIV2awsclibotocoredataquicksight2018-04-01paginators-1.json
2022-04-21 14:14:35,377 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:Program FilesAmazonAWSCLIV2awsclibotocoredataquicksight2018-04-01paginators-1.sdk-extras.json
2022-04-21 14:14:35,377 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.quicksight.create-data-source: calling handler <function add_generate_skeleton at 0x0000022F31E7D820>
2022-04-21 14:14:35,378 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.quicksight.create-data-source: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x0000022F322C97C0>>
2022-04-21 14:14:35,378 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.quicksight.create-data-source: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x0000022F322C97F0>>
2022-04-21 14:14:35,379 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.quicksight.create-data-source: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x0000022F322C99A0>>
2022-04-21 14:14:35,382 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.aws-account-id: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,383 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.data-source-id: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,383 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,383 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.type: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,383 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.data-source-parameters: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,383 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.credentials: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,384 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.permissions: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,384 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.vpc-connection-properties: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,384 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.ssl-properties: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,384 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.tags: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,384 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,385 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.cli-input-yaml: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,385 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.quicksight.create-data-source.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x0000022F3201C220>
2022-04-21 14:14:35,385 - MainThread - botocore.hooks - DEBUG - Event calling-command.quicksight.create-data-source: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x0000022F322C97C0>>
2022-04-21 14:14:35,386 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awsclicustomizationscliinput.py", line 128, in _load_parameters
  File "json__init__.py", line 346, in loads
  File "jsondecoder.py", line 337, in decode
  File "jsondecoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "awscliclidriver.py", line 459, in main
  File "awscliclidriver.py", line 594, in __call__
  File "awscliclidriver.py", line 746, in __call__
  File "awscliclidriver.py", line 849, in _emit_first_non_none_response
  File "awsclibotocoresession.py", line 677, in emit_first_non_none_response
  File "awsclibotocorehooks.py", line 228, in emit
  File "awsclibotocorehooks.py", line 211, in _emit
  File "awsclicustomizationscliinput.py", line 63, in add_to_call_parameters
  File "awsclicustomizationscliinput.py", line 130, in _load_parameters
awscli.argprocess.ParamError: Error parsing parameter 'cli-input-json': Invalid JSON received.

Any help is appreciated.

mytemplate.json:

{
    "AwsAccountId":"1234",
    "DataSourceId":"id123",
    "Name":"default-name",
    "Type":"S3",
    "DataSourceParameters":{
       "AmazonElasticsearchParameters":{
          "Domain":""
       },
       "AthenaParameters":{
          "WorkGroup":""
       },
       "AuroraParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "AuroraPostgreSqlParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "AwsIotAnalyticsParameters":{
          "DataSetName":""
       },
       "JiraParameters":{
          "SiteBaseUrl":""
       },
       "MariaDbParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "MySqlParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "OracleParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "PostgreSqlParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "PrestoParameters":{
          "Host":"",
          "Port":0,
          "Catalog":""
       },
       "RdsParameters":{
          "InstanceId":"",
          "Database":""
       },
       "RedshiftParameters":{
          "Host":"",
          "Port":0,
          "Database":"",
          "ClusterId":""
       },
       "S3Parameters":{
          "ManifestFileLocation":{
             "Bucket":"test",
             "Key":"lib"
          }
       },
       "ServiceNowParameters":{
          "SiteBaseUrl":""
       },
       "SnowflakeParameters":{
          "Host":"",
          "Database":"",
          "Warehouse":""
       },
       "SparkParameters":{
          "Host":"",
          "Port":0
       },
       "SqlServerParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "TeradataParameters":{
          "Host":"",
          "Port":0,
          "Database":""
       },
       "TwitterParameters":{
          "Query":"",
          "MaxRows":0
       },
       "AmazonOpenSearchParameters":{
          "Domain":""
       },
       "ExasolParameters":{
          "Host":"",
          "Port":0
       }
    },
    "Credentials":{
       "CredentialPair":{
          "Username":"",
          "Password":"",
          "AlternateDataSourceParameters":[
             {
                "AmazonElasticsearchParameters":{
                   "Domain":""
                },
                "AthenaParameters":{
                   "WorkGroup":""
                },
                "AuroraParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "AuroraPostgreSqlParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "AwsIotAnalyticsParameters":{
                   "DataSetName":""
                },
                "JiraParameters":{
                   "SiteBaseUrl":""
                },
                "MariaDbParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "MySqlParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "OracleParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "PostgreSqlParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "PrestoParameters":{
                   "Host":"",
                   "Port":0,
                   "Catalog":""
                },
                "RdsParameters":{
                   "InstanceId":"",
                   "Database":""
                },
                "RedshiftParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":"",
                   "ClusterId":""
                },
                "S3Parameters":{
                   "ManifestFileLocation":{
                      "Bucket":"",
                      "Key":""
                   }
                },
                "ServiceNowParameters":{
                   "SiteBaseUrl":""
                },
                "SnowflakeParameters":{
                   "Host":"",
                   "Database":"",
                   "Warehouse":""
                },
                "SparkParameters":{
                   "Host":"",
                   "Port":0
                },
                "SqlServerParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "TeradataParameters":{
                   "Host":"",
                   "Port":0,
                   "Database":""
                },
                "TwitterParameters":{
                   "Query":"",
                   "MaxRows":0
                },
                "AmazonOpenSearchParameters":{
                   "Domain":""
                },
                "ExasolParameters":{
                   "Host":"",
                   "Port":0
                }
             }
          ]
       },
       "CopySourceArn":""
    },
    "Permissions":[
       {
          "Principal":"",
          "Actions":[
             ""
          ]
       }
    ],
    "VpcConnectionProperties":{
       "VpcConnectionArn":""
    },
    "SslProperties":{
       "DisableSsl":true
    },
    "Tags":[
       {
          "Key":"",
          "Value":""
       }
    ]
}

Leave a Comment