Tạo IAM Role
- Truy cập AWS Management Console
- Trong giao diện IAM
- Chọn Policies
- Chọn Create policies
- 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": "*"
}
]
}
- Trong giao diện Create policy
- Nhập giá trị key
- Nhập giá trị value
- Chọn Next:Review
- Trong giao diện Create policy
- Name, nhập
GrafanaAccessPolicy
- Chọn Create policy
- Vậy chúng ta đã tạo policy cho Role thành công
- Trong giao diện IAM
- Chọn Roles
- Chọn Create role
- Trong giao diện Select trusted entity
- Chọn AWS service
- Chọn EC2
- Chọn Next
- Trong giao diện Add permissions
- Tìm và chọn GrafanaAccessPolicy
- Chọn Next
- Trong bước Name, review and create
- Role name, nhập
GrafanaAccessRole
- Description, nhập
Role for Grafana Access
- Chọn Create role
- Hoàn thành tạo role cho EC2 instance