AWS CLI:解析参数 'cli-input-json' 时出错:收到无效的 JSON
AWS CLI: Error parsing parameter 'cli-input-json': Invalid JSON received
我正在尝试将 json 文件作为参数传递给 aws cli 命令,但遇到错误:
错误解析参数 'cli-input-json':接收到无效 JSON。
这源于错误:
json.decoder.JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
我使用的是最新的 AWS CLI 版本
我是 运行 通过 windows powershell 命令。
我运行的命令是:
aws quicksight create-data-source --cli-input-json file://mytemplate.json --debug
我正在解析[mytemplate.json]的json文件是从--generate-cli-skeleton命令生成的:
aws quicksight create-data-source --generate-cli-skeleton > mytemplate.json
我从调试输出中得到的错误是:
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 Files\Amazon\AWSCLIV2\awscli\data\cli.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 Files\Amazon\AWSCLIV2\awscli\botocore\data\quicksight18-04-01\service-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 Files\Amazon\AWSCLIV2\awscli\botocore\data\quicksight18-04-01\paginators-1.json
2022-04-21 14:14:35,377 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLIV2\awscli\botocore\data\quicksight18-04-01\paginators-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 "awscli\customizations\cliinput.py", line 128, in _load_parameters
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.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 "awscli\clidriver.py", line 459, in main
File "awscli\clidriver.py", line 594, in __call__
File "awscli\clidriver.py", line 746, in __call__
File "awscli\clidriver.py", line 849, in _emit_first_non_none_response
File "awscli\botocore\session.py", line 677, in emit_first_non_none_response
File "awscli\botocore\hooks.py", line 228, in emit
File "awscli\botocore\hooks.py", line 211, in _emit
File "awscli\customizations\cliinput.py", line 63, in add_to_call_parameters
File "awscli\customizations\cliinput.py", line 130, in _load_parameters
awscli.argprocess.ParamError: Error parsing parameter 'cli-input-json': Invalid JSON received.
感谢任何帮助。
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":""
}
]
}
好的,我设法解决了这个问题,所以我也可以 post 这里的解决方案。
问题是由 zero-width 'Unicode Null character' 引起的,由于某种原因,在 运行 aws quicksight create-data-source --generate-cli-skeleton
命令时生成的模板中。
解决方案不是复制和粘贴模板中的文本,而是逐行手动键入。
我不知道为什么这是作为 aws 提供的模板的一部分生成的,或者这是否与我的设置有某种关系,不用说,我不会再次使用这个命令来创建模板来建立我的模式,而是使用 Quicksight CLI documentation 或使用 CLI 中的帮助标志从头开始编写。
我正在尝试将 json 文件作为参数传递给 aws cli 命令,但遇到错误:
错误解析参数 'cli-input-json':接收到无效 JSON。
这源于错误:
json.decoder.JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
我使用的是最新的 AWS CLI 版本 我是 运行 通过 windows powershell 命令。
我运行的命令是:
aws quicksight create-data-source --cli-input-json file://mytemplate.json --debug
我正在解析[mytemplate.json]的json文件是从--generate-cli-skeleton命令生成的:
aws quicksight create-data-source --generate-cli-skeleton > mytemplate.json
我从调试输出中得到的错误是:
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 Files\Amazon\AWSCLIV2\awscli\data\cli.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 Files\Amazon\AWSCLIV2\awscli\botocore\data\quicksight18-04-01\service-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 Files\Amazon\AWSCLIV2\awscli\botocore\data\quicksight18-04-01\paginators-1.json
2022-04-21 14:14:35,377 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLIV2\awscli\botocore\data\quicksight18-04-01\paginators-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 "awscli\customizations\cliinput.py", line 128, in _load_parameters
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.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 "awscli\clidriver.py", line 459, in main
File "awscli\clidriver.py", line 594, in __call__
File "awscli\clidriver.py", line 746, in __call__
File "awscli\clidriver.py", line 849, in _emit_first_non_none_response
File "awscli\botocore\session.py", line 677, in emit_first_non_none_response
File "awscli\botocore\hooks.py", line 228, in emit
File "awscli\botocore\hooks.py", line 211, in _emit
File "awscli\customizations\cliinput.py", line 63, in add_to_call_parameters
File "awscli\customizations\cliinput.py", line 130, in _load_parameters
awscli.argprocess.ParamError: Error parsing parameter 'cli-input-json': Invalid JSON received.
感谢任何帮助。
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":""
}
]
}
好的,我设法解决了这个问题,所以我也可以 post 这里的解决方案。
问题是由 zero-width 'Unicode Null character' 引起的,由于某种原因,在 运行 aws quicksight create-data-source --generate-cli-skeleton
命令时生成的模板中。
解决方案不是复制和粘贴模板中的文本,而是逐行手动键入。
我不知道为什么这是作为 aws 提供的模板的一部分生成的,或者这是否与我的设置有某种关系,不用说,我不会再次使用这个命令来创建模板来建立我的模式,而是使用 Quicksight CLI documentation 或使用 CLI 中的帮助标志从头开始编写。