0

尝试在我的测试站点上使用 AWS Elastic Transcoder 时出现 403 错误,我似乎无法弄清楚问题出在哪里。我检查了我的 IAM 策略和身份池等,但无济于事。

错误:

GET https://elastictranscoder.us-east-1.amazonaws.com/2012-09-25/pipelines/xxxxxxxxxxxxx-xxxxxx 403(禁止) index.html:xxx AccessDeniedException:用户:arn:aws:sts::xxxxxxxxxxxx:假定角色/Cognito_Unauth_Role/CognitoIdentityCredentials 无权执行:elastictranscoder:CreateJob on resource:arn:aws:elastictranscoder:us-east-1:xxxxxxxxxxxx:pipeline/xxxxxxxxxxxxx-xxxxxx

AWS.config.region = ‘xx - xxx - x’; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
  IdentityPoolId: "xx-xxx-x:xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx”,
});

var elastictranscoder = new AWS.ElasticTranscoder();

var button = document.getElementById('button');

button.addEventListener('click', function() {
  var params = {
    PipelineId: ‘xxxxxxxxxxxxxx’,
    /* required */
    Input: {
      Key: “xxxxxxxxxx / xxxxxxx.xxx”
    },
    OutputKeyPrefix: ‘xxxxxxx / ‘,
    Outputs: [{
      Key: ‘xxxx.xxx’,
      PresetId: ‘xxxxxxxxxxxx’,
    }, ],
  };
  elastictranscoder.createJob(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else console.log(data); // successful response
  });
});

4

1 回答 1

0

解决方案!原来我不知道我需要在弹性转码器构造函数的选项部分中包含 AWS 访问密钥和密钥。

var elastictranscoder = new AWS.ElasticTranscoder(options = {
  accessKeyId: 'xxxxxxxxxxxxxx',
  secretAccessKey: 'xxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxxxxx'
} 

于 2019-03-12T07:17:58.300 回答