You need to provide credentials to AWS so that only your account and its resources are accessed by the SDK. To hold this information, we recommend you create a shared credentials file.
Your credentials file should resemble the following example.
[default] aws_access_key_id = YOUR_ACCESS_KEY_ID aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
You can determine whether you have set your credentials correctly by executing the following code with node:
var AWS = require("aws-sdk"); AWS.config.getCredentials(function(err) { if (err) console.log(err.stack); // credentials not loaded else { console.log("Access key:", AWS.config.credentials.accessKeyId); console.log("Secret access key:", AWS.config.credentials.secretAccessKey); } });
Similarly, if you have set your region correctly in your config file, you can display that value by setting the ‘AWS_SDK_LOAD_CONFIG’ environment variable to a truthy value and using the following code:
export AWS_SDK_LOAD_CONFIG=1
var AWS = require("aws-sdk"); console.log("Region: ", AWS.config.region);