Resources

Recommendations

A recommendation is one pending savings opportunity LevelFour found in your cloud accounts. Each one carries the affected service, the estimated monthly and annual savings, and the actions available on it: accept, reject, execute.

Pagination has the defaults, the page-size cap, and the auto-paginating iterators the examples below rely on.

Methods

MethodReturns
Get savings by providerA summary of potential savings grouped by cloud provider
Get potential savingsA potential savings summary grouped by provider
Get overviewTotal spend, available savings, pending savings and saved-to-date, across every provider
List recommendationsA paginated list of every recommendation. Sorts, does not filter
Get recommendationThe full detail for one recommendation
Get provider overviewThe same metrics as Get overview, for one provider
List by providerA paginated list for one provider, with filters
List in-progressEvery recommendation in processing status

Get savings by provider

Returns a summary of potential savings grouped by cloud provider (AWS, GCP, Azure, K8s).

summary = client.recommendations.get_savings_by_provider()

Get potential savings

Returns a potential savings summary grouped by provider.

potential = client.recommendations.get_potential_savings()

Get overview

Returns overview metrics across all providers: total spend, available savings, pending savings, and saved-to-date.

overview = client.recommendations.get_overview()

List recommendations

Returns a paginated list of every recommendation.

page = client.recommendations.list(
    page=1,
    page_size=50,
    sort_by="monthly_savings",
    sort_order="desc",
)

for rec in page:
    print(f"{rec.service}: ${rec.monthly_savings}/mo")

Parameters

ParameterTypeDescription
pageintPage number, 1-indexed
page_sizeintItems per page
sort_bystringSort field: recommendation_id, service, environment, monthly_savings, annual_savings, savings_percentage, analysis_period, created_at
sort_orderstringasc or desc
This list sorts and pages. It takes no filters: to narrow by service, environment, account, tag or status, use List by provider.

Get recommendation

Returns the full detail for one recommendation.

detail = client.recommendations.get("rec_123")

Get provider overview

Returns the same metrics as Get overview, scoped to a single provider: total spend, available savings, pending savings, and saved-to-date. Use it for a per-provider dashboard header.

overview = client.recommendations.get_provider_overview("aws")

List by provider

Returns a paginated per-provider recommendations list, filtered by service, environment, account, tag, and display status. Each row includes monthly and annual savings, current spend, and a savings percentage.

page = client.recommendations.list_by_provider(
    "aws",
    page=1,
    page_size=20,
    service=["EC2", "RDS"],
    environment=["production"],
    display_status=["available"],
    sort_by="monthly_savings",
    sort_order="desc",
)

for rec in page:
    print(f"{rec.service}: ${rec.monthly_savings}/mo")

Parameters

ParameterTypeDescription
pageintPage number, 1-indexed
page_sizeintItems per page
sort_bystringSort field: recommendation_id, service, environment, account, tag, monthly_savings, savings_percentage, status
sort_orderstringasc or desc
servicestring[]Filter by service
environmentstring[]Filter by environment
accountstring[]Filter by account ID
tagstring[]Filter by tag
virtual_tag_keystringA virtual tag's name or id. Keeps the opportunities whose resources carry one of virtual_tag_value under it
virtual_tag_valuestring[]Values of virtual_tag_key to keep. __unallocated__ keeps the opportunities no config assigned
display_statusstring[]Filter by status: available, pending, processing, optimized, rejected, unavailable

Filtering and sorting has recipes built on these parameters: the "RDS delete candidates" pattern, top-N-by-savings ranking, and CSV export.

List in-progress

Returns every recommendation currently in processing status.

processing = client.recommendations.list_in_progress()

RecommendationItem

Returned in paginated list responses.

FieldTypeDescription
recommendation_idstringUnique business identifier
servicestringCloud service name
environmentstring?Environment tag
virtual_tagsobject?The value of each virtual key on this opportunity, key name to value
analysis_periodstring?Analysis time window
monthly_savingsfloatEstimated monthly savings
annual_savingsfloatEstimated annual savings
current_spendingfloatCurrent monthly spend
savings_percentagefloatSavings as percentage of current spend
actionsobject?Available actions for this recommendation

Find high-value AWS recommendations

from levelfour import LevelFour

client = LevelFour()

for rec in client.recommendations.list_by_provider(
    "aws",
    page_size=20,
    sort_by="monthly_savings",
    sort_order="desc",
    display_status=["available"],
):
    if rec.monthly_savings > 100:
        print(f"{rec.recommendation_id}: ${rec.monthly_savings}/mo")

Next

  • Savings is the realized side: what was accepted, implemented and measured
  • Providers is the providers namespace: provider-scoped recommendations, realized savings, costs and the filter values you can pass
  • Pagination has the iterators, the defaults and the page-size cap
  • Error handling has the codes these methods raise