Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Enable JupyterHub Cost Monitoring

The JupyterHub Cost Monitoring system consists of the jupyterhub-cost-monitoring backend and Grafana cloud cost dashboards that use the backend as a data source.

Checkout the topic guide for more information on the system.

Steps

1. Enable cost monitoring system

The cost monitoring system requires a service account with the IAM permissions to read billing data from AWS Cost Explorer API. This is unconditionally enabled with the terraform variable enable_jupyterhub_cost_monitoring that sets up an IAM role, IAM policy and Kubernetes service account annotation.

See terraform/aws/variables.tf and terraform/aws/cost-monitoring.tf for the configuration.

2. Activate cost allocation tags

We can activate cost allocation tags for AWS accounts that we have billing permissions for (either through the 2i2c SSO or a standalone account), but not for AWS accounts that are managed by a community where we do not have billing permissions.

2i2c SSO
Standalone + billing access
Community + no billing access

AWS accounts managed by the 2i2c SSO have cost allocation tags already enabled with the overarching billing account. Cost tags only need to be activated once per AWS organization.

See the topic guide for more information on which cost allocation tags are activated.

3. (optional) Backfill billing data

You can optionally backfill billing data to tags having been around for a while but not enabled as cost allocation tags.

You can request this to be done once a day, and it takes a several hours to process the request. Make a request through the AWS web console by navigating to “Cost allocation tags” under “Billing and Cost Management”, then from there click the “Backfill tags” button.

4. Install jupyterhub-cost-monitoring Helm chart

The helm deployment is unconditionally enabled with jsonnet, unless explicitly overridden in the config/clusters/<cluster_name>/support.values.yaml file, and the configuration is automatically defined in the helm-charts/support/values.jsonnet file.

You can manually deploy the support chart with:

deployer deploy-support $CLUSTER_NAME

Troubleshooting

If you don’t see data in the cost monitoring dashboard, you may want to look to ensure the jupyterhub-cost-monitoring deployment’s pod is running in the support namespace, or if it reports errors in its logs.

References

https://github.com/2i2c-org/jupyterhub-cost-monitoring/