3

所以我有多个帐户用于我的不同环境,当我尝试创建一个新阶段时,我得到“存储桶存在,你没有权限”。检查我的 AWS 权限后,我的开发和测试是相同的;知道为什么会发生这种情况吗?

对于开发人员,我对创建没有任何问题;cf,s3 存储桶,sls 文件夹内的项目。

对于测试,我收到上述错误;存储桶不存在但它说存储桶存在并且我没有权限。

首轮:

yaos-imac:serverless yao$ sls project create
 _______                             __
|   _   .-----.----.--.--.-----.----|  .-----.-----.-----.
|   |___|  -__|   _|  |  |  -__|   _|  |  -__|__ --|__ --|
|____   |_____|__|  \___/|_____|__| |__|_____|_____|_____|
|   |   |             The Serverless Application Framework
|       |                           serverless.com, v0.5.0
`-------'

Serverless: Initializing Serverless Project...
Serverless: Enter a name for this project:  (serverless-vkkxnm) planet-express
Serverless: Enter a unique project bucket name (using a domain is recommended):  (serverless-vkkxnm.com) sls.planet-express.com
Serverless: Pick the primary region for your project:
  > us-east-1
    us-west-2
    eu-west-1
    ap-northeast-1
Serverless: Do you want to create a new stage and region for this project?
  > Yes
    No
Serverless: Enter a new stage name for this project:  dev
Serverless: For the "dev" stage, do you want to use an existing Amazon Web Services profile or create a new one?
  > Existing Profile
    Create A New Profile
Serverless: Select a profile for your project:
  > dev
    test
Serverless: Creating stage "dev"...
Serverless: Creating region "us-east-1" in stage "dev"...
Serverless: Deploying resources to stage "dev" in region "us-east-1" via Cloudformation (~3 minutes)...
Serverless: / Serverless: Creating your project bucket on S3: sls.planet-express.com...
Serverless: Successfully deployed "dev" resources to "us-east-1"
Serverless: Successfully created region "us-east-1" within stage "dev"
Serverless: Successfully created stage "dev"
Serverless: Successfully initialized project "planet-express"

现在我尝试创建一个新阶段:

yaos-imac:planet-express yao$ sls stage create
Serverless: Enter a new stage name for this project:  test
Serverless: For the "test" stage, do you want to use an existing Amazon Web Services profile or create a new one?
  > Existing Profile
    Create A New Profile
Serverless: Select a profile for your project:
    dev
  > test
Serverless: Creating stage "test"...
Serverless: Select a new region for your existing stage:
  > us-east-1
    us-west-2
    eu-west-1
    ap-northeast-1
Serverless: Creating region "us-east-1" in stage "test"...
Serverless: Deploying resources to stage "test" in region "us-east-1" via Cloudformation (~3 minutes)...
/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:49
        fn = function () { throw arg; };
                           ^

ServerlessError: ServerlessError: S3 Bucket "sls.planet-express.com" already exists and you do not have permissions to use it
    at new ServerlessError (/Users/yao/.node/lib/node_modules/serverless/lib/Error.js:17:11)
    at ResourcesDeploy.<anonymous> (/Users/yao/.node/lib/node_modules/serverless/lib/actions/ResourcesDeploy.js:252:21)
    at ResourcesDeploy.tryCatcher (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:680:18)
    at Async._drainQueue (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:126:16)
    at Async._drainQueues (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/yao/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:368:17)
4

1 回答 1

2

正如评论中已经回答的那样,存储桶名称是全球唯一的。如果您使用一个 AWS 账户创建了一个项目,则不能使用另一个 AWS 账户在同一项目中添加新阶段,因为存储桶名称将不可用,即使它位于另一个 AWS 区域中。

根据文档

无论您在哪个 AWS 区域中创建存储桶,Amazon S3 存储桶名称都是全球唯一的。


在 S3 中托管静态网站时,这是一个大问题,因为存储桶名称必须与域名匹配。如果存储桶名称已被占用,则无法将其托管在那里。

于 2016-05-08T01:11:45.550 回答