Manual
The user performing the integration must have the following roles assigned:
1. Owner on your projects/folders to be onboarded 2. Organisation Administrator on your organisation Why this is needed? Owner role is used to assign IAM roles to the service account & external user. Organisation Administrator role is used to create a new billing project.
Below APIs must be enabled on your projects for OneLens to be able to read usage data on the respective services:
Vertex AI API(aiplatform.googleapis.com)Cloud Functions API(cloudfunctions.googleapis.com)Cloud SQL Admin API(sqladmin.googleapis.com)Compute Engine API(compute.googleapis.com)Kubernetes Engine API(container.googleapis.com)Dataflow API(dataflow.googleapis.com)Cloud Dataproc API(dataproc.googleapis.com)Cloud Filestore API(file.googleapis.com)Cloud Monitoring API(monitoring.googleapis.com)Network Management API(networkmanagement.googleapis.com)Recommender API(recommender.googleapis.com)Google Cloud Memorystore for Redis API(redis.googleapis.com)Service Usage API(serviceusage.googleapis.com)Cloud Asset API(cloudasset.googleapis.com)BigQuery API(bigquery.googleapis.com)
The above APIs must be enabled for each project to be onboarded.
For steps on how to enable APIs, please follow this link to Google’s documentation.
Create the Billing project and enable cost export
Login to the Google Cloud Platform console.
In the
Project Pickermenu on top, create a project with the name “OneLens Billing Project”.
Using the
Project Pickermenu on top, open the newly created project "OneLens Billing Project".In the left menu, open
BigQuery Studio.In the
BigQuery Explorerpane, click the3 dotsto the right of the billing project ID, and clickCreate dataset.
In the opened
Create datasetmenu, enter the following data:Under
Dataset ID, enter “billing_export”.Under
Location type, select Multi-region.Under
Multi-region, select US (multiple regions in the United States)
The dataset location is set to US (multiple regions in the United States) to export cost data retroactively from the start of the previous month during the initial setup.
https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-availability
Under
Advanced options, make sure theEnable table expiryoption is unchecked.
By disabling the table expiry for the BigQuery dataset, we ensure that the Single Source of Truth for your cloud costs remains intact indefinitely, enabling deep historical analysis, accurate forecasting, and audit compliance. https://docs.cloud.google.com/billing/docs/how-to/export-data-bigquery
Click
Create data set.
Go to
Billingon the left menu.Under
Cost management, selectBilling exportin the left menu.Enable
Detailed usage costwith the following options:Under
Projects, select the billing project created (OneLens Billing Project).Under
Dataset, select the dataset created (billing_export).Click
Save.
Similarly, enable
Pricingwith the following options:Under
Projects, select the billing project created (OneLens Billing Project).Under
Dataset, select the dataset created (billing_export).Click
Save.
Pricing data includes custom pricing data for your resources, if you have custom contracts with Google.
Using the search bar on top, search for and enable the
Cloud Billing APIon this project.
Create the Service Account and assign permissions on the Billing project
In the
Project Pickermenu on top, select the new billing project created just now (i.e., OneLens Billing Project)Go to
IAM and adminon the left bar.Go to
Service accountsand click on+ Create service account.Enter the
Service account nameas “OneLens Reader SA”Service account IDshould be automatically generated.Enter the
Service account descriptionas: SA used by OneLens with read-only roles for FinOps analysis.Click
Create and continue.
Under
Permissions, search for and select the following roles:BigQuery Data ViewerBigQuery Metadata ViewerBigQuery Job UserBigQuery Read Session User
Click
Continue
Click
DoneOn the left, under
IAM and admin, selectService AccountsSelect the service account that was created just now (i.e., OneLens Reader SA).
Under the
Principals with accesstab, click+ Grant access.Under
Add principals, enter the following values[email protected](our backend Service Account)[email protected](our external user email)
Under
Assign Roles, add the following role:Service Account Token Creator
Click
Save.
Assign Billing project roles to the External User
In the
Project Pickermenu on top, select the new billing project created just now (i.e., OneLens Billing Project)Go to
IAM and adminand click+ Grant access.Under
Add principals, enter the value of theexternal user email IDprovided to you by the OneLens team:[email protected]Under Assign Roles, add the following roles and click Save:
BigQuery Data ViewerBigQuery Metadata ViewerBigQuery Job User
Assign Organisation-level roles for Service Account and External User
Open the
Project Pickermenu and select yourorganisation.Go to
IAM and adminand click+ Grant access.Under
Add principals, search for and select theservice accountthat was created (i.e., OneLens Reader SA) and the external user email (i.e.,[email protected])Under
Assign Roles, add the following roles and clickSave:Organisation ViewerCloud Asset ViewerBrowserBilling Account Viewer
Assign Project/Folder-level roles to the Service Account
Open the
Project Pickermenu and select aproject/folderto be onboarded.Go to
IAM and adminand click+ Grant access.Under
Assign Roles, add the following roles:Vertex AI ViewerCloud Functions ViewerCloud SQL ViewerCompute ViewerKubernetes Engine ViewerDataflow ViewerDataproc ViewerCloud Filestore ViewerMonitoring ViewerNetwork Management ViewerRecommender ViewerCloud Memorystore Redis ViewerService Usage ViewerBigQuery Job UserBigQuery Metadata ViewerBigQuery Resource Viewer
Click
Save.

Repeat the above steps for all projects/folders to be onboarded.
Assign Project/Folder-level roles to the External User
Open the
Project Pickermenu and select aproject/folderto be onboarded.Go to
IAM and adminand click+ Grant access.Under
Add principals, enter and select the external user email (i.e.,[email protected]).Under
Assign Roles, add the following roles:ViewerBigQuery Resource ViewerBigQuery Metadata ViewerBigQuery Job User
Click
Save.
Repeat the above steps for all projects/folders to be onboarded.
You have now successfully integrated your Google Cloud Platform environment with OneLens.
Please share the following values to the OneLens team to facilitate the connection on our end:
Billing project ID
Service Account email ID
BigQuery dataset ID
Last updated

