Run CloudCarbonFootprint in GCP

150 views
Skip to first unread message

osp ebusiness

unread,
Dec 13, 2021, 5:55:51 AM12/13/21
to Cloud Carbon Footprint
Hello CCF-Team,

First of all, thank you very much for your efforts to build this software and share it with the world.

Currently, I try to run the application in GCP(europe-west3) as a PoC (I have forked the repo, setup a GCP project added github secrets and finally get it to be deployed to GCP successfully) but I end always up with an error (see below).

My last try was to set up AWS_AUTH_MODE=GCP but it's still the same issue. Could you please give me a hint what's wrong or missing.
I only want to have GCP included (self monitoring with no compute engines running) in a first place (no AWS or Azure cloud provider/accounts). It's okay if I have no data as I get when I run it locally with the same env settings I only want to get rid of the error.

The following secrets are set up in the project:
  • Environment secrets (production)
    • GCLOUD_SERVICE_KEY=***
    • GCP_PROJECTS=***
    • GCP_USE_BILLING_DATA=false
    • GOOGLE_PROJECT_ID=***
  •  Repo secrets:
    • AWS_AUTH_MODE=GCP
    • GROUP_QUERY_RESULTS_BY=days
    • REACT_APP_DATE_RANGE_TYPE=months
    • REACT_APP_DATE_RANGE_VALUE=2
    • REACT_APP_PREVIOUS_YEAR_OF_USAGE=true
I tried to disable AWS and Azure by commenting it in config.ts but this resulted in failing tests and after some other adaptations to fix the tests, I got the same error.

const appConfig: ClientConfig = {
CURRENT_PROVIDERS: [
// { key: 'aws', name: 'AWS' },
{ key: 'gcp', name: 'GCP' },
// { key: 'azure', name: 'Azure' },
],
PREVIOUS_YEAR_OF_USAGE: previousYearOfUsage,
DATE_RANGE: {
VALUE: process.env.REACT_APP_DATE_RANGE_VALUE || '12',
TYPE: process.env.REACT_APP_DATE_RANGE_TYPE || 'months',
},
}

Here is the error that appears in the logs GAE api instance
"Unable to process footprint request.TypeError: Cannot read property 'credentials' of null at new Credentials (/workspace/node_modules/aws-sdk/lib/credentials.js:73:32) at Function.AWSCredentialsProvider.create (/workspace/node_modules/@cloud-carbon-footprint/aws/dist/application/AWSCredentialsProvider.js:29:24) at new AWSAccount (/workspace/node_modules/@cloud-carbon-footprint/aws/dist/application/AWSAccount.js:102:62) at Object.<anonymous> (/workspace/node_modules/@cloud-carbon-footprint/app/dist/App.js:134:36) at step (/workspace/node_modules/@cloud-carbon-footprint/app/dist/App.js:39:23) at Object.next (/workspace/node_modules/@cloud-carbon-footprint/app/dist/App.js:20:53) at /workspace/node_modules/@cloud-carbon-footprint/app/dist/App.js:14:71 at new Promise (<anonymous>) at __awaiter (/workspace/node_modules/@cloud-carbon-footprint/app/dist/App.js:10:12) at Object.App.getCostAndEstimates (/workspace/node_modules/@cloud-carbon-footprint/app/dist/App.js:87:16)"


Thank you very much and best regards,
Tobi

osp ebusiness

unread,
Dec 13, 2021, 8:12:15 AM12/13/21
to Cloud Carbon Footprint
I forgot to set the env variable in ci.yml. It's solved but just to get the next issue:

"Unable to process footprint request.Error: Athena start query failed. Reason Missing region in config. at CostAndUsageReports.<anonymous> (/workspace/node_modules/@cloud-carbon-footprint/aws/dist/lib/CostAndUsageReports.js:392:31) at step (/workspace/node_modules/@cloud-carbon-footprint/aws/dist/lib/CostAndUsageReports.js:33:23) at Object.throw (/workspace/node_modules/@cloud-carbon-footprint/aws/dist/lib/CostAndUsageReports.js:14:53) at rejected (/workspace/node_modules/@cloud-carbon-footprint/aws/dist/lib/CostAndUsageReports.js:6:65)"

osp ebusiness

unread,
Dec 13, 2021, 9:57:00 AM12/13/21
to Cloud Carbon Footprint
Refer to: packages/common/src/Config.ts:97

Probably it should be optional as the other AWS configs?:
ATHENA_REGION: getEnvVar('AWS_ATHENA_REGION') || '',

osp ebusiness

unread,
Dec 13, 2021, 11:38:04 AM12/13/21
to Cloud Carbon Footprint
Hello again, 
After having changed the above mentioned, it has been found that the  create_server_env_file.sh always sets some variables hardcoded to true
If this is also changed, it seems to work better. Please check:

echo AWS_USE_BILLING_DATA=$AWS_USE_BILLING_DATA >> .env
echo GCP_USE_BILLING_DATA=$GCP_USE_BILLING_DATA >> .env

Are the changes correct from your perspective?

Best regards,
Tobi
Reply all
Reply to author
Forward
0 new messages