How to use aws-sdk.Config:
6 7 8 9 10 11 12 13 14 15 16
const region = process.env.AWS_ES_REGION const domain = process.env.AWS_ES_DOMAIN const accessKeyId = process.env.AWS_ACCESS_KEY_ID const accessKeySecret = process.env.AWS_SECRET_ACCESS_KEY const awsConfig = new AWS.Config() awsConfig.update({ region: region, accessKeyId: accessKeyId, accessKeySecret: accessKeySecret,
How to use aws-sdk.CloudSearchDomain:
13 14 15 16 17 18 19 20 21
assert(config.NODE_ENV === 'production'); assert(config.IS_CLOUDSEARCH_CONFIGURED); AWS.config.region = 'us-east-1'; var client = new AWS.CloudSearchDomain({ apiVersion: '2013-01-01', endpoint: config.AWS_CLOUDSEARCH_DOCUMENT_ENDPOINT });
How to use aws-sdk.restore:
66 67 68 69 70 71 72 73 74
**/ AWS.restore('SNS', 'publish'); AWS.restore('DynamoDB'); AWS.restore('S3'); // or AWS.restore(); this will restore all the methods and services ``` #### Using TypeScript
See more examples
How to use aws-sdk.crendentials:
22 23 24 25 26 27 28 29 30 31 32 33 34
accessSecretKey: awsconfig.aws}); var docClient = new AWS.DynamoDB.DocumentClient(); const crendentials = await Auth.currentCredentials(); const creds = await Auth.essentialCredentials(crendentials); AWS.config.crendentials = new AWS.crendentials(creds.accessKeyId, creds.secretAccessKey, creds.sessionToken); export default function DynamoDB_Sample() { const [ballValues, setBallValues] = useState([])
How to use aws-sdk.Batch:
35 36 37 38 39 40 41 42 43 44
jobDefinition: '$${batch_job_definition}', jobQueue: '$${batch_job_queue}', containerOverrides: event.containerOverrides || null, parameters: event.parameters || null, }; new AWS.Batch().submitJob(params, (err, data) => { if (err) { console.error(err); const message = 'Error calling SubmitJob for:' + event.jobName; console.error(message);
How to use aws-sdk.CloudTrail:
How to use aws-sdk.CodePipeline:
189 190 191 192 193 194 195 196 197
for(let single_client of credentialsList){ //console.log(single_client, getRegionsRes); let codepipelineList = getRegionsRes.map(ele => { return new AWS.CodePipeline({ region: ele['regionid'], accessKeyId: single_client['accesstoken'], secretAccessKey: single_client['secretekey'] }) }); //console.log(codecommitList);
How to use aws-sdk.KinesisAnalytics:
10 11 12 13 14 15 16 17 18 19
if (!program.name) { return console.error('Missing application name, use -N or --name\n'); } const kinesisanalytics = new AWS.KinesisAnalytics({region: program.region}); (function runCommand() { return Promise.resolve()
See more examples
How to use aws-sdk.IotData:
12 13 14 15 16 17 18 19 20 21
if(err) { console.log(err, err.stack); context.fail(event); } else { iotdata = new AWS.IotData(); params = { topic: 'ecutools/j2534/PassThruScanForDevices/response', payload: data.toString(), qos: 0
See more examples
How to use aws-sdk.Iot:
How to use aws-sdk.ECR:
47 48 49 50 51 52 53 54 55 56
}); } } async function getEcrAuthTokenWrapper(authTokenRequest) { const ecr = new aws.ECR({ customUserAgent: ECR_LOGIN_GITHUB_ACTION_USER_AGENT }); const authTokenResponse = await ecr.getAuthorizationToken(authTokenRequest).promise(); if (!authTokenResponse) {
See more examples
How to use aws-sdk.EventBridge:
74 75 76 77 78 79 80 81 82 83
var AWS = require('aws-sdk'); // Set the region AWS.config.update({region: 'REGION'}); // Create CloudWatchEvents service object var ebevents = new AWS.EventBridge({apiVersion: '2015-10-07'}); var params = { Rule: 'DEMO_EVENT', Targets: [
See more examples
How to use aws-sdk.MemoryDB:
How to use aws-sdk.Glue:
5 6 7 8 9 10 11 12 13 14
//update region to AWS region where Amazon Neptune database resides AWS.config.update({ region: 'us-west-2' }) var glue = new AWS.Glue(); var dbidentifier = uuidv4(); var databaseName = `graph-database-${dbidentifier}`; function addDatabase(addTablesAfterDatabase) {
See more examples
How to use aws-sdk.AmplifyBackend:
GitHub: milk531/amplify-s3
104 105 106 107 108 109 110 111 112 113
break; case 'sync': if(backendType === 'space') { throw new Error('Command not supported yet for space backend.'); } const amplifybackend = new aws.AmplifyBackend(); const srcMD = await amplifybackend.getBackend({ AppId: appId, BackendEnvironmentName: options.src }).promise();
How to use aws-sdk.CodeCommit:
19 20 21 22 23 24 25 26 27 28 29 30
// snippet-sourcedate:[2016-03-07] // snippet-sourceauthor:[AWS] // snippet-start:[codecommit.nodejs.MyCodeCommitFunction_js.complete] var aws = require('aws-sdk'); var codecommit = new aws.CodeCommit({ apiVersion: '2015-04-13' }); exports.handler = function(event, context) { //Log the updated references from the event
How to use aws-sdk.ChimeSDKMessaging:
44 45 46 47 48 49 50 51 52 53
const sessionConfig = new MessagingSessionConfiguration( createMemberArn(member.userId), this.sessionId, this._endpoint, new AWS.ChimeSDKMessaging(), AWS ); this._session = new DefaultMessagingSession(
How to use aws-sdk.events:
GitHub: noobaa/noobaa-core
93 94 95 96 97 98 99 100 101 102
}) } }); if (!argv.selfsigned) { // @ts-ignore AWS.events.on('error', err => { if (err.message === 'self signed certificate') { setTimeout(() => console.log( '\n*** You can accept self signed certificates with: --selfsigned\n' ), 10);
See more examples
How to use aws-sdk.ElasticTranscoder:
58 59 60 61 62 63 64 65 66 67 68
Key: '', // pass key Body: null, // pass file body ACL: "public-read" }; var Etrans = new aws.ElasticTranscoder({ region: awsConfig.region, //Bucket Region credentials: { accessKeyId: "AKIA5C7FYB6LSYMNE6CS", secretAccessKey: "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",
How to use aws-sdk.WAFV2:
16 17 18 19 20 21 22 23 24
const AWS = require('aws-sdk'); const lambda = process.env.METRICS == "true" ? new AWS.Lambda({ customUserAgent: process.env.SOLUTION_IDENTIFIER, region: 'us-east-1' }) : new AWS.Lambda({ region: 'us-east-1' }); const ssm = process.env.METRICS == "true" ? new AWS.SSM({ customUserAgent: process.env.SOLUTION_IDENTIFIER }) : new AWS.SSM(); const wafv2 = process.env.METRICS == "true" ? new AWS.WAFV2({ customUserAgent: process.env.SOLUTION_IDENTIFIER, region: 'us-east-1' }) : new AWS.WAFV2({ region: 'us-east-1' }); exports.handler = async (event, context) => {
See more examples
How to use aws-sdk.CognitoIdentity:
36 37 38 39 40 41 42 43 44 45
}) }, methods: { async getCreds () { console.log('getCreds called') const cognitoIdentity = new AWS.CognitoIdentity() return new Promise((resolve, reject) => { AWS.config.credentials.get(function (err) { if (!err) {
How to use aws-sdk.Kinesis:
52 53 54 55 56 57 58 59 60
(after [configuring the SDK](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html)): ```js var AWS = require('aws-sdk') var kinesis = new AWS.Kinesis({endpoint: 'http://localhost:4567'}) kinesis.listStreams(console.log.bind(console)) ```
See more examples
How to use aws-sdk.Polly:
4 5 6 7 8 9 10 11 12 13 14
// Create the parameters exports.saveTextToMp3 = async (event) => { console.log("🚀 ~ file: saveTextToMp3.js:8 ~ exports.saveTextToMp3= ~ event:", event['body']) let data = undefined; let polly = new AWS.Polly(); console.log("🚀 ~ file: saveTextToMp3.js:11 ~ exports.saveTextToMp3= ~ polly:", polly) let s3 = new AWS.S3(); console.log("🚀 ~ file: saveTextToMp3.js:12 ~ exports.saveTextToMp3= ~ s3:", s3) // const requestBody = JSON.parse(event.body);
How to use aws-sdk.ApiGatewayManagementApi:
7 8 9 10 11 12 13 14 15 16 17 18
'use strict'; const AWS = require('aws-sdk'); const DynamoDB = new AWS.DynamoDB.DocumentClient(); const SSM = new AWS.SSM(); const APIGatewayManagement = new AWS.ApiGatewayManagementApi({apiVersion: '2018-11-29'}); const readSessionFromSSM = function (callback) { let param = { "Name": process.env.SESSION_PARAMETER
How to use aws-sdk.S3Control:
428 429 430 431 432 433 434 435 436 437
if (credential !== undefined && credential.region == 'MainlandChina') { params.region = 'cn-northwest-1' } else { params.region = 'ap-southeast-1' } let s3Control = new AWS.S3Control(params) return s3Control } fetchBuckets() {
How to use aws-sdk.NodeHttpClient:
26 27 28 29 30 31 32 33 34 35
// Sign the request (Sigv4) var signer = new AWS.Signers.V4(req, 'es'); signer.addAuthorization(creds, new Date()); // Post document to the OpenSearch Service var send = new AWS.NodeHttpClient(); send.handleRequest(req, null, (httpResp) => { var body = ''; httpResp.on('data', (chunk) => {
See more examples
How to use aws-sdk.CodeDeploy:
-2
How to use aws-sdk.ComprehendMedical:
3 4 5 6 7 8 9 10 11 12 13 14 15
class TextComprehensionService { comprehend = undefined; constructor() { this.comprehend = new AWS.ComprehendMedical(); } async comprehendText(text, operation) { if (operation === ComprehensionType.DETECT_ENTITIES) {
How to use aws-sdk.ConfigService:
7 8 9 10 11 12 13 14 15 16
} config = input.config; AWS.config.update({region: input.awsRegion}); var awsConfig = new AWS.ConfigService(), params = {}; switch (input.eventType) { case 'configRule': params = {