[英]AWS Grafana/CloudWatch - How to show Bill by accountId
我正在嘗試在我們的 AWS 下創建一個用於計費的儀表板。 我們的 AWS 設置如下:
masterAccount //access to all sub AWS account's billing info
subAccount1
subAccount2 //this is where Grafana is running
我有來自 masterAccount 的數據源,這是一個 cloudwatchReadOnly 訪問,並已將其設置為 assumeRole 從運行 Grafana 的 subAccount2 工作。
我得到如下數據(敏感數據,所以不得不掩蓋):
但是,我正在尋找的是從該數據源中獲取賬單數據,然后將其按 AWS accountId 拆分。
我根本不知道如何 go。 對 Grafana 很陌生。 提前致謝!
為每個子賬戶創建 Grafana CloudWatch 數據源,然后對每個子賬戶/數據源進行查詢。
正如 Jan Garaj 所說,go 的方法是創建多個數據源,然后將它們用於不同的小部件。 每個數據源都是您在子賬戶中創建的角色的 ARN。
附加到 EC2 實例的實例配置文件:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": [
"arn:aws:iam::subAccount1:role/roleName",
"arn:aws:iam::subAccount2:role/roleName",
"arn:aws:iam::subAccount3:role/roleName"
]
}
]
}
與信任關系為:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
然后,在 subAccounts 上(以 subAccount1 為例)
//AWS Created Policy
CloudWatchReadOnlyAccess
//With Trust Relationship
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com",
"AWS": "arn:aws:iam::accountWhereEC2InstanceIsRunning:role/nameOfInstanceProfile"
},
"Action": "sts:AssumeRole"
}
]
}
希望這對某人有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.