get-iam-creds
Advanced tools
Comparing version 0.0.1 to 0.0.2
21
index.js
@@ -18,20 +18,9 @@ // TODO are we catching *all* the errors? | ||
}; | ||
if (region) { | ||
setRegion(region); | ||
} else { | ||
// brittle method to obtain region: shave last char off of AZ. | ||
// example: 'us-west-2a' => 'us-west-2'. | ||
// no other way exists unless we insert that via config mgmt. | ||
imd.Get({Version: 'latest', Category: '/meta-data/placement/availability-zone' }, function(err, data) { | ||
if (err) return cb(err); | ||
var region = data.Body.substr(0, data.Body.length-1); | ||
setRegion(region); | ||
}); | ||
} | ||
imd.Get({Version: 'latest', Category: '/dynamic/instance-identity/document'}, function(err, data) { | ||
if (err) return cb(err); | ||
creds.region = JSON.parse(data.Body).region; | ||
cb(null, creds); | ||
}); | ||
}); | ||
}); | ||
function setRegion(region) { | ||
creds.region = region; | ||
cb(null, creds); | ||
} | ||
}; |
{ | ||
"name": "get-iam-creds", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Tiny module to fetch IAM creds from IMD", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,7 +13,2 @@ get-iam-creds | ||
Note: fetching the region is kinda brittle, so you may optionally pass | ||
the region in as the second argument. If it's not passed in, then we'll | ||
get the availability zone from IMD, shave off the last char, and use that. | ||
If you only use one region, there's no need to do that API hit anyway. | ||
## Example. | ||
@@ -28,5 +23,1 @@ ### before: | ||
getIamCreds(function(err, creds) { new CloudWatch(creds) }); | ||
#### or, in single region installs: | ||
getIamCreds(function(err, creds) { new CloudWatch(creds) }, 'us-west-2'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2274
25
22