我无法将我的ember应用程序部署到AWS / S3并获得Access Denied

时间:2016-05-14 02:33:00

标签: ember.js amazon-s3 web-deployment

我正在尝试将我的ember.js应用程序部署到s3,到目前为止,我已安装:

"ember-cli-deploy-build": "0.1.1",
"ember-cli-deploy-s3": "0.3.0",
"ember-cli-deploy-s3-index": "0.4.0",

我的config/deploy.js看起来像是:

/* jshint node: true */

module.exports = function(deployTarget) {
  var ENV = {
    build: {}
  };

  if (deployTarget === 'development') {
    ENV.build.environment = 'development';

    ENV.plugins = ['s3', 's3-index', 'build'];

    // configure other plugins for development deploy target here
    ENV['s3-index'] = {
        accessKeyId:      "my_access_key_id",
        secretAccessKey:  "my_secret_key_id",
        bucket:           "my-bucket-index",
        region:           "ap-southeast-1"
    };

    // Configure Asset deployment to S3
    ENV['s3'] = {
        accessKeyId:      "my_access_key_id",
        secretAccessKey:  "my_secret_key_id",
        bucket:           "my-bucket-assets",
        region:           "ap-southeast-1"
    };
  }


  if (deployTarget === 'production') {
    ENV.build.environment = 'production';
    // configure other plugins for production deploy target here
  }

  return ENV;
};

现在我通过使用Cyber​​duck将一些文件上传到存储桶(政策和凭据工作正常),确保我的访问密钥ID和我的秘密访问密钥正常工作。

但是当我尝试使用:

进行部署时
⇒  ember deploy development
- AccessDenied: Access Denied
- AccessDenied: Access Denied
    at Request.extractError (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/services/s3.js:350:35)
    at Request.callListeners (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:615:14)
    at Request.transition (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/state_machine.js:14:12)
odules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:617:12)
    at Request.callListeners (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
AccessDenied: Access Denied
AccessDenied: Access Denied
    at Request.extractError (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/services/s3.js:350:35)
    at Request.callListeners (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:615:14)
    at Request.transition (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/request.js:617:12)
    at Request.callListeners (/Users/info/code/my-ember-project/node_modules/ember-cli-deploy-s3/node_modules/aws-sdk/lib/sequential_executor.js:115:18)Pipeline aborted

1 个答案:

答案 0 :(得分:0)

我也遇到了这个问题,我的解决方法是将 acl: null 添加到我的 ENV.s3 凭据中:

    ENV['s3'] = {
        accessKeyId:      "my_access_key_id",
        secretAccessKey:  "my_secret_key_id",
        bucket:           "my-bucket-assets",
        region:           "ap-southeast-1",
        acl:              null  // <-------------- Add this line
    };

您可能还需要将它添加到您的 ENV['s3-index'] 哈希中,但我不确定。