How to use the EC2MetadataCredentials function from aws-sdk
Find comprehensive JavaScript aws-sdk.EC2MetadataCredentials code examples handpicked from public code repositorys.
13 14 15 16 17 18 19 20 21 22
// if iamRole is set attempt to fetch credentials from the Metadata Service if (this.config.iamRole) { if (this.config.iamRole == 'any') { // If the iamRole is set to any, then attempt to fetch any available credentials ms = new AWS.EC2MetadataCredentials(); ms.refresh(function(err) { if (err) { console.log('Failed to fetch IAM role credentials: ' + err); } self.config.credentials = ms; setEmitter();
53
80
5
GitHub: Medium/draccus
80 81 82 83 84 85 86 87 88
options.daemon = flags.get('daemon') options.stdout = flags.get('stdout') // Fallback to IAM based credentials. if (!options.accessKeyId) { options.credentials = new AWS.EC2MetadataCredentials({ host: options.metadataServiceHost || '169.254.169.254' }) }
2
10
162
GitHub: guardian/koa-gu
0 1 2 3 4 5 6 7 8 9 10
var AWS = require("aws-sdk"); module.exports = async function({ aws_profile }) { AWS.CredentialProviderChain.defaultProviders = [ function () { return new AWS.EC2MetadataCredentials(); }, function () { return new AWS.SharedIniFileCredentials({ profile: aws_profile ? aws_profile : "interactives",
1
0
0
GitHub: dgracilieri/aws-to-slack
115 116 117 118 119 120 121 122 123 124
// Load AWS credentials from environment AWS.CredentialProviderChain.defaultProviders = [ () => new AWS.EnvironmentCredentials("AWS"), () => new AWS.EnvironmentCredentials("AMAZON"), () => new AWS.SharedIniFileCredentials({ profile: config.profile || "default" }), () => new AWS.EC2MetadataCredentials(), ]; (new AWS.CredentialProviderChain()).resolve((err, cred) => { if (err) {
0
0
0
5 6 7 8 9 10 11 12 13
const region = process.env[`${prefix}_REGION`] ? process.env[`${prefix}_REGION`] : config.region; AWS.CredentialProviderChain.defaultProviders = [ () => new AWS.EnvironmentCredentials(prefix), () => new AWS.SharedIniFileCredentials({ profile: config.profile || 'default' }), () => new AWS.EC2MetadataCredentials() ]; const chain = new AWS.CredentialProviderChain();
0
0
1
+ 13 other calls in file
GitHub: ToolJet/ToolJet
76 77 78 79 80 81 82 83 84 85
const region = sourceOptions['region']; const useRoleArn = sourceOptions['instance_metadata_credentials'] === 'aws_arn_role'; let credentials = null; if (useAWSInstanceProfile) { credentials = new AWS.EC2MetadataCredentials({ httpOptions: { timeout: 5000 } }); } else if (useRoleArn) { const assumeRoleCredentials = await this.getAssumeRoleCredentials(sourceOptions['role_arn']); credentials = new AWS.Credentials( assumeRoleCredentials.accessKeyId,
0
0
147
aws-sdk.S3 is the most popular function in aws-sdk (7245 examples)