How to use the config function from aws-sdk
Find comprehensive JavaScript aws-sdk.config code examples handpicked from public code repositorys.
40 41 42 43 44 45 46 47 48 49
} else { core.info(`Setting proxy from environment: ${proxyFromEnv}`); proxyToSet = proxyFromEnv; } aws.config.update({ httpOptions: { agent: proxy(proxyToSet) } }); } }
161
714
23
434 435 436 437 438 439 440 441 442 443 444 445
}; exports.fetch_credentials = async (event, context) => { const awsCredentials = { accessKeyId: AWS.config.credentials.accessKeyId, secretAccessKey: AWS.config.credentials.secretAccessKey, sessionToken: AWS.config.credentials.sessionToken, }; return response(200, 'application/json', JSON.stringify(awsCredentials));
450
638
0
+ 17 other calls in file
274 275 276 277 278 279 280 281 282 283
t.equal(req.body['MessageAttributes.entry.2.Value.StringValue'], 'es=s:1', 'tracestate message attribute StringValue') t.end() }) AWS.config.update({ endpoint: `http://localhost:${port}` }) agent.startTransaction('myTransaction') const publishTextPromise = new AWS.SNS({ apiVersion: '2010-03-31' })
211
536
296
+ 132 other calls in file
772 773 774 775 776 777 778 779 780 781 782 783
return params } function initializeAwsSdk () { // SDk requires a region to be set AWS.config.update({ region: 'us-west' }) // without fake credentials the aws-sdk will attempt to fetch // credentials as though it was on an EC2 instance process.env.AWS_ACCESS_KEY_ID = 'fake-1'
211
536
296
+ 18 other calls in file
37 38 39 40 41 42 43 44 45 46 47 48 49
initializeAwsSdk() function initializeAwsSdk () { // SDk requires a region to be set AWS.config.update({ region: AWS_REGION }) // without fake credentials the aws-sdk will attempt to fetch // credentials as though it was on an EC2 instance process.env.AWS_ACCESS_KEY_ID = 'fake-1'
211
536
296
+ 104 other calls in file
61 62 63 64 65 66 67 68 69 70
// Example with AWS SDK V2: getCredentials: () => new Promise((resolve, reject) => { // Any other method to acquire a new Credentials object can be used. AWS.config.getCredentials((err, credentials) => { if (err) { reject(err); } else { resolve(credentials);
90
121
23
35 36 37 38 39 40 41 42 43 44
const writerWebSocketApiId = findOutput(cloudformationOutputs, 'WriterWebSocketApiId'); const readerWebSocketApiId = findOutput(cloudformationOutputs, 'ReaderWebSocketApiId'); // Delete stages AWS.config.update({ region: awsRegion }); const apigatewayv2 = new AWS.ApiGatewayV2(); const deleteStageWriterParams = { ApiId: writerWebSocketApiId,
18
42
11
4 5 6 7 8 9 10 11 12 13
const delay = require('delay'); const RestAPI = require('./restapi'); const utils = require('./utils'); function APIGateway(options) { AWS.config.region = options.awsRegion || 'us-west-1'; if (options.awsProfile) { // Set the `credentials` property if a profile is provided const objectCredentials = {
2
1
4
+ 3 other calls in file
106 107 108 109 110 111 112 113 114 115
return Promise.resolve({ Account: FAKE_ROLE_ACCOUNT_ID }); } }); aws.config.getCredentials.mockReset(); aws.config.getCredentials .mockImplementationOnce(callback => { if (!aws.config.credentials) { aws.config.credentials = { accessKeyId: FAKE_ACCESS_KEY_ID,
388
0
0
+ 7 other calls in file
99 100 101 102 103 104 105 106 107 108
makeImdsConfigSource(), makeSecretsManagerConfigSource('ConfSecret'), makeAutoScalingGroupConfigSource(), ]); AWS.config.update({ region: loader.config.awsRegion }); }, (callback) => { // Initialize CloudWatch logging if it's enabled if (module.exports.config.useCloudWatchLogging) {
256
256
15
43 44 45 46 47 48 49 50 51 52
return new Promise((resolve, reject) => { AWS.config.credentials.get(function (err) { if (!err) { console.log('Retrieved identity: ' + AWS.config.credentials.identityId) const params = { IdentityId: AWS.config.credentials.identityId } cognitoIdentity.getCredentialsForIdentity(params, function (err, data) { console.log('Creds: ', data) if (!err) {
41
0
0
+ 11 other calls in file
GitHub: SungardAS/aws-services
18 19 20 21 22 23 24 25 26 27
me.findService = function(input) { var params = {region:input.region}; if (input.creds) params.credentials = input.creds; else if (input.profile) { var credentials = new AWS.SharedIniFileCredentials({profile: input.profile}); AWS.config.credentials = credentials; } var ec2 = new AWS.EC2(params); return ec2; }
6
29
21
3 4 5 6 7 8 9 10 11 12
'use strict'; var AWS = require('aws-sdk'); if(!AWS.config.region) { AWS.config.region = 'us-east-1'; } var Resource = { resources: {
5
146
10
69 70 71 72 73 74 75 76 77 78
config.httpOptions = { agent: new PROXY(opts) }; } else { config.httpOptions = { agent: new https.Agent(opts) }; } AWS.config.update(config); this.ec2 = new AWS.EC2(); this.s3 = new AWS.S3(); if (this.storageName) {
1
12
16
GitHub: rapid7/awsaml
16 17 18 19 20 21 22 23 24 25
}); } const region = session.roleArn.includes('aws-us-gov') ? 'us-gov-west-1' : 'us-east-1'; Aws.config.update({region}); const sts = new Aws.STS(); const refreshResponseObj = Object.assign({}, ResponseObj, {
39
130
17
45 46 47 48 49 50 51 52 53 54
...options, }; if (this.options.config) { if (typeof this.options.config === 'string') { AWS.config.loadFromPath(this.options.config); } else if (typeof this.options.config === 'object') { AWS.config.constructor(this.options.config); } else { throw new Error('unsupported config is passed as a argument.');
4
15
8
+ 3 other calls in file
6 7 8 9 10 11 12 13 14 15
return callback(null, false); } config = input.config; AWS.config.update({region: input.awsRegion}); var awsConfig = new AWS.ConfigService(), params = {}; switch (input.eventType) { case 'configRule':
8
7
39
GitHub: b-n/tasker
0 1 2 3 4 5 6 7 8 9
'use strict'; const AWS = require('aws-sdk'); module.exports.iot = async (event, context) => { AWS.config.update({region: process.env.AWS_REGION}); const dynamodb = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); const dynamoTable = process.env.DYNAMODB_TABLE;
0
1
1
+ 3 other calls in file
GitHub: yagrxu/aws-game-demo
693 694 695 696 697 698 699 700 701 702 703 704
return ret } function initSqs () { // Set the region AWS.config.update({ region: defaultRegion }) // Create an SQS service object return new AWS.SQS({ apiVersion: '2012-11-05' }) }
1
1
0
+ 3 other calls in file
aws-sdk.S3 is the most popular function in aws-sdk (7245 examples)