尝试初始化AWS Amplify时出现OptInRequired错误

时间:2019-03-03 21:24:00

标签: amazon-web-services aws-amplify

我刚刚开始使用AWS Amplify。我已经安装并配置了CLI,并且正在尝试初始化项目。但是,进行选择后,出现以下错误:

Edwards-MacBook-Air:amplify-js-app edward$ amplify init
Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project amplify-js-app
? Enter a name for the environment env
? Choose your default editor: Visual Studio Code
? Choose the type of app that you're building javascript
Please tell us about your project
? What javascript framework are you using none
? Source Directory Path:  src
? Distribution Directory Path: dist
? Build Command:  npm run-script build
? Start Command: npm run-script start
Using default provider  awscloudformation

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html

? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use default
⠧ Initializing project in the cloud...An error occurred when creating the CloudFormation stack
✖ Root stack creation failed
init failed
{ OptInRequired: The AWS Access Key Id needs a subscription for the service
    at Request.extractError (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/Users/edward/.config/yarn/global/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
  message: 'The AWS Access Key Id needs a subscription for the service',
  code: 'OptInRequired',
  time: 2019-03-03T21:14:34.638Z,
  requestId: '581c6e4a-3df9-11e9-8269-59b4c2d8d7d2',
  statusCode: 403,
  retryable: false,
  retryDelay: 21.790819558046604 }

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

这通常与新帐户,更新的付款方式或未经验证的电话号码有关。登录到控制台,并确保您没有任何通知或警报。如果您看不到任何东西,建议您拨打AWS账单。