UNPKG

@cloud-carbon-footprint/aws

Version:

The core logic to get cloud usage data and estimate energy and carbon emissions from Amazon Web Services.

21 lines (20 loc) 1.01 kB
import { StorageUsage, FootprintEstimate, CloudConstants, CloudConstantsEmissionsFactors } from '@cloud-carbon-footprint/core'; import { ServiceWrapper } from './ServiceWrapper'; import { GetCostAndUsageCommandInput } from '@aws-sdk/client-cost-explorer'; export declare class VolumeUsage implements StorageUsage { readonly terabyteHours: number; readonly timestamp: Date; readonly diskType: DiskType; } export interface MutableFootprintEstimate { timestamp: Date; co2e: number; kilowattHours: number; } export declare enum DiskType { SSD = "SSD", HDD = "HDD", UNKNOWN = "UNKNOWN" } export declare function getUsageFromCostExplorer(params: GetCostAndUsageCommandInput, diskTypeCallBack: (awsGroupKey: string) => DiskType, serviceWrapper: ServiceWrapper): Promise<VolumeUsage[]>; export declare function getEstimatesFromCostExplorer(region: string, volumeUsages: VolumeUsage[], emissionsFactors: CloudConstantsEmissionsFactors, constants: CloudConstants): FootprintEstimate[];