Using service-linked roles for Cost Optimization Hub - Amazon Cost Management
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Using service-linked roles for Cost Optimization Hub

Cost Optimization Hub uses Amazon Identity and Access Management (IAM) service-linked roles. A service-linked role is a unique type of IAM role that is linked directly to Cost Optimization Hub. Service-linked roles are predefined by Cost Optimization Hub and include all the permissions that the service requires to call other Amazon services on your behalf.

A service-linked role makes setting up Cost Optimization Hub easier because you don’t have to manually add the necessary permissions. Cost Optimization Hub defines the permissions of its service-linked roles, and unless defined otherwise, only Cost Optimization Hub 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.

For information about other services that support service-linked roles, see Amazon services that work with IAM and look for 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 Cost Optimization Hub

Cost Optimization Hub uses the service-linked role named AWSServiceRoleForCostOptimizationHub, which enables access to Amazon services and resources used or managed by Cost Optimization Hub.

The AWSServiceRoleForCostOptimizationHub service-linked role trusts the cost-optimization-hub.bcm.amazonaws.com service to assume the role.

The role permissions policy, CostOptimizationHubServiceRolePolicy, allows Cost Optimization Hub to complete the following actions on the specified resources:

  • organizations:DescribeOrganization

  • organizations:ListAccounts

  • organizations:ListAWSServiceAccessForOrganization

  • organizations:ListParents

  • organizations:DescribeOrganizationalUnit

  • ce:ListCostAllocationTags

For more information, see Allows Cost Optimization Hub to call services required to make the service work.

To view the full permissions details of the service-linked role AWSServiceRoleForCostOptimizationHub, go to the Amazon Cost Management console, choose Settings, and then choose View IAM service-linked role permissions.

You must configure permissions to allow an IAM entity (such as a user, group, or role) to create, edit, or delete a service-linked role. For more information, see Service-linked role permissions in the IAM User Guide.

Creating the Cost Optimization Hub service-linked role

You don't need to manually create a service-linked role. When you enable Cost Optimization Hub, the service automatically creates the service-linked role for you. You can enable Cost Optimization Hub through the Amazon Cost Management console, or via the API or Amazon CLI. For more information, see Enable Cost Optimization Hub in this user guide.

If you delete this service-linked role, and then need to create it again, you can use the same process to recreate the role in your account.

Editing the Cost Optimization Hub service-linked role

Cost Optimization Hub doesn't allow you to edit the AWSServiceRoleForCostOptimizationHub 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 using IAM. For more information, see Editing a service-linked role in the IAM User Guide.

To allow an IAM entity to edit the description of the AWSServiceRoleForCostOptimizationHub service-linked role

Add the following statement to the permissions policy for the IAM entity that needs to edit the description of a service-linked role.

{ "Effect": "Allow", "Action": [ "iam:UpdateRoleDescription" ], "Resource": "arn:aws:iam::*:role/aws-service-role/cost-optimization-hub.bcm.amazonaws.com/AWSServiceRoleForCostOptimizationHub", "Condition": {"StringLike": {"iam:AWSServiceName": "cost-optimization-hub.bcm.amazonaws.com"}} }

Deleting the Cost Optimization Hub service-linked role

If you no longer need to use Cost Optimization Hub, we recommend that you delete the AWSServiceRoleForCostOptimizationHub service-linked role. That way, you don't have an unused entity that isn't actively monitored or maintained. However, before you can manually delete the service-linked role, you must opt out of Cost Optimization Hub.

To opt out of Cost Optimization Hub

For information about opting out of Cost Optimization Hub, see Opting out of Cost Optimization Hub.

To manually delete the service-linked role using IAM

Use the IAM console, the Amazon Command Line Interface (Amazon CLI), or the Amazon API to delete the AWSServiceRoleForCostOptimizationHub service-linked role. For more information, see Deleting a Service-Linked Role in the IAM User Guide.

Supported Regions for Cost Optimization Hub service-linked roles

Cost Optimization Hub supports using service-linked roles in all of the Amazon Regions where the service is available. For more information, see Amazon service endpoints.