Created
January 18, 2019 21:05
-
-
Save CiscoKidxx/b0a6ed3a964f813e9589788c02bc3c52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require("aws-sdk"); | |
const Connect = require("aws-sdk/clients/connect"); | |
AWS.config.setPromisesDependency(require("bluebird")); | |
// Account 1 - Core services... after learning things in customer connect account we write to DynamoDB in this account | |
AWS.config.update({ | |
accessKeyId: "xxxxxxxxxxxxxxxxxxxxxxxx", | |
secretAccessKey: "xxxxxxxxxxxxxxxxxxxxxxxx", | |
region: "us-east-1" | |
}); | |
// instantiate Connect | |
const connect = new AWS.Connect(); | |
// Account 2 - Update connect config. The Connect instances live in different AWS Accounts. | |
connect.config.update({ | |
accessKeyId: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", | |
secretAccessKey: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", | |
region: "us-west-2" | |
}); | |
console.log("connect.config: ", connect.config); // This correctly shows us-west-2 | |
console.log("AWS.config: ", AWS.config); // This correctly shows us-east-1 | |
var params = { | |
InstanceId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // InstanceId in "us-west-2" | |
}; | |
const users = connect | |
.listUsers(params) | |
.promise() | |
.then(res => console.log(res)); // "Credential should be scoped to a valid region, not 'us-west-2'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment