Skip to content

Road-To-FinOps-Deploy/aws_tf_compute_optimiser_collector

Repository files navigation

Compute optimiser collector

The purpose of this module is to collect all compute optimisation recommendations from all accounts either in an organisation or specific ids you pass in, and put them into one location. This can then be queried using Athena. It is to be deployed into the management account or any account that has access to the organisations data.

Example Queries can be found in the athena_queries folder.

Usage

module "aws_tf_compute_optimiser_collector" {
  source = "/aws_tf_compute_optimiser_collector"
  bucket_name = "bucket name "
  athena_database = "Existing_athena_database_name"
  alarm_email = "[email protected]"
  region = "eu-west-1"
}

Optional Inputs

Name Description Type Default Required
bucket_name Bucket name for your CO data to be stored in that will be created string "" Yes
athena_database Existing Athena database to query data from string "" Yes
alarm_email Email to send alerts too string "[email protected]" Yes
env End for the name of the resources created string "" no
region Region it will be deployed into string "" yes
Choice:
enable_accounts_collector This will pull your orgonisation data into an sqs que and pass accout ids into the CO function bolean "true" no
enable_cloudwatch_event This will all you to pass in selected account IDs rather than and org bolean "false" no
specific_accounts Pass in string in this format with account ids. Must have enable_cloudwatch_event as true "{ "Records":[ { "messageId":"1", "body":"123456789" }, {"messageId":"2", "body":"987654312" } ] }" string "" no

Diagram

COC

Testing Deployment

  • Go to AWS Lambda
  • Find the org_account_collector lambda and run a test
  • this will pass the account IDs into the SQS and then the compute_optimiser_collector lambda will run these
  • the data will then be placed into the s3 bucket that was created

Contribution Testing

Configure your AWS credentials using one of the supported methods for AWS CLI tools, such as setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. If you're using the ~/.aws/config file for profiles then export AWS_SDK_LOAD_CONFIG as "True".

  1. Install Terraform and make sure it's on your PATH.
  2. Install Golang and make sure this code is checked out into your GOPATH. cd test go mod init github.com/sg/sch go test -v -run TestTerraformAws

About

AWS Terraform module to collect Compute Optimiser data from all accounts in an organisation and place them in a bucket onece a month

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors