Amazon CLI:此请求缺少必需的 header:x-amz-content-sha256

Amazon CLI: Missing required header for this request: x-amz-content-sha256

正在尝试在 Transcribe 中启动 StartTranscriptionJob

我的要求是:

aws transcribe start-transcription-job 
--endpoint-url https://s3.amazonaws.com/ 
--region us-east-1 
--cli-input-json file://D:\awstr.json

JSON 文件 (D:\awstr.json) 是:

{
    "TranscriptionJobName": "awrtest05",
    "LanguageCode": "en-US",
    "MediaFormat": "mp3",
    "Media": {
        "MediaFileUri": "https://s3.amazonaws.com/temp-awr-store6/m1406.mp3"
    }
}

配置文件是:

[default]
output = json
region = us-east-1

CLI 响应是:

An error occurred (400) when calling the StartTranscriptionJob operation: 
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidRequest</Code>
<Message>Missing required header for this request: x-amz-content-sha256</Message> ... 

我找到了答案。

应该是这样

>aws transcribe start-transcription-job --transcription-job-name "b1447" --language-code "en-US" --media-format "mp3" --media MediaFileUri="https://s3.us-east-1.amazonaws.com/temp-awr-sto
re6/m140_16_33.mp3"

答案是

{
    "TranscriptionJob": {
        "TranscriptionJobName": "b1447",
        "LanguageCode": "en-US",
        "TranscriptionJobStatus": "IN_PROGRESS",
        "Media": {
            "MediaFileUri": "https://s3.us-east-1.amazonaws.com/temp-awr-store6/m140_16_33.mp3"
        },
        "CreationTime": 1516712027.388,
        "MediaFormat": "mp3"
    }
}