ServerlessFrameworkでdeployを成功させるまでに嵌ったことまとめ

環境

OS: linux
Node Version: 8.12.0
Serverless Version: 1.32.0
Python Version: 3.6

本題

$ sls deploy -v を実行時に発生したエラーで、個人的に解決まで時間がかかったものを書く

The security token included in the request is invalid.

  Serverless Error ---------------------------------------
 
  ServerlessError: The security token included in the request is invalid.
  • ~/.aws/credentials に記載の aws_access_key_idaws_secret_access_key の記述が間違ってた

vim で手動で書いたためミスした

sls config credentials --provider aws --key XXXKEYXXX --secret XXXSECRETXXX とコマンドから発行すれば解決した

User is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation

  Serverless Error ---------------------------------------
 
  ServerlessError: User: arn:aws:iam::XXXXXXXXXX:user/(user名) is not authorized to perform: cloudformation:DescribeStacks on resource: (省略)

同じエラーメッセージに出会った人はいるらしい。

github.com

cloudformation:CreateStack
cloudformation:DescribeStacks
cloudformation:DescribeStackEvents
cloudformation:DescribeStackResources

cloudformationに関しては、けっこう怒られるが、 上記の4つの権限を付与したら解消した。

⇒ このあと、下の③が発生し、これを解決したら

cloudfortmation:ValidateTemplate
cloudfortmation:UpdateStack

の権限がないことで怒られた。

Missing required key 'Bucket' in params

  Serverless Error ---------------------------------------
 
  Missing required key 'Bucket' in params

いい感じに解説してくれている記事は見つからなかったが、

AWSコンソールから「CloudFormation」でスタックを削除したら、問題が解消された

このとき「状況」は「ROLLBACK_FAILED」みたいな赤字表記になっており、Rollbackが途中で止まったっぽい様子だった。

※表記は正しく覚えてない