本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Amazon Guru 基于身份的政策 DevOps
默认情况下,用户和角色无权创建或修改 DevOps Guru 资源。他们也无法使用 AWS Management Console、 AWS Command Line Interface (AWS CLI) 或来执行任务 AWS API。要授予用户对其所需资源执行操作的权限,IAM管理员可以创建IAM策略。然后,管理员可以将IAM策略添加到角色中,用户可以代入这些角色。
要了解如何使用这些示例策略文档创建IAM基于身份的JSON策略,请参阅IAM用户指南中的创建IAM策略(控制台)。
有关 DevOps Guru 定义的操作和资源类型(包括每种资源类型的格式)的详细信息,请参阅《服务授权参考》中的 Amazon DevOps Guru 的操作、资源和条件密钥。ARNs
策略最佳实践
基于身份的策略决定了某人是否可以在您的账户中创建、访问或删除 DevOps Guru资源。这些操作可能会使 AWS 账户产生成本。创建或编辑基于身份的策略时,请遵循以下指南和建议:
-
开始使用 AWS 托管策略并转向最低权限权限 — 要开始向用户和工作负载授予权限,请使用为许多常见用例授予权限的AWS 托管策略。它们在你的版本中可用 AWS 账户。我们建议您通过定义针对您的用例的 AWS 客户托管策略来进一步减少权限。有关更多信息,请参阅《IAM用户指南》中的AWS 托AWS 管策略或工作职能托管策略。
-
应用最低权限权限-使用IAM策略设置权限时,仅授予执行任务所需的权限。为此,您可以定义在特定条件下可以对特定资源执行的操作,也称为最低权限许可。有关使用应用权限IAM的更多信息,请参阅IAM用户指南IAM中的策略和权限。
-
使用IAM策略中的条件进一步限制访问权限-您可以在策略中添加条件以限制对操作和资源的访问权限。例如,您可以编写一个策略条件来指定所有请求都必须使用发送SSL。如果服务操作是通过特定的方式使用的,则也可以使用条件来授予对服务操作的访问权限 AWS 服务,例如 AWS CloudFormation。有关更多信息,请参阅《IAM用户指南》中的IAMJSON策略元素:条件。
-
使用 A IAM ccess Analyzer 验证您的IAM策略以确保权限的安全性和功能性 — A IAM ccess Analyzer 会验证新的和现有的策略,以便策略符合IAM策略语言 (JSON) 和IAM最佳实践。IAMAccess Analyzer 提供了 100 多项策略检查和可行的建议,可帮助您制定安全和实用的策略。有关更多信息,请参阅《IAM用户指南》中的使用 A IAM ccess Analyzer 验证策略。
-
需要多重身份验证 (MFA)-如果您的场景需要IAM用户或 root 用户 AWS 账户,请打开MFA以提高安全性。要要求MFA何时调用API操作,请在策略中添加MFA条件。有关更多信息,请参阅《IAM用户指南》MFA中的使用进行安全API访问。
有关中最佳做法的更多信息IAM,请参阅《IAM用户指南》IAM中的安全最佳实践。
使用 DevOps Guru 控制台
要访问 Amazon DevOps Guru 控制台,您必须拥有一组最低权限。这些权限必须允许您列出和查看有关您 AWS 账户的 DevOps Guru 资源的详细信息。如果创建比必需的最低权限更为严格的基于身份的策略,对于附加了该策略的实体(用户或角色),控制台将无法按预期正常运行。
您无需为仅拨打 AWS CLI 或的用户设置最低控制台权限 AWS API。相反,只允许访问与他们尝试执行的API操作相匹配的操作。
为确保用户和角色仍然可以使用 DevOps Guru 控制台,还要将 DevOps Guru AmazonDevOpsGuruReadOnlyAccess
或AmazonDevOpsGuruFullAccess
AWS 托管策略附加到实体。有关更多信息,请参阅《用户指南》中的向IAM用户添加权限。
允许用户查看他们自己的权限
此示例说明如何创建允许IAM用户查看附加到其用户身份的内联和托管策略的策略。此策略包括在控制台上或使用或以编程方式完成此操作的 AWS CLI 权限。 AWS API
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ViewOwnUserInfo", "Effect": "Allow", "Action": [ "iam:GetUserPolicy", "iam:ListGroupsForUser", "iam:ListAttachedUserPolicies", "iam:ListUserPolicies", "iam:GetUser" ], "Resource": ["arn:aws:iam::*:user/${aws:username}"] }, { "Sid": "NavigateInConsole", "Effect": "Allow", "Action": [ "iam:GetGroupPolicy", "iam:GetPolicyVersion", "iam:GetPolicy", "iam:ListAttachedGroupPolicies", "iam:ListGroupPolicies", "iam:ListPolicyVersions", "iam:ListPolicies", "iam:ListUsers" ], "Resource": "*" } ] }
AWSDevOpsGuru 的托管(预定义)策略
AWS 通过提供由创建和管理的独立IAM策略来解决许多常见用例 AWS。这些 AWS托管策略为常见用例授予必要的权限,因此您可以不必调查需要哪些权限。有关更多信息,请参阅《IAM用户指南》中的AWS托管策略。
要创建和管理 DevOps Guru 服务角色,还必须附加名为的 AWS托管策略。IAMFullAccess
您也可以创建自己的自定义IAM策略,以授予 DevOps Guru 操作和资源的权限。您可以将这些自定义策略附加到需要这些权限的用户或组。
以下 AWS托管策略仅适用于 DevOps Guru,您可以将其附加到账户中的用户。
主题
AmazonDevOpsGuruFullAccess
AmazonDevOpsGuruFullAccess
— 提供对 DevOps Guru 的完全访问权限,包括创建亚马逊SNS主题、访问亚马逊 CloudWatch 指标和访问 AWS CloudFormation 堆栈的权限。仅适用于您想要授予对 Guru 完全控制权的管理员级别用户。 DevOps
AmazonDevOpsGuruFullAccess
策略包含以下语句。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DevOpsGuruFullAccess", "Effect": "Allow", "Action": [ "devops-guru:*" ], "Resource": "*" }, { "Sid": "CloudFormationListStacksAccess", "Effect": "Allow", "Action": [ "cloudformation:DescribeStacks", "cloudformation:ListStacks" ], "Resource": "*" }, { "Sid": "CloudWatchGetMetricDataAccess", "Effect": "Allow", "Action": [ "cloudwatch:GetMetricData" ], "Resource": "*" }, { "Sid": "SnsListTopicsAccess", "Effect": "Allow", "Action": [ "sns:ListTopics", "sns:ListSubscriptionsByTopic" ], "Resource": "*" }, { "Sid": "SnsTopicOperations", "Effect": "Allow", "Action": [ "sns:CreateTopic", "sns:GetTopicAttributes", "sns:SetTopicAttributes", "sns:Subscribe", "sns:Publish" ], "Resource": "arn:aws:sns:*:*:DevOps-Guru-*" }, { "Sid": "DevOpsGuruSlrCreation", "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "arn:aws:iam::*:role/aws-service-role/devops-guru.amazonaws.com/AWSServiceRoleForDevOpsGuru", "Condition": { "StringLike": { "iam:AWSServiceName": "devops-guru.amazonaws.com" } } }, { "Sid": "DevOpsGuruSlrDeletion", "Effect": "Allow", "Action": [ "iam:DeleteServiceLinkedRole", "iam:GetServiceLinkedRoleDeletionStatus" ], "Resource": "arn:aws:iam::*:role/aws-service-role/devops-guru.amazonaws.com/AWSServiceRoleForDevOpsGuru" }, { "Sid": "RDSDescribeDBInstancesAccess", "Effect": "Allow", "Action": [ "rds:DescribeDBInstances" ], "Resource": "*" }, { "Sid": "CloudWatchLogsFilterLogEventsAccess", "Effect": "Allow", "Action": [ "logs:FilterLogEvents" ], "Resource": "arn:aws:logs:*:*:log-group:*", "Condition": { "StringEquals": { "aws:ResourceTag/DevOps-Guru-Analysis": "true" } } } ] }
AmazonDevOpsGuruConsoleFullAccess
AmazonDevOpsGuruConsoleFullAccess
— 提供对 DevOps Guru 的完全访问权限,包括创建亚马逊SNS主题、访问亚马逊 CloudWatch指标和访问 AWS CloudFormation 堆栈的权限。此策略具有额外的性能见解权限,因此您可以在控制台中查看与异常 Amazon A RDS urora 数据库实例相关的详细分析。仅适用于您想要授予对 Guru 完全控制权的管理员级别用户。 DevOps
AmazonDevOpsGuruConsoleFullAccess
策略包含以下语句。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DevOpsGuruFullAccess", "Effect": "Allow", "Action": [ "devops-guru:*" ], "Resource": "*" }, { "Sid": "CloudFormationListStacksAccess", "Effect": "Allow", "Action": [ "cloudformation:DescribeStacks", "cloudformation:ListStacks" ], "Resource": "*" }, { "Sid": "CloudWatchGetMetricDataAccess", "Effect": "Allow", "Action": [ "cloudwatch:GetMetricData" ], "Resource": "*" }, { "Sid": "SnsListTopicsAccess", "Effect": "Allow", "Action": [ "sns:ListTopics", "sns:ListSubscriptionsByTopic" ], "Resource": "*" }, { "Sid": "SnsTopicOperations", "Effect": "Allow", "Action": [ "sns:CreateTopic", "sns:GetTopicAttributes", "sns:SetTopicAttributes", "sns:Subscribe", "sns:Publish" ], "Resource": "arn:aws:sns:*:*:DevOps-Guru-*" }, { "Sid": "DevOpsGuruSlrCreation", "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "arn:aws:iam::*:role/aws-service-role/devops-guru.amazonaws.com/AWSServiceRoleForDevOpsGuru", "Condition": { "StringLike": { "iam:AWSServiceName": "devops-guru.amazonaws.com" } } }, { "Sid": "DevOpsGuruSlrDeletion", "Effect": "Allow", "Action": [ "iam:DeleteServiceLinkedRole", "iam:GetServiceLinkedRoleDeletionStatus" ], "Resource": "arn:aws:iam::*:role/aws-service-role/devops-guru.amazonaws.com/AWSServiceRoleForDevOpsGuru" }, { "Sid": "RDSDescribeDBInstancesAccess", "Effect": "Allow", "Action": [ "rds:DescribeDBInstances" ], "Resource": "*" }, { "Sid": "PerformanceInsightsMetricsDataAccess", "Effect": "Allow", "Action": [ "pi:GetResourceMetrics", "pi:DescribeDimensionKeys" ], "Resource": "*" }, { "Sid": "CloudWatchLogsFilterLogEventsAccess", "Effect": "Allow", "Action": [ "logs:FilterLogEvents" ], "Resource": "arn:aws:logs:*:*:log-group:*", "Condition": { "StringEquals": { "aws:ResourceTag/DevOps-Guru-Analysis": "true" } } } ] }
AmazonDevOpsGuruReadOnlyAccess
AmazonDevOpsGuruReadOnlyAccess
— 授予对 DevOps Guru 和其他 AWS 服务中相关资源的只读访问权限。将此政策应用于您希望授予其查看见解的权限,但不允许其对 DevOps Guru 的分析覆盖范围、Amazon SNS 主题或 Systems Manager OpsCenter 集成进行任何更新的用户。
AmazonDevOpsGuruReadOnlyAccess
策略包含以下语句。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DevOpsGuruReadOnlyAccess", "Effect": "Allow", "Action": [ "devops-guru:DescribeAccountHealth", "devops-guru:DescribeAccountOverview", "devops-guru:DescribeAnomaly", "devops-guru:DescribeEventSourcesConfig", "devops-guru:DescribeFeedback", "devops-guru:DescribeInsight", "devops-guru:DescribeResourceCollectionHealth", "devops-guru:DescribeServiceIntegration", "devops-guru:GetCostEstimation", "devops-guru:GetResourceCollection", "devops-guru:ListAnomaliesForInsight", "devops-guru:ListEvents", "devops-guru:ListInsights", "devops-guru:ListAnomalousLogGroups", "devops-guru:ListMonitoredResources", "devops-guru:ListNotificationChannels", "devops-guru:ListRecommendations", "devops-guru:SearchInsights", "devops-guru:StartCostEstimation" ], "Resource": "*" }, { "Sid": "CloudFormationListStacksAccess", "Effect": "Allow", "Action": [ "cloudformation:DescribeStacks", "cloudformation:ListStacks" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "iam:GetRole" ], "Resource": "arn:aws:iam::*:role/aws-service-role/devops-guru.amazonaws.com/AWSServiceRoleForDevOpsGuru" }, { "Sid": "CloudWatchGetMetricDataAccess", "Effect": "Allow", "Action": [ "cloudwatch:GetMetricData" ], "Resource": "*" }, { "Sid": "RDSDescribeDBInstancesAccess", "Effect": "Allow", "Action": [ "rds:DescribeDBInstances" ], "Resource": "*" }, { "Sid": "SnsListTopicsAccess", "Effect": "Allow", "Action": [ "sns:ListTopics", "sns:ListSubscriptionsByTopic" ], "Resource": "*" }, { "Sid": "CloudWatchLogsFilterLogEventsAccess", "Effect": "Allow", "Action": [ "logs:FilterLogEvents" ], "Resource": "arn:aws:logs:*:*:log-group:*", "Condition": { "StringEquals": { "aws:ResourceTag/DevOps-Guru-Analysis": "true" } } } ] }
AmazonDevOpsGuruOrganizationsAccess
AmazonDevOpsGuruOrganizationsAccess
— 让 Organizations 管理员可以访问组织内的 DevOps Guru 多账户视图。将此策略应用于您组织的管理员级别用户,您要向其授予组织内的 DevOps Guru 完全访问权限。您可以将此策略应用于您组织的管理账户和 DevOps Guru 的委托管理员帐户。您可以应用AmazonDevOpsGuruReadOnlyAccess
或AmazonDevOpsGuruFullAccess
补充本政策,为 DevOps Guru 提供只读或完全访问权限。
AmazonDevOpsGuruOrganizationsAccess
策略包含以下语句。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AmazonDevOpsGuruOrganizationsAccess", "Effect": "Allow", "Action": [ "devops-guru:DescribeOrganizationHealth", "devops-guru:DescribeOrganizationResourceCollectionHealth", "devops-guru:DescribeOrganizationOverview", "devops-guru:ListOrganizationInsights", "devops-guru:SearchOrganizationInsights" ], "Resource": "*" }, { "Sid": "OrganizationsDataAccess", "Effect": "Allow", "Action": [ "organizations:DescribeAccount", "organizations:DescribeOrganization", "organizations:ListAWSServiceAccessForOrganization", "organizations:ListAccounts", "organizations:ListChildren", "organizations:ListOrganizationalUnitsForParent", "organizations:ListRoots" ], "Resource": "arn:aws:organizations::*:" }, { "Sid": "OrganizationsAdminDataAccess", "Effect": "Allow", "Action": [ "organizations:DeregisterDelegatedAdministrator", "organizations:RegisterDelegatedAdministrator", "organizations:ListDelegatedAdministrators", "organizations:EnableAWSServiceAccess", "organizations:DisableAWSServiceAccess" ], "Resource": "*", "Condition": { "StringEquals": { "organizations:ServicePrincipal": [ "devops-guru.amazonaws.com" ] } } } ] }