Skip to content

get_estimated_carbon_emissions

get_estimated_carbon_emissions(
    time_period: TimePeriod,
    *,
    config_overrides: Optional[SustainabilityClientConfig] = None,
    group_by: Optional[DimensionList] = None,
    filter_by: Optional[FilterExpression] = None,
    emissions_types: Optional[EmissionsTypeList] = None,
    granularity: Optional[TimeGranularity] = None,
    granularity_configuration: Optional[GranularityConfiguration] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> GetEstimatedCarbonEmissionsResponse

Returns estimated carbon emission values based on customer grouping and filtering parameters. We recommend using pagination to ensure that the operation returns quickly and successfully.

Parameters:

  • time_period (TimePeriod) –

    The date range for fetching estimated carbon emissions. The range must include the start date of a month for that month's data to be included in the response.

  • group_by (Optional[DimensionList], default: None ) –

    The dimensions available for grouping estimated carbon emissions.

  • filter_by (Optional[FilterExpression], default: None ) –

    The criteria for filtering estimated carbon emissions. To determine which dimensions are available to be filtered by, you can first call GetEstimatedCarbonEmissionsDimensionValues

  • emissions_types (Optional[EmissionsTypeList], default: None ) –

    The emission types to include in the results. If absent, returns TOTAL_LBM_CARBON_EMISSIONS and TOTAL_MBM_CARBON_EMISSIONS emissions types.

  • granularity (Optional[TimeGranularity], default: None ) –

    The time granularity for the results. If absent, uses MONTHLY time granularity. The smallest supported granularity for carbon emissions is MONTHLY.

    If requesting partial time periods, data will be returned based on the smallest supported granularity. For example, requesting 2025-04-01T00:00:00Z to 2026-04-01T00:00:00Z with YEARLY_CALENDAR granularity will return the last 9 months for 2025 and the first 3 months of 2026.

  • granularity_configuration (Optional[GranularityConfiguration], default: None ) –

    Configuration for fiscal year calculations when using YEARLY_FISCAL or QUARTERLY_FISCAL granularity.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return in a single call. Default is 1000.

  • next_token (Optional[NextToken], default: None ) –

    The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

Raises:

Examples:

GetEstimatedCarbonEmissionsSuccess

>>> client.get_estimated_carbon_emissions(time_period={'Start': '2025-01-01T00:00:00.000Z', 'End': '2025-12-31T23:59:59.999Z'}, group_by=['SERVICE'], emissions_types=['TOTAL_LBM_CARBON_EMISSIONS', 'TOTAL_MBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_1_CARBON_EMISSIONS', 'TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS'], granularity='MONTHLY')
Source code in docs_src/capo_sustainability/_services/sustainability.py
def get_estimated_carbon_emissions(
    self,
    time_period: "capo_sustainability.types.time_period.TimePeriod",
    *,
    config_overrides: Optional[SustainabilityClientConfig] = None,
    group_by: Optional[
        "capo_sustainability.types.dimension_list.DimensionList"
    ] = None,
    filter_by: Optional[
        "capo_sustainability.types.filter_expression.FilterExpression"
    ] = None,
    emissions_types: Optional[
        "capo_sustainability.types.emissions_type_list.EmissionsTypeList"
    ] = None,
    granularity: Optional[
        "capo_sustainability.types.time_granularity.TimeGranularity"
    ] = None,
    granularity_configuration: Optional[
        "capo_sustainability.types.granularity_configuration.GranularityConfiguration"
    ] = None,
    max_results: Optional[
        "capo_sustainability.types.max_results.MaxResults"
    ] = None,
    next_token: Optional["capo_sustainability.types.next_token.NextToken"] = None,
) -> "capo_sustainability.types.get_estimated_carbon_emissions_response.GetEstimatedCarbonEmissionsResponse":
    """<p>Returns estimated carbon emission values based on customer grouping and filtering parameters. We recommend using pagination to ensure that the operation returns quickly and successfully. </p>

    Args:
        time_period: <p> The date range for fetching estimated carbon emissions. The range must include the start date of a month for that month's data to be included in the response. </p>
        group_by: <p>The dimensions available for grouping estimated carbon emissions.</p>
        filter_by: <p> The criteria for filtering estimated carbon emissions. To determine which dimensions are available to be filtered by, you can first call <a>GetEstimatedCarbonEmissionsDimensionValues</a> </p>
        emissions_types: <p>The emission types to include in the results. If absent, returns <code>TOTAL_LBM_CARBON_EMISSIONS</code> and <code>TOTAL_MBM_CARBON_EMISSIONS</code> emissions types. </p>
        granularity: <p> The time granularity for the results. If absent, uses <code>MONTHLY</code> time granularity. The smallest supported granularity for carbon emissions is <code>MONTHLY</code>. </p> <p> If requesting partial time periods, data will be returned based on the smallest supported granularity. For example, requesting <code>2025-04-01T00:00:00Z</code> to <code>2026-04-01T00:00:00Z</code> with <code>YEARLY_CALENDAR</code> granularity will return the last 9 months for 2025 and the first 3 months of 2026. </p>
        granularity_configuration: <p>Configuration for fiscal year calculations when using <code>YEARLY_FISCAL</code> or <code>QUARTERLY_FISCAL</code> granularity. </p>
        max_results: <p>The maximum number of results to return in a single call. Default is 1000.</p>
        next_token: <p>The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page. </p>

    Raises:
        capo_sustainability.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_sustainability.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception, or failure.</p>
        capo_sustainability.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_sustainability.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_sustainability.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        GetEstimatedCarbonEmissionsSuccess

        >>> client.get_estimated_carbon_emissions(time_period={'Start': '2025-01-01T00:00:00.000Z', 'End': '2025-12-31T23:59:59.999Z'}, group_by=['SERVICE'], emissions_types=['TOTAL_LBM_CARBON_EMISSIONS', 'TOTAL_MBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_1_CARBON_EMISSIONS', 'TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS', 'TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS'], granularity='MONTHLY')
    """

    def _handler(
        req: "OperationRequest[capo_sustainability.types.get_estimated_carbon_emissions_request.GetEstimatedCarbonEmissionsRequest]",
    ) -> OperationResponse[
        "capo_sustainability.types.get_estimated_carbon_emissions_response.GetEstimatedCarbonEmissionsResponse"
    ]:
        import capo_sustainability._operations.aws_sustainability_api_service.get_estimated_carbon_emissions

        output, http_response = (
            capo_sustainability._operations.aws_sustainability_api_service.get_estimated_carbon_emissions.get_estimated_carbon_emissions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetEstimatedCarbonEmissions")
    )
    input_: capo_sustainability.types.get_estimated_carbon_emissions_request.GetEstimatedCarbonEmissionsRequest = {
        "time_period": time_period
    }
    if group_by is not None:
        input_["group_by"] = group_by
    if filter_by is not None:
        input_["filter_by"] = filter_by
    if emissions_types is not None:
        input_["emissions_types"] = emissions_types
    if granularity is not None:
        input_["granularity"] = granularity
    if granularity_configuration is not None:
        input_["granularity_configuration"] = granularity_configuration
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output