search
LoginSignup
1
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

apex initでIAMを作る段階でError: creating role: NoCredentialProvidersが出る時の対処法

AWS lambdaのデプロイ自動化ツールApexですが、initの段階でちょっと躓きました。
apex initするとcredential関連でエラー。

$ apex init


             _    ____  _______  __
            / \  |  _ \| ____\ \/ /
           / _ \ | |_) |  _|  \  /
          / ___ \|  __/| |___ /  \
         /_/   \_\_|   |_____/_/\_\



  Enter the name of your project. It should be machine-friendly, as this
  is used to prefix your functions in Lambda.

    Project name: shirakia-test

  Enter an optional description of your project.

    Project description: 

  [+] creating IAM hoge_lambda_function role
   ⨯ Error: creating role: NoCredentialProviders: no valid providers in chain. Deprecated.
        For verbose messaging see aws.Config.CredentialsChainVerboseErrors

.aws/configaws_access_key_idaws_secret_access_keyが書いてあっても読んでくれないようだった。
aws_access_key_idaws_secret_access_key.aws/credentialsに移動したら解決。
~/.aws/credentialsの中身は以下のような感じ
[default]
aws_access_key_id = xxxxxxxxxxxxxx
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

または、
export AWS_SDK_LOAD_CONFIG=1

とすると.aws/configの中に書いたままでも読んでくれる。
Apexがaws-sdk-goに依存しており、そっち対応が必要だったという話。

参考

https://github.com/apex/apex/issues/426
https://github.com/aws/aws-sdk-go#aws-shared-config-file-awsconfig

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
1
Help us understand the problem. What are the problem?