使用多个帐户时无法创建新舞台?
Unable to create new stage when using multiple accounts?
所以我有多个帐户用于我的不同环境,当我尝试创建一个新阶段时,我得到 "bucket exists, you dont have permission"。检查我的 AWS 权限后,我的开发和测试是相同的;知道为什么会这样吗?
对于开发,我在创建方面没有任何问题; cf, s3 bucket, 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)
正如已在 中回答的那样,存储桶名称在全球范围内 唯一。如果您使用一个 AWS 账户创建项目,则无法使用另一个 AWS 账户在同一项目中添加新阶段,因为存储桶名称将不可用,即使它位于另一个 AWS 区域。
根据docs:
Amazon S3 bucket names are globally unique, regardless of the AWS
region in which you create the bucket.
在 S3 中托管静态网站时,这是一个大问题,因为存储桶名称必须与域名匹配。如果存储桶名称已被占用,则无法将其托管在那里。
所以我有多个帐户用于我的不同环境,当我尝试创建一个新阶段时,我得到 "bucket exists, you dont have permission"。检查我的 AWS 权限后,我的开发和测试是相同的;知道为什么会这样吗?
对于开发,我在创建方面没有任何问题; cf, s3 bucket, 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)
正如已在
根据docs:
Amazon S3 bucket names are globally unique, regardless of the AWS region in which you create the bucket.
在 S3 中托管静态网站时,这是一个大问题,因为存储桶名称必须与域名匹配。如果存储桶名称已被占用,则无法将其托管在那里。