

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS 데이터 소스에 대한 Amazon Managed Grafana 권한 및 정책
<a name="AMG-manage-permissions"></a>

Amazon Managed Grafana에서는 세 가지 권한 모드를 제공합니다.
+ 현재 계정에 대한 서비스 관리형 권한
+ 조직에 대한 서비스 관리형 권한
+ 고객 관리형 권한

워크스페이스를 생성할 때 사용할 권한 모드를 선택합니다. 원하면 나중에 이를 변경할 수 있습니다.

서비스 관리형 권한 모드 중 하나에서 Amazon Managed Grafana는 계정 또는 조직의 AWS 데이터 소스에 액세스하고 검색하는 데 필요한 역할과 정책을 생성합니다. 그런 다음, 선택한 경우 IAM 콘솔에서 이러한 정책을 편집할 수 있습니다.

## 단일 계정에 대한 서비스 관리형 권한
<a name="AMG-service-managed-account"></a>

이 모드에서 Amazon Managed Grafana는 **AmazonGrafanaServiceRole-{{random-id}}** 역할을 생성합니다. 그런 다음 Amazon Managed Grafana는 Amazon Managed Grafana 워크스페이스에서 액세스하도록 선택한 각 AWS 서비스에 대해이 역할에 정책을 연결합니다.

**CloudWatch**  
Amazon Managed Grafana는 AWS 관리형 정책 **AmazonGrafanaCloudWatchAccess**를 연결합니다.  
CloudWatch를 사용한 워크스페이스의 경우 **AmazonGrafanaCloudWatchAccess** 관리형 정책을 생성하기 전에 Amazon Managed Grafana는 **AmazonGrafanaCloudWatchPolicy-{{random-id}}** 이름의 고객 관리형 정책을 생성했습니다.

**Amazon OpenSearch Service**  
Amazon Managed Grafana는 **AmazonGrafanaOpenSearchPolicy-{{random-id}}** 이름의 고객 관리형 정책을 생성합니다. 데이터 소스 액세스에는 Get/Post 권한이 필요합니다. 나열/설명 권한은 Amazon Managed Grafana에서 데이터 소스 검색에 사용되지만 데이터 소스 플러그인이 작동하는 데 필요하지 않습니다. 정책의 콘텐츠는 다음과 같습니다.    
****  

```
{
    "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에서 데이터 소스 검색에 사용되지만 플러그인이 작동하는 데 필요하지 않습니다. 정책의 콘텐츠는 다음과 같습니다.    
****  

```
{
    "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}}** 이름의 고객 관리형 정책을 생성합니다. 이 정책은 `grafana` 문자열로 시작하는 계정의 SNS 주제만 사용하도록 제한합니다. 자체 정책을 생성하는 경우 필요하지 않습니다. 정책의 콘텐츠는 다음과 같습니다.    
****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sns:Publish"
            ],
            "Resource": [
                "arn:aws:sns:*:{{111122223333}}:grafana*"
            ]
        }
    ]
}
```

**Timestream**  
Amazon Managed Grafana는 AWS 관리형 정책 **AmazonTimestreamReadOnlyAccess**를 연결합니다.

**X-Ray**  
Amazon Managed Grafana는 AWS 관리형 정책 **AWSXrayReadOnlyAccess**를 연결합니다.

## 조직에 대한 서비스 관리형 권한
<a name="AMG-service-managed-organization"></a>

이 모드는 조직의 위임된 관리자 계정 또는 관리 계정에서 생성된 워크스페이스에 대해서만 지원됩니다. 위임된 관리자 계정은 조직의 스택 세트를 생성 및 관리할 수 있습니다. 위임된 관리자 계정에 대한 자세한 내용은 [위임된 관리자 등록](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html)을 참조하세요.

**참고**  
조직의 관리 계정에서 Amazon Managed Grafana 워크스페이스와 같은 리소스를 생성하는 것은 AWS 보안 모범 사례에 위배됩니다.

이 모드에서 Amazon Managed Grafana는 AWS 조직의 다른 계정에 있는 리소스에 액세스하는 AWS 데 필요한 모든 IAM 역할을 생성합니다. 선택한 조직 단위의 각 계정에서 Amazon Managed Grafana는 **AmazonGrafanaOrgMemberRole-{{random-id}}** 역할을 생성합니다. 이 역할 생성은 AWS CloudFormation StackSets와의 통합을 통해 수행됩니다.

이 역할에는 워크스페이스에서 사용하도록 선택한 각 AWS 데이터 소스에 대해 연결된 정책이 있습니다. 이러한 데이터 정책의 콘텐츠는 [단일 계정에 대한 서비스 관리형 권한](#AMG-service-managed-account) 섹션을 참조하세요.

Amazon Managed Grafana는 조직의 관리 계정에서 **AmazonGrafanaOrgAdminRole-{{random-id}}** 역할을 생성합니다. 이 역할은 Amazon Managed Grafana 워크스페이스 권한이 organization. AWS service 알림 채널 정책도이 역할에 연결되도록 허용합니다. 워크스페이스의 **AWS 데이터 소스** 메뉴를 사용하여 워크스페이스에서 액세스할 수 있는 각 계정의 데이터 소스를 빠르게 프로비저닝합니다.

이 모드를 사용하려면 조직에서 CloudFormation Stacksets를 신뢰할 수 AWS 있는 서비스로 활성화해야 합니다. 자세한 내용은를 사용하여 [ 신뢰할 수 있는 액세스 활성화를 AWS Organizations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-enable-trusted-access.html) 참조하세요.

다음은 **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}}**의 콘텐츠입니다.

------
#### [ JSON ]

****  

```
{ 
    "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}}" 
    }]
}
```

------

## 고객 관리형 권한
<a name="AMG-customer-managed"></a>

고객 관리형 권한을 사용하도록 선택한 경우 Amazon Managed Grafana 워크스페이스를 생성할 때 계정에서 기존 IAM 역할을 지정합니다. 역할에는 `grafana.amazonaws.com`을 신뢰하는 신뢰 정책이 있어야 합니다.

다음은 이러한 정책의 예제입니다.

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "grafana.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
```

------

해당 역할이 해당 계정의 AWS 데이터 소스 또는 알림 채널에 액세스하려면이 섹션의 앞부분에 나열된 정책에 권한이 있어야 합니다. 예를 들어 CloudWatch 데이터 소스를 사용하려면 [단일 계정에 대한 서비스 관리형 권한](#AMG-service-managed-account)에 나열된 CloudWatch 정책에 권한이 있어야 합니다.

[단일 계정에 대한 서비스 관리형 권한](#AMG-service-managed-account)에 표시된 Amazon OpenSearch Service 및 Amazon Managed Service for Prometheus에 대한 정책의 `List` 및 `Describe` 권한은 데이터 소스 검색 및 프로비저닝이 올바르게 작동하는 데만 필요합니다. 이러한 데이터 소스를 수동으로 설정하려는 경우에는 필요하지 않습니다.

**교차 계정 액세스**

111111111111 계정에서 워크스페이스가 생성되면 1111111111111 계정에서 역할을 제공해야 합니다. 이 예제에서는 이 역할 *WorkspaceRole*이라고 합니다. 999999999999 계정의 데이터에 액세스하려면 999999999999 계정에서 역할을 생성해야 합니다. *DataSourceRole*이라고 합니다. 그런 다음, *WorkspaceRole* 및 *DataSourceRole* 사이에서 신뢰 관계를 설정해야 합니다. 두 역할 간의 신뢰 설정에 대한 자세한 내용은 [IAM 자습서: IAM 역할을 사용하여 AWS 계정 간 액세스 권한 위임](https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html)을 참조하세요.

*DataSourceRole*에는 사용하려는 각 데이터 소스에 대해 이 섹션의 앞부분에 나열된 정책 문이 포함되어야 합니다. 신뢰 관계가 설정되면 워크스페이스에 있는 모든 데이터 소스의 데이터 소스 구성 페이지에 있는 역할 ARN 수임 필드에 *DataSourceRole***의 ARN**(arn:aws:iam::999999999999:role: AWS DataSourceRole)을 지정할 수 있습니다. 그런 다음, 데이터 소스는 *DataSourceRole*에 정의된 권한을 사용하여 999999999999 계정에 액세스합니다.