Red Hat Lightspeed cost management API
About
Optimize your multicloud operations with the Red Hat Lightspeed cost management API cheat sheet. Whether you are automating financial reports or tracking project-level spending, this guide provides the key endpoints and commands you need for programmatic analysis across on-premises and cloud environments.
The cost management API cheat sheet covers:
- API authentication: Learn how to securely access the Hybrid Cloud Console using service account tokens and OAuth2 client credentials.
- OpenShift cost monitoring: Retrieve granular data for clusters, nodes, and projects, including specific metrics for CPU, memory, and storage usage.
- Multicloud spend analysis: Access specialized reporting endpoints for AWS, Azure, and Google Cloud to break down costs by account, region, or service.
- Advanced filtering and tagging: Organize and group your results using metadata tags or OpenShift labels, while customizing time ranges for precise reporting.
- Resource optimization: Discover how to find automated recommendations within the API to improve efficiency and reduce spending across your clusters.
Excerpt
Get your token by running the following curl command:
curl -v \
-d "client_id=CLIENT_ID" \
-d "client_secret=CLIENT_SECRET" \
-d "grant_type=client_credentials" \
-d "scope=api.console" \
"https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token"Use the token in an API request with curl:
curl --location \ 'https://console.redhat.com/api/cost-management/api/cost-management/v1/reports/openshift/costs/?group_by[project]=*' \
--header 'Authorization: Bearer ACCESS_TOKEN'