How to use the MetadataService function from aws-sdk
Find comprehensive JavaScript aws-sdk.MetadataService code examples handpicked from public code repositorys.
GitHub: c6fc/warcannon

9 10 11 12 13 14 15 16 17 18
const region = 'us-east-1'; const s3 = new aws.S3({ region }); const ddb = new aws.DynamoDB({ region }); const meta = new aws.MetadataService(); class WARCannon { constructor() { this.settings = {
21 22 23 24 25 26 27 28 29 30
self.config.credentials = ms; setEmitter(); }); } else { // however if it's set to specify a role, query it specifically. ms = new AWS.MetadataService(); ms.request('/latest/meta-data/iam/security-credentials/' + this.config.iamRole, function(err, rdata) { var data = JSON.parse(rdata); if (err) { console.log('Failed to fetch IAM role credentials: ' + err); }
2 3 4 5 6 7 8 9 10 11
var AWS = require('aws-sdk'); var memoize = require('./lib/util/memoizeWithOptions'); var promisifyAll = require('./lib/util/promisifyAll'); function metadataService(options) { return promisifyAll(new AWS.MetadataService(options)); } /** * Returns an instance of AWS.MetadataService which has Promise methods
GitHub: rapid7/propsd

17 18 19 20 21 22 23 24 25 26
}, opts); /** * Initialize the metadata-service client */ this._service = new Aws.MetadataService({ httpOptions: { timeout: options.timeout }, host: options.host
GitHub: rapid7/tokend

25 26 27 28 29 30 31 32 33 34
if (!!metadata && metadata instanceof AWS.MetadataService) { return metadata; } return new AWS.MetadataService({host: opts.metadata.host}); } /** * Get the instance's region from its metadata
29 30 31 32 33 34 35 36 37 38
class Cloud extends AbstractCloud { constructor(options) { super(CLOUD_PROVIDERS.AWS, options); this.metadata = new AWS.MetadataService(); this.s3 = {}; this.s3FilePrefix = constants.STORAGE_FOLDER_NAME; this.ec2 = {}; this._sessionToken = null;
GitHub: mdstaff/lighthouse

4 5 6 7 8 9 10 11 12
AWS.config.update({ region: 'us-east-1' }); const autoscaling = new AWS.AutoScaling(); const sqs = new AWS.SQS(); const meta = new AWS.MetadataService(); const s3 = new AWS.S3(); const { INSTANCE_ID, SQSQUEUE, AUTOSCALINGGROUP, REPORTBUCKET } = process.env;
GitHub: vivocha/kubsub

12 13 14 15 16 17 18 19 20 21
} function getSeedRetriever(opts:AWSClientOptions, address:string = Client.DEFAULT_ADDRESS):SeedRetriever { return () => { return new Promise((resolve, reject) => { new AWS.MetadataService().request('/latest/dynamic/instance-identity/document', function(err, data) { if (err) { reject(err); } else { resolve(JSON.parse(data));
+ 3 other calls in file
GitHub: slate-studio/dyno

26 27 28 29 30 31 32 33 34 35
const options = { httpOptions: { timeout: 200 }, maxRetries: 1 } const meta = new aws.MetadataService(options) let metadata return new Promise((resolve, reject) => {
32 33 34 35 36 37 38 39 40 41
} if (config.dimensions['InstanceId'] != '') startup(config, startupTime, emitter, logger, units) else { var metadata = new AWS.MetadataService() metadata.request('/latest/meta-data/instance-id', function(err, data) { if (err) { if (config.debug) logger.log('cloudwatch backend could not access meta-data service: ' + err.code)
aws-sdk.S3 is the most popular function in aws-sdk (7245 examples)