각 canary는 특정 권한이 연결된 IAM 역할과 연결되어야 합니다. CloudWatch 콘솔을 사용하여 canary를 생성하는 경우 CloudWatch Synthetics에서 canary에 대한 IAM 역할을 생성하도록 선택할 수 있습니다. 이렇게 하면 역할에 필요한 권한이 부여됩니다.
IAM 역할을 직접 생성하거나 AWS CLI 또는 API를 사용하여 canary 생성 시 사용할 수 있는 IAM 역할을 생성하는 경우, 이 섹션에 나열된 권한이 해당 역할에 포함되어야 합니다.
canary에 대한 모든 IAM 역할에는 다음 신뢰 정책 문이 포함되어야 합니다.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
또한 canary의 IAM 역할에는 다음 명령문 중 하나가 필요합니다.
AWS KMS를 사용하지 않거나 Amazon VPC 액세스가 필요하지 않은 기본 canary
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::path/to/your/s3/bucket/canary/results/folder
"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::name/of/the/s3/bucket/that/contains/canary/results
"
]
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:CreateLogGroup"
],
"Resource": [
"arn:aws:logs:canary_region_name
:canary_account_id
:log-group:/aws/lambda/cwsyn-canary_name
-*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"xray:PutTraceSegments"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Resource": "*",
"Action": "cloudwatch:PutMetricData",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "CloudWatchSynthetics"
}
}
}
]
}
AWS KMS를 사용하여 canary 아티팩트를 암호화하지만 Amazon VPC 액세스가 필요하지 않은 canary
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::path/to/your/S3/bucket/canary/results/folder
"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::name/of/the/S3/bucket/that/contains/canary/results
"
]
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:CreateLogGroup"
],
"Resource": [
"arn:aws:logs:canary_region_name
:canary_account_id
:log-group:/aws/lambda/cwsyn-canary_name
-*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"xray:PutTraceSegments"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Resource": "*",
"Action": "cloudwatch:PutMetricData",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "CloudWatchSynthetics"
}
}
},
{
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey"
],
"Resource": "arn:aws:kms:KMS_key_region_name
:KMS_key_account_id
:key/KMS_key_id
",
"Condition": {
"StringEquals": {
"kms:ViaService": [
"s3.region_name_of_the_canary_results_S3_bucket
.amazonaws.com"
]
}
}
}
]
}
AWS KMS를 사용하지 않지만 Amazon VPC 액세스는 필요한 canary
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::path/to/your/S3/bucket/canary/results/folder
"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::name/of/the/S3/bucket/that/contains/canary/results
"
]
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:CreateLogGroup"
],
"Resource": [
"arn:aws:logs:canary_region_name
:canary_account_id
:log-group:/aws/lambda/cwsyn-canary_name
-*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"xray:PutTraceSegments"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Resource": "*",
"Action": "cloudwatch:PutMetricData",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "CloudWatchSynthetics"
}
}
},
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface"
],
"Resource": [
"*"
]
}
]
}
AWS KMS를 사용하여 canary 아티팩트를 암호화하고 Amazon VPC 액세스도 필요한 canary
VPC 사용을 시작하기 위해 비 VPC canary를 업데이트하는 경우, 다음 정책에 나열된 네트워크 인터페이스 권한을 포함하도록 canary의 역할을 업데이트해야 합니다.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::path/to/your/S3/bucket/canary/results/folder
"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::name/of/the/S3/bucket/that/contains/canary/results
"
]
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:CreateLogGroup"
],
"Resource": [
"arn:aws:logs:canary_region_name
:canary_account_id
:log-group:/aws/lambda/cwsyn-canary_name
-*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"xray:PutTraceSegments"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Resource": "*",
"Action": "cloudwatch:PutMetricData",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "CloudWatchSynthetics"
}
}
},
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey"
],
"Resource": "arn:aws:kms:KMS_key_region_name
:KMS_key_account_id
:key/KMS_key_id
",
"Condition": {
"StringEquals": {
"kms:ViaService": [
"s3.region_name_of_the_canary_results_S3_bucket
.amazonaws.com"
]
}
}
}
]
}