ministryofjustice / modernisation-platform

A place for the core work of the Modernisation Platform • This repository is defined and managed in Terraform
https://user-guide.modernisation-platform.service.justice.gov.uk
MIT License
680 stars 290 forks source link

Use Observability platform for Modernisation Platform cost metrics #7169

Open davidkelliott opened 3 months ago

davidkelliott commented 3 months ago

User Story

As an MP Product manager, service owner and MP user I want to view platform costs in total, broken down into sensible categories (TBC as part of issue) So that I can use the data to drive cost savings

Value / Purpose

Replace a manual process of cost metrics with automated dashboards which are easily accessible to mp PM and service owner to view their cost metrics.

Useful Contacts

No response

Additional Information

When doing this work it would be beneficial to do it at an AWS org level, so that we could also monitor total AWS spend, off platform AWS spend, platforms AWS spend, and application AWS spend in future issues.

Proposal / Unknowns

Not sure where this should be done - maybe in the MOJ Master Account?

Definition of Done

dms1981 commented 1 month ago

We think this is probably best handled through integrating the MOJ Master account (organizational root) with observability platform, but we have a lot of unknowns here along the way to a defined outcome.

sukeshreddyg commented 1 month ago

One approach is to:

  1. Create a new report in the Cost Explorer saved reports.
  2. Export that data to store in S3 using data exports by creating a new report.

However, there are a few questions regarding this implementation:

  1. We don't have permissions to create an S3 bucket in the root account.
  2. It's unclear whether we can create an S3 bucket in a cross account (i.e., in the MP account). If it is possible, then we can easily implement this solution.
ASTRobinson commented 1 month ago

I have raised a question on the #ask-obervability-platform channel if this setup & configuration is feasible: https://aws.amazon.com/blogs/mt/visualize-and-gain-insights-into-your-aws-cost-and-usage-with-amazon-managed-grafana/

also I have imported two billing dashboards which can used with the current data sources (our core-accounts) to see costs across the different services in AWS.

https://g-9d213fbc19.grafana-workspace.eu-west-2.amazonaws.com/d/AWSBilling/aws-billing-1?orgId=1 https://g-9d213fbc19.grafana-workspace.eu-west-2.amazonaws.com/d/AWSBillin/aws-billing-2?orgId=1

ASTRobinson commented 1 month ago

threat started in the #ask-obervability-platform https://mojdt.slack.com/archives/C05QXHR697S/p1722330176200169 proposing setup and configuration of a billing dashboard using a AWS Cost and Usage Report (CUR) with Athena data source as detailed in this article (https://aws.amazon.com/blogs/mt/visualize-and-gain-insights-into-your-aws-cost-and-usage-with-amazon-managed-grafana/).

I believe Jacob might already be investigating a similar solution, not sure if this should be moved to blocked until obs-plat have investigated or could be placed back into to do as Sukesh might interested in this ticket? Otherwise, I can resume working upon my return from annual leave.

ASTRobinson commented 3 weeks ago

Meeting arranged with Jacob @ 14:00 on 22/08

ASTRobinson commented 3 weeks ago

following the meeting with Jacob & Gary we have come up with the following potential solution:

Image

ASTRobinson commented 3 weeks ago

core-billing account has been created: https://github.com/ministryofjustice/modernisation-platform/pull/7763

Observability Platform tenant onboarding has been started: https://github.com/ministryofjustice/modernisation-platform/pull/7775

ASTRobinson commented 2 days ago

I have been working on a cross-account replication module that I hope to add to https://github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket but I haven't quite got there yet (working through some issues and figuring out testing). I have also spoken with the Observability platform team regarding the configuration of the Athena data source for use in our core-logging environment, I will be parking the replication module while I focus on this tomorrow and hopefully will be able to get something up in Grafana.

ASTRobinson commented 20 hours ago

PR raised to create an S3 bucket and associated roles/polices https://github.com/ministryofjustice/modernisation-platform/pull/7914 in core-logging.