Using service-linked roles for DevOps Guru - Amazon DevOps Guru

Using service-linked roles for DevOps Guru

Amazon DevOps Guru uses AWS Identity and Access Management (IAM) service-linked roles. A service-linked role is a unique type of IAM role that is linked directly to DevOps Guru. Service-linked roles are predefined by DevOps Guru and include all the permissions that the service requires to call AWS CloudTrail, Amazon CloudWatch, AWS CodeDeploy, AWS X-Ray, and AWS Organizations on your behalf.

A service-linked role makes setting up DevOps Guru easier because you don’t have to manually add the necessary permissions. DevOps Guru defines the permissions of its service-linked roles, and unless defined otherwise, only DevOps Guru can assume its roles. The defined permissions include the trust policy and the permissions policy, and that permissions policy cannot be attached to any other IAM entity.

You can delete a service-linked role only after first deleting its related resources. This protects your DevOps Guru resources because you can't inadvertently remove permission to access the resources.

Service-linked role permissions for DevOps Guru

DevOps Guru uses the service-linked role named AWSServiceRoleForDevOpsGuru. This is an AWS managed policy with scoped permissions that DevOps Guru needs to run in your account.

The AWSServiceRoleForDevOpsGuru service-linked role trusts the following service to assume the role:


The role permissions policy, AmazonDevOpsGuruServiceRolePolicy allows DevOps Guru to complete the following actions on the specified resources.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "autoscaling:DescribeAutoScalingGroups", "cloudtrail:LookupEvents", "cloudwatch:GetMetricData", "cloudwatch:ListMetrics", "cloudwatch:DescribeAnomalyDetectors", "cloudwatch:DescribeAlarms", "cloudwatch:ListDashboards", "cloudwatch:GetDashboard", "cloudformation:GetTemplate", "cloudformation:ListStacks", "cloudformation:ListStackResources", "cloudformation:DescribeStacks", "cloudformation:ListImports", "codedeploy:BatchGetDeployments", "codedeploy:GetDeploymentGroup", "codedeploy:ListDeployments", "config:DescribeConfigurationRecorderStatus", "config:GetResourceConfigHistory", "events:ListRuleNamesByTarget", "xray:GetServiceGraph", "organizations:ListRoots", "organizations:ListChildren", "organizations:ListDelegatedAdministrators", "pi:GetResourceMetrics", "tag:GetResources", "lambda:GetFunction", "lambda:GetFunctionConcurrency", "lambda:GetAccountSettings", "lambda:ListProvisionedConcurrencyConfigs", "lambda:ListAliases", "lambda:ListEventSourceMappings", "lambda:GetPolicy", "ec2:DescribeSubnets", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingPolicies", "sqs:GetQueueAttributes", "kinesis:DescribeStream", "kinesis:DescribeLimits", "dynamodb:DescribeTable", "dynamodb:DescribeLimits", "dynamodb:DescribeContinuousBackups", "dynamodb:DescribeStream", "dynamodb:ListStreams", "elasticloadbalancing:DescribeLoadBalancers", "elasticloadbalancing:DescribeLoadBalancerAttributes", "rds:DescribeDBInstances", "rds:DescribeDBClusters", "rds:DescribeOptionGroups", "rds:DescribeDBClusterParameters", "rds:DescribeDBInstanceAutomatedBackups", "rds:DescribeAccountAttributes", "logs:DescribeLogGroups", "logs:DescribeLogStreams", "s3:GetBucketNotification", "s3:GetBucketPolicy", "s3:GetBucketPublicAccessBlock", "s3:GetBucketTagging", "s3:GetBucketWebsite", "s3:GetIntelligentTieringConfiguration", "s3:GetLifecycleConfiguration", "s3:GetReplicationConfiguration", "s3:ListAllMyBuckets", "s3:ListStorageLensConfigurations", "servicequotas:GetServiceQuota", "servicequotas:ListRequestedServiceQuotaChangeHistory", "servicequotas:ListServiceQuotas" ], "Resource": "*" }, { "Sid": "AllowPutTargetsOnASpecificRule", "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule" ], "Resource": "arn:aws:events:*:*:rule/DevOps-Guru-managed-*" }, { "Sid": "AllowCreateOpsItem", "Effect": "Allow", "Action": [ "ssm:CreateOpsItem" ], "Resource": "*" }, { "Sid": "AllowAddTagsToOpsItem", "Effect": "Allow", "Action": [ "ssm:AddTagsToResource" ], "Resource": "arn:aws:ssm:*:*:opsitem/*" }, { "Sid": "AllowAccessOpsItem", "Effect": "Allow", "Action": [ "ssm:GetOpsItem", "ssm:UpdateOpsItem" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/DevOps-GuruInsightSsmOpsItemRelated": "true" } } }, { "Sid": "AllowCreateManagedRule", "Effect": "Allow", "Action": "events:PutRule", "Resource": "arn:aws:events:*:*:rule/DevOpsGuruManagedRule*" }, { "Sid": "AllowAccessManagedRule", "Effect": "Allow", "Action": [ "events:DescribeRule", "events:ListTargetsByRule" ], "Resource": "arn:aws:events:*:*:rule/DevOpsGuruManagedRule*" }, { "Sid": "AllowOtherOperationsOnManagedRule", "Effect": "Allow", "Action": [ "events:DeleteRule", "events:EnableRule", "events:DisableRule", "events:PutTargets", "events:RemoveTargets" ], "Resource": "arn:aws:events:*:*:rule/DevOpsGuruManagedRule*", "Condition": { "StringEquals": { "events:ManagedBy": "" } } }, { "Sid": "AllowTagBasedFilterLogEvents", "Effect": "Allow", "Action": [ "logs:FilterLogEvents" ], "Resource": "arn:aws:logs:*:*:log-group:*", "Condition": { "StringEquals": { "aws:ResourceTag/DevOps-Guru-Analysis": "true" } } }, { "Sid": "AllowAPIGatewayGetIntegrations", "Effect": "Allow", "Action": "apigateway:GET", "Resource": [ "arn:aws:apigateway:*::/restapis/??????????", "arn:aws:apigateway:*::/restapis/*/resources", "arn:aws:apigateway:*::/restapis/*/resources/*/methods/*/integration" ] } ] }

Creating a service-linked role for DevOps Guru

You don't need to manually create a service-linked role. When you create an insight in the AWS Management Console, the AWS CLI, or the AWS API, DevOps Guru creates the service-linked role for you.


This service-linked role can appear in your account if you completed an action in another service that uses the features supported by this role; for example, it can appear if you added DevOps Guru to a repository from AWS CodeCommit.

Editing a service-linked role for DevOps Guru

DevOps Guru does not allow you to edit the AWSServiceRoleForDevOpsGuru service-linked role. After you create a service-linked role, you cannot change the name of the role because various entities might reference the role. However, you can edit the description of the role using IAM. For more information, see Editing a Service-Linked Role in the IAM User Guide.

Deleting a service-linked role for DevOps Guru

If you no longer need to use a feature or service that requires a service-linked role, we recommend that you delete that role. That way you don’t have an unused entity that is not actively monitored or maintained. However, you must disassociate from all repositories before you can manually delete it.


If the DevOps Guru service is using the role when you try to delete the resources, the deletion might fail. If that happens, wait for a few minutes and try the operation again.

To manually delete the service-linked role using IAM

Use the IAM console, the AWS CLI, or the AWS API to delete the AWSServiceRoleForDevOpsGuru service-linked role. For more information, see Deleting a Service-Linked Role in the IAM User Guide.