設定ファイルを以下のように作成して
~/.aws/credentials
[default]
aws_access_key_id = xxxxxx
aws_secret_access_key = yyyyy
region = ap-northeast-1
以下を実行すると Missing region in config
で怒られる
const AWS = require('aws-sdk')
const config = AWS.Config
const eb = new AWS.ElasticBeanstalk()
eb.describeEnvironments({EnvironmentNames: ['hogehoge']}, (err, data) => {
console.log(err)
console.log(data)
})
$ node app.js
{ ConfigError: Missing region in config
....
configファイルを使う場合は AWS_SDK_LOAD_CONFIG=true
を設定してあげる必要があるみたい
$ env AWS_SDK_LOAD_CONFIG=true node app.js
参考: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-region.html