@cloud-carbon-footprint/aws
Version:
The core logic to get cloud usage data and estimate energy and carbon emissions from Amazon Web Services.
99 lines (94 loc) • 3.65 kB
text/typescript
/*
* © 2021 Thoughtworks, Inc.
*/
import { mappedRegionsToElectricityMapZones } from '@cloud-carbon-footprint/common'
export enum AWS_REGIONS {
US_EAST_1 = 'us-east-1',
US_EAST_2 = 'us-east-2',
US_WEST_1 = 'us-west-1',
US_WEST_2 = 'us-west-2',
AF_SOUTH_1 = 'af-south-1',
AP_EAST_1 = 'ap-east-1',
AP_SOUTH_1 = 'ap-south-1',
AP_NORTHEAST_3 = 'ap-northeast-3',
AP_NORTHEAST_2 = 'ap-northeast-2',
AP_SOUTHEAST_1 = 'ap-southeast-1',
AP_SOUTHEAST_2 = 'ap-southeast-2',
AP_NORTHEAST_1 = 'ap-northeast-1',
AP_SOUTHEAST_3 = 'ap-southeast-3',
CA_CENTRAL_1 = 'ca-central-1',
CN_NORTH_1 = 'cn-north-1',
CN_NORTHWEST_1 = 'cn-northwest-1',
EU_CENTRAL_1 = 'eu-central-1',
EU_WEST_1 = 'eu-west-1',
EU_WEST_2 = 'eu-west-2',
EU_SOUTH_1 = 'eu-south-1',
EU_WEST_3 = 'eu-west-3',
EU_NORTH_1 = 'eu-north-1',
ME_SOUTH_1 = 'me-south-1',
ME_CENTRAL_1 = 'me-central-1',
SA_EAST_1 = 'sa-east-1',
US_GOV_EAST_1 = 'us-gov-east-1',
US_GOV_WEST_1 = 'us-gov-west-1',
UNKNOWN = 'Unknown',
}
export const AWS_MAPPED_REGION_NAMES_TO_CODES: { [key: string]: string } = {
'US East (Ohio)': AWS_REGIONS.US_EAST_2,
'US East (N. Virginia)': AWS_REGIONS.US_EAST_1,
'US West (N. California)': AWS_REGIONS.US_WEST_1,
'US West (Oregon)': AWS_REGIONS.US_WEST_2,
'Africa (Cape Town)': AWS_REGIONS.AF_SOUTH_1,
'Asia Pacific (Hong Kong)': AWS_REGIONS.AP_EAST_1,
'Asia Pacific (Mumbai)': AWS_REGIONS.AP_SOUTH_1,
'Asia Pacific (Osaka)': AWS_REGIONS.AP_NORTHEAST_3,
'Asia Pacific (Seoul)': AWS_REGIONS.AP_NORTHEAST_2,
'Asia Pacific (Singapore)': AWS_REGIONS.AP_SOUTHEAST_1,
'Asia Pacific (Sydney)': AWS_REGIONS.AP_SOUTHEAST_2,
'Asia Pacific (Tokyo)': AWS_REGIONS.AP_NORTHEAST_1,
'Asia Pacific (Jakarta)': AWS_REGIONS.AP_SOUTHEAST_3,
'Canada (Central)': AWS_REGIONS.CA_CENTRAL_1,
'EU (Frankfurt)': AWS_REGIONS.EU_CENTRAL_1,
'EU (Ireland)': AWS_REGIONS.EU_WEST_1,
'EU (London)': AWS_REGIONS.EU_WEST_2,
'EU (Milan)': AWS_REGIONS.EU_SOUTH_1,
'EU (Paris)': AWS_REGIONS.EU_WEST_3,
'EU (Stockholm)': AWS_REGIONS.EU_NORTH_1,
'Middle East (Bahrain)': AWS_REGIONS.ME_SOUTH_1,
'Middle East (UAE)': AWS_REGIONS.ME_CENTRAL_1,
'South America (Sao Paulo)': AWS_REGIONS.SA_EAST_1,
'AWS GovCloud (US-East)': AWS_REGIONS.US_GOV_EAST_1,
'AWS GovCloud (US-West)': AWS_REGIONS.US_GOV_WEST_1,
'China (Beijing)': AWS_REGIONS.CN_NORTH_1,
'China (Ningxia)': AWS_REGIONS.CN_NORTHWEST_1,
}
export const AWS_MAPPED_REGIONS_TO_ELECTRICITY_MAPS_ZONES: mappedRegionsToElectricityMapZones =
{
[]: 'US-MIDA-PJM',
[]: 'US-MIDA-PJM',
[]: 'US-CAL-CISO',
[]: 'US-NW-PACW',
[]: 'ZA',
[]: null,
[]: 'IN-WE',
[]: 'JP-KN',
[]: 'KR',
[]: 'SG',
[]: 'AU-NSW',
[]: 'JP-TK',
[]: 'ID',
[]: 'CA-QC',
[]: null,
[]: null,
[]: 'DE',
[]: 'IE',
[]: 'GB',
[]: 'IT-NO',
[]: 'FR',
[]: 'SE-SE3',
[]: null,
[]: null,
[]: 'BR-CS',
[]: 'US-MIDA-PJM',
[]: 'US-NW-PACW',
[]: null,
}