Tạo IAM Role

  1. Truy cập AWS Management Console
  • Tìm IAM
  • Chọn IAM

Create IAM Role

  1. Trong giao diện IAM
  • Chọn Policies
  • Chọn Create policies

Create IAM Role

  1. Trong giao diện Create policies
  • Copy đoạn policy dưới đây:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowReadingMetricsFromCloudWatch",
      "Effect": "Allow",
      "Action": [
        "cloudwatch:DescribeAlarmsForMetric",
        "cloudwatch:ListMetrics",
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:GetMetricData"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowReadingTagsInstancesRegionsFromEC2",
      "Effect": "Allow",
      "Action": ["ec2:DescribeTags", "ec2:DescribeInstances", "ec2:DescribeRegions"],
      "Resource": "*"
    },
    {
      "Sid": "AllowReadingResourcesForTags",
      "Effect": "Allow",
      "Action": "tag:GetResources",
      "Resource": "*"
    }
  ]
}
  • Chọn Next: Tags

Create IAM Role

  1. Trong giao diện Create policy
  • Nhập giá trị key
  • Nhập giá trị value
  • Chọn Next:Review

Create IAM Role

  1. Trong giao diện Create policy
  • Name, nhập GrafanaAccessPolicy
  • Chọn Create policy

Create IAM Role

  1. Vậy chúng ta đã tạo policy cho Role thành công

Create IAM Role

  1. Trong giao diện IAM
  • Chọn Roles
  • Chọn Create role

Create IAM Role

  1. Trong giao diện Select trusted entity
  • Chọn AWS service
  • Chọn EC2
  • Chọn Next

Create IAM Role

  1. Trong giao diện Add permissions
  • Tìm và chọn GrafanaAccessPolicy

Create IAM Role

  1. Chọn Next

Create IAM Role

  1. Trong bước Name, review and create
  • Role name, nhập GrafanaAccessRole
  • Description, nhập Role for Grafana Access

Create IAM Role

  1. Chọn Create role

Create IAM Role

  1. Hoàn thành tạo role cho EC2 instance

Create IAM Role