签名与使用Node.js SDK的AWS不匹配

时间:2014-09-03 23:40:48

标签: node.js amazon-web-services

我无法使用简单的AWS Node.js EC2示例。这是我的代码:

var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
new AWS.EC2().describeInstances(function(err, data) {
    if (err) {
        console.log(err);
    } else {
        console.log(data);
    }
});

运行时出现的错误如下所示:

{ [SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.]
  message: 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.',
  code: 'SignatureDoesNotMatch',
  time: Wed Sep 03 2014 16:29:37 GMT-0700 (PDT),
  statusCode: 403,
  retryable: false }

为什么我会收到此错误,如何解决?

我在Ubuntu 14.04.1 LTS 64位桌面上使用Node.js v0.10.31。

下载完整示例herehere

在此处交叉:https://forums.aws.amazon.com/thread.jspa?threadID=160122

1 个答案:

答案 0 :(得分:0)

sudo pip install awscli解决了这个问题。

aws --version现在返回aws-cli/1.7.14 Python/2.7.6 Linux/3.13.0-49-generic