Service-linked roles for Security Hub - AWS Security Hub

Service-linked roles for Security Hub

AWS Security Hub uses an AWS Identity and Access Management (IAM) service-linked role named AWSServiceRoleForSecurityHub. This service-linked role is an IAM role that's linked directly to Security Hub. It's predefined by Security Hub, and it includes all the permissions that Security Hub requires to call other AWS services and monitor AWS resources on your behalf. Security Hub uses this service-linked role in all the AWS Regions where Security Hub is available.

A service-linked role makes setting up Security Hub easier because you don't have to manually add the necessary permissions. Security Hub defines the permissions of its service-linked role, and unless the permissions are defined otherwise, only Security Hub can assume the role. The defined permissions include the trust policy and the permissions policy, and you can't attach that permissions policy to any other IAM entity.

To view the details of the service-linked role, on the Settings page of the Security Hub console, choose General and then View service permissions.

You can delete the Security Hub service-linked role only after first disabling Security Hub in all Regions where it's enabled. This protects your Security Hub resources because you can't inadvertently remove permissions to access them.

For information about other services that support service-linked roles, see AWS services that work with IAM in the IAM User Guide and locate the services that have Yes in the Service-Linked Role column. Choose a Yes with a link to view the service-linked role documentation for that service.

Service-linked role permissions for Security Hub

Security Hub uses the service-linked role named AWSServiceRoleForSecurityHub. It's a service-linked role required for AWS Security Hub to access your resources. The service-linked role lets Security Hub receive findings from other AWS services and configure the requisite AWS Config infrastructure to run security checks for controls.

The AWSServiceRoleForSecurityHub service-linked role trusts the following services to assume the role:

  • securityhub.amazonaws.com

The AWSServiceRoleForSecurityHub service-linked role uses the managed policy AWSSecurityHubServiceRolePolicy.

You must grant permissions to allow an IAM identity (such as a role, group, or user) to create, edit, or delete a service-linked role. For the AWSServiceRoleForSecurityHub service-linked role to be successfully created, the IAM identity that you use to access Security Hub must have the required permissions. To grant the required permissions, attach the following policy to the role, group, or user.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "securityhub:*", "Resource": "*" }, { "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "*", "Condition": { "StringLike": { "iam:AWSServiceName": "securityhub.amazonaws.com" } } } ] }

Creating a service-linked role for Security Hub

The AWSServiceRoleForSecurityHub service-linked role is automatically created when you enable Security Hub for the first time or enable Security Hub in a supported Region where you previously didn't have it enabled. You can also create the AWSServiceRoleForSecurityHub service-linked role manually using the IAM console, the IAM CLI, or the IAM API.

Important

The service-linked role that is created for the Security Hub administrator account doesn't apply to the Security Hub member accounts.

For more information about creating the role manually, see Creating a service-linked role in the IAM User Guide.

Editing a service-linked role for Security Hub

Security Hub doesn't allow you to edit the AWSServiceRoleForSecurityHub service-linked role. After you create a service-linked role, you can't change the name of the role because various entities might reference the role. However, you can edit the description of the role by using IAM. For more information, see Editing a service-linked role in the IAM User Guide.

Deleting a service-linked role for Security Hub

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 isn't actively monitored or maintained.

Important

To delete the AWSServiceRoleForSecurityHub service-linked role, you must first disable Security Hub in all Regions where it's enabled.

If Security Hub isn't disabled when you try to delete the service-linked role, the deletion fails. For more information, see Disabling Security Hub.

When you disable Security Hub, the AWSServiceRoleForSecurityHub service-linked role is not automatically deleted. If you enable Security Hub again, it starts using the existing AWSServiceRoleForSecurityHub service-linked role.

To manually delete the service-linked role using IAM

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