我想以编程方式通过SDK获取速查仪表板URL(区域中的仪表板:eu-west-1),但是,每当使用以下区域时,使用以下区域时都会出现以下错误:
Operation is being called from endpoint eu-west-1, but your identity region is us-east-1. Please use the us-east-1 endpoint.
us-east-1.quicksight.aws.amazon.com refused to connect
错误,例如:https://us-east-1.quicksight.aws.amazon.com/embed/XXXXXX&identityprovider=quicksight&isauthcode=true ',注:为简洁起见,添加了凭据,但从配置文件中加载了这些凭据。在Java SDK中也尝试过。
const AWS = require('aws-sdk')
const dotenv = require('dotenv').config()
const init = async () => {
AWS.config.credentials = {accessKeyId: process.env.ACCESS_KEY_ID, secretAccessKey: process.env.SECRET_ACCESS_KEY}
AWS.config.region = 'us-east-1'
// AWS.config.region = 'eu-west-1'
const quicksight = new AWS.QuickSight()
const embedUrlParams = {
AwsAccountId: '111122223333',
DashboardId: '11111111-2222-3333-4444-555555555555',
IdentityType: 'QUICKSIGHT',
UserArn: 'arn:aws:quicksight:us-east-1:111122223333:user/default/quicksight-user-1111'
}
const embedUrlRes = await quicksight.getDashboardEmbedUrl(embedUrlParams).promise()
console.log('embedUrlRes', embedUrlRes)
}
init()
当我通过CLI进行完全相同的调用时,例如:
aws quicksight get-dashboard-embed-url --aws-account-id 111122223333 --dashboard-id 11111111-2222-3333-4444-555555555555 --identity-type QUICKSIGHT --user-arn "arn:aws:quicksight:us-east-1:111122223333:user/default/quicksight-user-1111" --profile my-quicksight-profile
我在eu-west-1中获得了一个完全有效的嵌入网址,该网址通过浏览器嵌入了完美的网址:
https://eu-west-1.quicksight.aws.amazon.com/embed/XXXXXXXX&identityprovider=quicksight&isauthcode=true
我想像SDK在表现角色方面不像CLI那样,但是我尝试这种方法并没有取得成功,而且还指向快速见识的区域端点。
在我进入兔子洞之前,最好先看看是否有人经历过相同的事情,以及他们如何解决的。
谢谢!
答案 0 :(得分:1)
对于最终到达这里的人,如果您的仪表板位于不同的区域,则在使用 sdk 生成和嵌入链接时,您必须将 sdk 的 quicksight 参数更新到该区域
类似下面的内容
// Previous code blocks..
quicksight = new AWS.QuickSight({ region: targetRegion })
quicksight.getDashboardEmbedUrl(Params,function (error, embeddedLink){})
此外,您还必须将每个区域的域列入白名单,因为 quicksight 将每个区域视为单独的实体