Cloud Experts Documentation

Red Hat Cost Management for Cloud Services

This content is authored by Red Hat experts, but has not yet been tested on every supported configuration.

Adopted from Official Documentation for Cost Management Service

Red Hat Cost Management is a software as a service (SaaS) offering available free of charge as part of your Red Hat subscriptions. Cost management helps you monitor and analyze your OpenShift Container Platform and Public cloud costs in order to improve the management of your business.

Some capabilities of cost management are :

  • Visualize costs across hybrid cloud infrastructure
  • Track cost trends
  • Map charges to projects and organizations
  • Normalize data and add markups with cost models
  • Generate showback and chargeback information

In this document, I will show you how to connect your OpenShift and Cloud provider sources to Cost Management in order to collect cost and usage.

Prerequisites

  • A Public Cloud subscritption (Azure Subscription)
  • An OpenShift Cluster (to create an Azure Red Hat OpenShift (ARO) cluster, click here )

Adding your OpenShift source to Cost Management

Installing the Cost Management Metric Operator

  1. Log into the Openshift cluster web console with cluster-admin credentials

  2. On the left navigation pane under Administator perspective, select Operators –> OperatorHub

    Operators view
  3. Search for and locate cost management metrics operator. Click on the displayed Cost Management Metrics Operator

    Operatorhub
  4. When the Install Operator window appears, you must select the costmanagement-metrics-operator namespace for installation. If it does not exist, it will be created for you. Click on install button.

  5. After a short wait, Cost Management Metrics Operator appears in the Installed Operators tab under Project: all Projects or Project: costmanagement-metrics-operator

Configuring the Operator instance for a new installation

  1. Once installed, click on the Cost Management

  2. In the detail window, click + Create Instance

  3. A Cost Management Metrics Operator > Create CostManagementMetricsConfig window appears

  4. Click the YAML view radio button to view and modify the contents of the YAML configuration file

    Cost management Metrics Config
  5. Modify the following two lines in the YAML file to look like the following

    create_source: true
    name: <SOURCE-NAME>
    

    Change SOURCE-NAME to the new name of your source (ex. my-openshift-cost-source) Change false to true

  6. Click the Create button. This creates a new source for cost management that will appear in the console.redhat.com Cost Management applications

Adding your Microsoft Azure source to Cost Management

1. Configuring your Microsoft Azure

The following steps are required to configure your Azure account to be a cost management source

  1. Creating a storage account and resource group
  2. Configuring a storage account contributor and reader roles for access
  3. Scheduling daily exports

1.1 Creating an Azure resource group and storage account using Azure CLI

  1. First create a new resource group

    az group create \
     --name storage-resource-group \
     --location eastus
    
  2. If you’re not sure which region to specify for the --location parameter, you can retrieve a list of supported regions for your subscription with the az account list-locations command.

    az account list-locations \
     --query "[].{Region:name}" \
     --out table
    
  3. Next, create a standard general-purpose v2 storage account with read-access geo-redundant storage. Ensure the name of your storage account is unique across Azure

    az storage account create \
     --name <account-name> \
     --resource-group storage-resource-group \
     --location eastus \
     --sku Standard_RAGRS \
     --kind StorageV2
    
  4. Make note of the resource group and storage account. We will need them in the subsequent steps

2. Creating a Microsoft Azure Source in your Red Hat account

  1. In the console.redhat.com click on All apps and services tab in the left top corner of the screen to navigate to this window. Click on Sources under Settings

    Access Sources link
  2. On Sources page, click on Cloud sources tab and then click Add a source. This opens up the Sources Wizard Console View

  3. Select Microsoft Azure as the source type and click next.

  4. Enter a name for your source and click next.

  5. Select cost management as the application click next.

  6. Enter resource group and storage account name created in the last step to collect cost data and metrics for cost management click next.

  7. Enter Subscription ID for your Azure account click next. Use the command given by the wizard to get Subscription ID.

  8. Use the command given by the wizard to create Service Principal and enter Tenant ID, Application ID and Application Secret.

  9. Click next, review the information and click add.

2.3 Configuring a Daily Azure data export schedule using Azure Portal

Cost management requires a data export from a Subscription level scope

  1. In the Azure Portal home page, click on Subscriptions

    Azure Portal home page
  2. Select the Subscription you want to track from the list, and then select Cost Analysis in the menu. At the top of the Cost analysis page, select configure subscription

    Cost Analysis view
  3. Click on the Export tab, and then Schedule export

    Schedule export
  4. In the Exports wizard, fill out the Export details

    Export details
    • For Export Type, select Daily export of billing-period-to-date costs

    • For Storage account, select the account you created earlier

    • Enter any value for the Container name and Directory path for the export. These values provide the tree structure in the storage account where report files are stored.

    • Click Create to start exporting data to the Azure storage container.

  5. Return to Sources wizard after creating the export schedule and click Next. Review the source details

  6. Click Finish to complete adding the Azure source to cost management

Cost management will begin polling Azure for cost data, which will appear on the cost management dashboard (console.redhat.com/openshift/cost-management/).

Adding your Amazon AWS source to Cost Management

  1. In the console.redhat.com click on All apps and services tab in the left top corner of the screen to navigate to this window. Click on Sources under Settings

    Access Sources link
  2. On Sources page, click on Cloud sources tab and then click Add a source. This opens up the Sources Wizard Console View

  3. Select Amazon Web Services as the source type and click next.

  4. Enter a name for your source and click next.

  5. To automatically configure your AWS account, select Account authorization option and provide Access Key ID and Access Secret Key. Click next.

  6. Select Cost Management option and click next.

  7. Review the information and click add.

Managing your Costs

After adding your Openshift Container Platform and Cloud Provider sources, Cost management will show cost data by

  1. Source

  2. Cloud provider cost and usage related to running your OpenShift Container Platform clusters on their platform

See the following video for a quick overview of Cost Management for OpenShift followed by a demo of the product on YouTubeexternal link (opens in new tab)

Next steps for managing your costs

  1. Limiting access to cost management resources - Use role-based access control to limit visibility of resources in cost management reports.

  2. Managing cost data using tagging - Tags allow you to organize your resources by cost and allocate the costs to different parts of your cloud infrastructure

  3. Using cost models - Configure cost models to associate prices to metrics and usage.

  4. Visualizing your costs using Cost Explorer - Allows you to see your costs through time.

Interested in contributing to these docs?

Collaboration drives progress. Help improve our documentation The Red Hat Way.

Red Hat logo LinkedIn YouTube Facebook Twitter

Products

Tools

Try, buy & sell

Communicate

About Red Hat

We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Subscribe to our newsletter, Red Hat Shares

Sign up now
© 2023 Red Hat, Inc.