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.
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
Note
AWS IAM resources for the cost monitoring system are enabled by default via terraform and the helm chart deployment is also enabled by default.
Activating cost allocation tags is always disabled by default and must be explicitly enabled.
If you would like to disable the cost monitoring system, you can set
enable_jupyterhub_cost_monitoring = false
in the terraform/aws/projects/<$CLUSTER_NAME>.tfvars file and
jupyterhub-cost-monitoring:
enabled: false
in the config/clusters/<$CLUSTER_NAME>/support.values.yaml file.
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.