本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
Amazon Managed Grafana 提供三種許可模式:
-
目前帳戶的服務管理許可
-
組織的服務管理許可
-
客戶管理的許可
建立工作區時,您可以選擇要使用的許可模式。您也可以稍後視需要變更此項目。
在任一服務受管許可模式中,Amazon Managed Grafana 會建立存取和探索您帳戶或組織中 AWS 資料來源所需的角色和政策。您可以選擇在 IAM 主控台中編輯這些政策。
單一帳戶的服務管理許可
在此模式中,Amazon Managed Grafana 會建立名為 AmazonGrafanaServiceRole-random-id
的角色。然後,Amazon Managed Grafana 會針對您選取要從 Amazon Managed Grafana 工作區存取的每個 AWS 服務,將政策連接至此角色。
- CloudWatch
-
Amazon Managed Grafana 會連接 AWS 受管政策 AmazonGrafanaCloudWatchAccess。
注意
對於在建立 CloudWatch 的工作區,Amazon Managed Grafana 建立了名為 AmazonGrafanaCloudWatchPolicy-
random-id
的客戶受管政策。 AmazonGrafanaCloudWatchAccess - Amazon OpenSearch Service
-
Amazon Managed Grafana 會建立名為 AmazonGrafanaOpenSearchPolicy-
random-id
的客戶受管政策。資料來源存取需要 Get/Post 許可。Amazon Managed Grafana 會使用 List/Describe 許可進行資料來源探索,但資料來源外掛程式不需要這些許可即可運作。政策的內容如下所示:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "es:ESHttpGet", "es:DescribeElasticsearchDomains", "es:ListDomainNames" ], "Resource": "*" }, { "Effect": "Allow", "Action": "es:ESHttpPost", "Resource": [ "arn:aws:es:*:*:domain/*/_msearch*", "arn:aws:es:*:*:domain/*/_opendistro/_ppl" ] } ] }
- AWS IoT SiteWise
-
Amazon Managed Grafana 會連接 AWS 受管政策 AWSIoTSiteWiseReadOnlyAccess。
- Amazon Redshift
-
Amazon Managed Grafana 會連接 AWS 受管政策 AmazonGrafanaRedshiftAccess。
- Amazon Athena
-
Amazon Managed Grafana 連接 AWS 受管政策 AmazonGrafanaAthenaAccess。
- Amazon Managed Service for Prometheus
-
Amazon Managed Grafana 會建立名為 AmazonGrafanaPrometheusPolicy-
random-id
的客戶受管政策。Amazon Managed Grafana 會使用 List/Describe 許可進行資料來源探索,外掛程式不需要這些許可即可運作。政策的內容如下所示:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "aps:ListWorkspaces", "aps:DescribeWorkspace", "aps:QueryMetrics", "aps:GetLabels", "aps:GetSeries", "aps:GetMetricMetadata" ], "Resource": "*" } ] }
- Amazon SNS
-
Amazon Managed Grafana 會建立名為 AmazonGrafanaSNSPolicy-
random-id
的客戶受管政策。此政策限制您只使用帳戶中以字串 開頭的 SNS 主題grafana
。如果您建立自己的政策,則不需要這麼做。政策的內容如下所示:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:Publish" ], "Resource": [ "arn:aws:sns:*:
accountId
:grafana*" ] } ] } - Timestream
-
Amazon Managed Grafana 會連接 AWS 受管政策 AmazonTimestreamReadOnlyAccess。
- X-Ray
-
Amazon Managed Grafana 會連接 AWS 受管政策 AWSXrayReadOnlyAccess。
組織的服務管理許可
此模式僅支援在管理帳戶或組織中委派管理員帳戶中建立的工作區。委派的管理員帳戶可以為組織建立和管理堆疊集。如需委派管理員帳戶的詳細資訊,請參閱註冊委派管理員。
注意
在組織的管理帳戶中建立資源,例如 Amazon Managed Grafana 工作區,違反 AWS 安全最佳實務。
在此模式中,Amazon Managed Grafana 會建立存取 AWS AWS 組織中其他帳戶中資源所需的所有 IAM 角色。在您選取的組織單位中,Amazon Managed Grafana 會建立名為 AmazonGrafanaOrgMemberRole-random-id
的角色。此角色建立是透過與 AWS CloudFormation StackSets 的整合來執行。
此角色會為您選取要在工作區中使用的每個 AWS 資料來源連接一個政策。如需這些資料政策的內容,請參閱 單一帳戶的服務管理許可 。
Amazon Managed Grafana 也會在組織的管理帳戶中建立名為 AmazonGrafanaOrgAdminRole-random-id
的角色。此角色允許 Amazon Managed Grafana 工作區存取 organization. AWS service 通知管道政策中其他帳戶的權限也連接至此角色。使用工作區中的AWS 資料來源功能表,快速佈建工作區可存取之每個帳戶的資料來源
若要使用此模式,您必須在組織中 AWS 啟用 AWS CloudFormation Stacksets 做為信任的服務。如需詳細資訊,請參閱使用 啟用受信任存取 AWS Organizations。
以下是 AmazonGrafanaStackSet-random-id
堆疊集的內容:
Parameters:
IncludePrometheusPolicy:
Description: Whether to include Amazon Prometheus access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeAESPolicy:
Description: Whether to include Amazon Elasticsearch access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeCloudWatchPolicy:
Description: Whether to include CloudWatch access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeTimestreamPolicy:
Description: Whether to include Amazon Timestream access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeXrayPolicy:
Description: Whether to include AWS X-Ray access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeSitewisePolicy:
Description: Whether to include AWS IoT SiteWise access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeRedshiftPolicy:
Description: Whether to include Amazon Redshift access in the role
Type: String
AllowedValues:
- true
- false
Default: false
IncludeAthenaPolicy:
Description: Whether to include Amazon Athena access in the role
Type: String
AllowedValues:
- true
- false
Default: false
RoleName:
Description: Name of the role to create
Type: String
AdminAccountId:
Description: Account ID of the Amazon Grafana org admin
Type: String
Conditions:
addPrometheus: !Equals [!Ref IncludePrometheusPolicy, true]
addAES: !Equals [!Ref IncludeAESPolicy, true]
addCloudWatch: !Equals [!Ref IncludeCloudWatchPolicy, true]
addTimestream: !Equals [!Ref IncludeTimestreamPolicy, true]
addXray: !Equals [!Ref IncludeXrayPolicy, true]
addSitewise: !Equals [!Ref IncludeSitewisePolicy, true]
addRedshift: !Equals [!Ref IncludeRedshiftPolicy, true]
addAthena: !Equals [!Ref IncludeAthenaPolicy, true]
Resources:
PrometheusPolicy:
Type: AWS::IAM::Policy
Condition: addPrometheus
Properties:
Roles:
- !Ref GrafanaMemberServiceRole
PolicyName: AmazonGrafanaPrometheusPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- aps:QueryMetrics
- aps:GetLabels
- aps:GetSeries
- aps:GetMetricMetadata
- aps:ListWorkspaces
- aps:DescribeWorkspace
Resource: '*'
AESPolicy:
Type: AWS::IAM::Policy
Condition: addAES
Properties:
Roles:
- !Ref GrafanaMemberServiceRole
PolicyName: AmazonGrafanaElasticsearchPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AllowReadingESDomains
Effect: Allow
Action:
- es:ESHttpGet
- es:ESHttpPost
- es:ListDomainNames
- es:DescribeElasticsearchDomains
Resource: '*'
CloudWatchPolicy:
Type: AWS::IAM::Policy
Condition: addCloudWatch
Properties:
Roles:
- !Ref GrafanaMemberServiceRole
PolicyName: AmazonGrafanaCloudWatchPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AllowReadingMetricsFromCloudWatch
Effect: Allow
Action:
- cloudwatch:DescribeAlarmsForMetric
- cloudwatch:DescribeAlarmHistory
- cloudwatch:DescribeAlarms
- cloudwatch:ListMetrics
- cloudwatch:GetMetricStatistics
- cloudwatch:GetMetricData
- cloudwatch:GetInsightRuleReport
Resource: "*"
- Sid: AllowReadingLogsFromCloudWatch
Effect: Allow
Action:
- logs:DescribeLogGroups
- logs:GetLogGroupFields
- logs:StartQuery
- logs:StopQuery
- logs:GetQueryResults
- logs:GetLogEvents
Resource: "*"
- Sid: AllowReadingTagsInstancesRegionsFromEC2
Effect: Allow
Action:
- ec2:DescribeTags
- ec2:DescribeInstances
- ec2:DescribeRegions
Resource: "*"
- Sid: AllowReadingResourcesForTags
Effect: Allow
Action:
- tag:GetResources
Resource: "*"
GrafanaMemberServiceRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Ref RoleName
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
AWS: !Sub arn:aws:iam::${AdminAccountId}:root
Action:
- 'sts:AssumeRole'
Path: /service-role/
ManagedPolicyArns:
- !If [addTimestream, arn:aws:iam::aws:policy/AmazonTimestreamReadOnlyAccess, !Ref AWS::NoValue]
- !If [addXray, arn:aws:iam::aws:policy/AWSXrayReadOnlyAccess, !Ref AWS::NoValue]
- !If [addSitewise, arn:aws:iam::aws:policy/AWSIoTSiteWiseReadOnlyAccess, !Ref AWS::NoValue]
- !If [addRedshift, arn:aws:iam::aws:policy/service-role/AmazonGrafanaRedshiftAccess, !Ref AWS::NoValue]
- !If [addAthena, arn:aws:iam::aws:policy/service-role/AmazonGrafanaAthenaAccess, !Ref AWS::NoValue]
以下是 AmazonGrafanaOrgAdminPolicy-random-id
的內容。
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"organizations:ListAccountsForParent",
"organizations:ListOrganizationalUnitsForParent"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:PrincipalOrgID": "o-organizationId
"
}
}
},
{
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": "arn:aws:iam::*:role/service-role/AmazonGrafanaOrgMemberRole-random-Id
"
}]
}
客戶管理的許可
如果您選擇使用客戶受管許可,您可以在建立 Amazon Managed Grafana 工作區時,在帳戶中指定現有的 IAM 角色。角色必須具有信任 的信任政策grafana.amazonaws.com
。
以下是此類政策的範例:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "grafana.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
若要讓該角色存取該帳戶中的 AWS 資料來源或通知管道,該角色必須具有本節稍早列出的政策許可。例如,若要使用 CloudWatch 資料來源,其必須擁有 中列出 CloudWatch 政策的許可單一帳戶的服務管理許可 。
所示的 Amazon OpenSearch Service List
和 Amazon Managed Service for Prometheus 政策中的 和 Describe
許可單一帳戶的服務管理許可 ,只需要資料來源探索和佈建正常運作。如果您只想要手動設定這些資料來源,則不需要這些資源。
跨帳戶存取
在帳戶 111111111111 中建立工作區時,必須提供帳戶 1111111111111 中的角色。在此範例中,請呼叫此角色 WorkspaceRole。若要存取帳戶 999999999999 中的資料,您必須在帳戶 999999999999 中建立角色。呼叫該 DataSourceRole。然後,您必須在 WorkspaceRole 和 DataSourceRole 之間建立信任關係。如需在兩個角色之間建立信任的詳細資訊,請參閱 IAM 教學課程:使用 IAM 角色委派跨 AWS 帳戶存取。
DataSourceRole 需要包含本節前面針對您要使用的每個資料來源列出的政策陳述式。建立信任關係後,您可以在工作區中任何 AWS 資料來源的資料來源組態頁面上的擔任角色 ARN 欄位中指定 DataSourceRole 的 ARN (arn:aws:iam::999999999999:role:DataSourceRole)。 資料來源接著會使用 DataSourceRole 中定義的許可存取帳戶 999999999999。