1
votes

I am trying to initialise amplify by doing

$ amplify init

in an Android project. Somehow, every time the setup is failing with the following stacktrace:

⠹ Initializing project in the cloud...An error occurred when creating the CloudFormation stack ✖ Root stack creation failed init failed { InvalidClientTokenId: The security token included in the request is invalid. at Request.extractError (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/protocol/query.js:47:29) at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:109:20) at Request.emit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:81:10) at Request.emit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/request.js:683:14) at Request.transition (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/state_machine.js:14:12) at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request. (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/request.js:38:9) at Request. (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/request.js:685:12) at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:119:18) message: 'The security token included in the request is invalid.',
code: 'InvalidClientTokenId', time: 2018-10-30T12:24:49.192Z,
requestId: 'cb4cc85a-dc3e-11e8-ad2e-1dd03551193d', statusCode: 403, retryable: false, retryDelay: 71.00058281764416 } An error occurred when creating the CloudFormation stack

I tried deleting credentials and config files in ~/.aws/ folder along with deleting the AWS IAM user and running

$ aws configure 

again followed by the init command but nothing helped. Don't know what is wrong.

2

2 Answers

3
votes

I solved the problem in a weird way. May be it helps someone else. It turns out that I am able to get rid of the error after reinstalling amplify cli:

$ sudo npm install -g @aws-amplify/cli
1
votes

My problem was that I needed to finish setting up my AWS account and add credit card info and finish the setup process on the AWS website.