Adding an Amazon Web Services (AWS) source to cost management

Cost Management Service 2021

Learn how to add and configure your AWS sources

Red Hat Customer Content Services

Abstract

This guide describes how to add an Amazon Web Services (AWS) source to cost management.

Chapter 1. Adding an Amazon Web Services (AWS) source to cost management

To add an AWS account to cost management, you must configure your AWS account to provide metrics, then add your AWS account as a source from the cost management user interface.

Note

You must have a Red Hat account user with Sources Administrator entitlements before you can add sources to cost management.

When you add your AWS account as a source, this creates a read-only connection to AWS in order to collect cost information hourly in cost management, but does not make any changes to the AWS account.

Before you can add your AWS account to cost management as a data source, you must configure the following services on your AWS account to allow cost management access to metrics:

  1. An S3 bucket to store cost and usage data reporting for cost management
  2. An Identity Access Management (IAM) policy and role for cost management to process the cost and usage data

As you will complete some of the following steps in the AWS console, and some steps in the cost management user interface, keep both applications open in a web browser.

Add your AWS source to cost management from the settings area at https://console.redhat.com/settings/sources.

Note

As non-Red Hat products and documentation can change without notice, instructions for configuring the third-party sources provided in this guide are general and correct at the time of publishing. See the AWS documentation for the most up-to-date and accurate information.

1.1. Creating an S3 bucket for reporting

Cost management requires an Amazon S3 bucket with permissions configured to store billing reports.

Log into your AWS account to begin configuring cost and usage reporting:

  1. In the AWS S3 console, create a new S3 bucket or use an existing bucket. If you are configuring a new S3 bucket, accept the default settings.
  2. In the AWS Billing console, create a Cost and Usage Report that will be delivered to your S3 bucket. Specify the following values (and accept the defaults for any other values):

    • Report name: <any-name> (note this name as you will use it later)
    • Additional report details: Include resource IDs
    • S3 bucket: <the S3 bucket you configured previously>
    • Time granularity: Hourly
    • Enable report data integration for: Amazon Redshift, Amazon QuickSight (do not enable report data integration for Amazon Athena)
    • Compression type: GZIP
    • Report path prefix: cost

      Note

      See the AWS Billing and Cost Management documentation for more details on configuration.

  3. In the console.redhat.com platform, open the Sources menu (https://console.redhat.com/settings/sources) to begin adding an AWS source to cost management:

    1. Navigate to Sources and click Add a source to open the Sources wizard.
    2. Enter a name for your source and click Next.
    3. Select cost management as the application and Amazon Web Services (AWS) as the source type. Click Next.
    4. Paste the name of your S3 bucket and click Next.

1.2. Activating AWS tags for cost management

To use tags to organize your AWS resources in the cost management application, activate your tags in AWS to allow them to be imported automatically.

Procedure

  1. In the AWS Billing console:

    1. Open the Cost Allocation Tags section.
    2. Select the tags you want to use in the cost management application, and click Activate.
  2. In the console.redhat.com Sources wizard, click Next to move to the next screen.

1.3. Enabling minimal account access for cost and usage consumption

To provide data within the web interface and API, cost management needs to consume the Cost and Usage Reports produced by AWS. For cost management to obtain this data with a minimal amount of access, create an IAM policy and role for cost management to use. This configuration provides access to the stored information and nothing else.

Procedure

  1. From the AWS Identity and Access Management (IAM) console, create a new IAM policy for the S3 bucket you configured previously.

    1. Select the JSON tab and paste the following content in the JSON policy text box:

      {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
              "s3:Get*",
              "s3:List*"
            ],
              "Resource": [
              "arn:aws:s3:::bucket_name",
              "arn:aws:s3:::bucket_name/*"
            ]
          },
      
          {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
              "s3:ListBucket",
              "cur:DescribeReportDefinitions"
            ],
            "Resource": "*"
          }
        ]
      }
  1. Provide a name for the policy and complete the creation of the policy. Keep the AWS IAM console open as you will need it for the next step.

    1. In the console.redhat.com Sources wizard, click Next to move to the next screen.
    2. In the AWS IAM console, create a new IAM role:
  2. For the type of trusted entity, select Another AWS account.
  3. Enter 589173575009 as the Account ID to provide the cost management application with read access to the AWS account cost data.
  4. Attach the IAM policy you just configured.
  5. Enter a role name (and description if desired) and finish creating the policy.

    1. In the console.redhat.com Sources wizard, click Next to move to the next screen.
    2. In the AWS IAM console under Roles, open the summary screen for the role you just created and copy the Role ARN (a string beginning with arn:aws:).
    3. In the console.redhat.com Sources wizard, paste your Role ARN and click Next.
    4. Review the details and click Finish to add the AWS account to cost management.

Cost management will begin collecting cost and usage data from your AWS account and any linked AWS accounts.

The data can take a few days to populate before it shows on the cost management dashboard (console.redhat.com/openshift/cost-management/).

1.3.1. Enabling additional account access for cost and usage consumption

Cost management can display additional data that might be useful. For example:

  • Include the Action iam:ListAccountAliases to display an AWS account alias rather than an account number in cost management.
  • Include the Actions organization:List* and organizations:Describe* to obtain the display names of AWS member accounts if you are using consolidated billing rather than the account ID.

The following configuration provides access to additional stored information and nothing else.

Procedure

  1. From the AWS Identity and Access Management (IAM) console, create a new IAM policy for the S3 bucket you configured previously.
  2. Select the JSON tab and paste the following content in the JSON policy text box:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "VisualEditor0",
          "Effect": "Allow",
          "Action": [
            "s3:Get*",
            "s3:List*"
          ],
          "Resource": [
            "arn:aws:s3:::bucket",
            "arn:aws:s3:::bucket/*"
          ]
        },
        {
          "Sid": "VisualEditor1",
          "Effect": "Allow",
          "Action": [
            "iam:ListAccountAliases",
            "s3:ListBucket",
            "cur:DescribeReportDefinitions",
            "organizations:List*",
            "organizations:Describe*"
          ],
          "Resource": "*"
        }
      ]
    }

    The remainder of the configuration steps are the same as in Section 1.3, “Enabling minimal account access for cost and usage consumption”

1.4. Configuring AWS billing plans

By default, cost management calculates AWS cost according to your usage cost for that date. If you have a special billing arrangement with AWS such as amortized billing or blended rates, you can configure these calculations from the cost management settings page. This allows your cost reports to more accurately reflect your AWS billing.

For more information on AWS billing, see Understanding Consolidated Bills in the AWS documentation.

Cost management supports three cost calculation options to accommodate AWS billing plans:

Unblended (Default)
Your costs are calculated according to your usage cost for that date.
Amortized
Your recurring and upfront costs will be distributed evenly throughout the billing period.
Blended
Your costs are calculated according to AWS blended rates.

This procedure describes how to set your cost calculation to Amortized or Blended from the default Unblended.

Prerequisites

  • AWS source added to cost management.
  • Access to console.redhat.com as an Organization Administrator.

Procedure

  1. From console.redhat.com, navigate to the cost management settings page.
  2. Under Show cost as select Amortized or Blended.
  3. Click Save.

Chapter 2. Next steps for managing your costs

After adding your OpenShift Container Platform and Amazon Web Services sources, in addition to showing cost data by source, cost management will automatically show AWS cost and usage related to running your OpenShift Container Platform clusters on their platform.

On the cost management Overview page (console.redhat.com/openshift/cost-management/), your cost data will be sorted into OpenShift and Infrastructure tabs. From here, you can use Perspective to select different views of your cost data.

You can also use the left navigation menu to view the additional details of your costs by service.

2.1. Limit access to cost management resources

After adding and configuring sources in cost management, it is a good idea to limit access to cost data and resources. For example, you may not want users to have access to all cost data, but instead only data specific to their projects or organization. Using role-based access control, you can limit the visibility of resources involved in cost management reports. For example, you may want to restrict a user’s view to only AWS sources, instead of the entire environment.

For more information about limiting access see, Limiting access to cost management resources.

2.2. Configure tagging for your sources

The cost management application tracks cloud and infrastructure costs using tags (called labels in OpenShift), which you can refine to filter and attribute to resources. Tags in cost management allow you to organize your resources by cost and to allocate the costs to different parts of your cloud infrastructure.

Important

Tags and labels can only be configured directly on a source. While you can choose what tags are activated in cost management, you cannot edit tags and labels in the cost management application.

See Managing cost data using tagging to learn more about:

  • Planning your tagging strategy to organize your view of cost data.
  • Understanding how cost management associates tags.
  • Configuring tags and labels on your sources.

2.3. Configure cost models to accurately report costs

Now that you have configured your sources to collect cost and usage data into cost management, you can configure cost models to associate prices to metrics and usage, and fine-tune the costs of running your cloud.

A cost model is a framework used to define the calculations for the costs stored in cost management, using raw costs and metrics. Costs generated by a cost model can be recorded, categorized and distributed to specific customers, business units or projects.

From the Cost Models area of cost management, you can:

  • Classify your costs as infrastructure or supplementary costs.
  • Capture monthly costs for OpenShift nodes and clusters.
  • Apply a markup to account for additional support costs.
  • Learn how to configure a cost model in Using cost models.

2.4. Use the Cost Explorer to visualize your costs

The cost management Cost Explorer allows you to create custom graphs of time-scaled cost and usage information to better visualize and interpret your costs.

See Visualizing your costs using Cost Explorer to learn more about:

  • Using Cost Explorer to identify abnormal events.
  • Understanding how your cost data changes over time.
  • Creating custom bar charts of your cost and usage data.
  • Exporting custom cost data tables.

Legal Notice

Copyright © 2021 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.