Git Product home page Git Product logo

luau's Introduction

Low Usage AWS Utility(LUAU)

LUAU is a plug-n-play suite of lambdas that aims to minimize the cost of operations of amazon account by acting upon Trusted Advisor(TA) recommendations.

Documentation

You can read the documentation here

Source Code

You can view the source code in this repository.

Rationale behind development of the product

You can read the corresponding Medium blog here

How it works?

LUAU utilizes amazon's tagging system to create a framework that can alert users about their unececessary expenditure and help act upon them.

Installation Guide

Before Cloning the Repo

  1. Make sure you can use the AWS CLI on your machine and that you can access the environment you want to deploy LUAU to.
  2. Register an email account with SES that will be used to send email reports
  3. Create an S3 Bucket that will be used to store the Lambda .ZIP source.
  4. Create the following parameters in SSM Parameter Store
    • LAMBDA_CODE_BUCKET -- S3 Bucket Name
    • SES_EMAIL -- Email Address registered to SES in Step 1.
    • ADMIN_EMAIL -- Email Address that will receive the Admin Report.
  5. This requires AWS Trusted Advisor Business support to access the AWS Support APIs

After Cloning the Repo

  1. In resources/env.properties, set the AWS_REGION to your desired region (default is us-west-2)
  2. cd into the project root.
  3. install python 3.6 (and check that it works by running which python3.6) and create a virtual environment with it. virtualenv venv_dev --python=$(which python3.6). Don't use the venv virtual environment as that is used in the build script to create an artifact. ... Locally the build and deploy scripts worked with python 3.7 but the cloudformation script specifies that python 3.6 is required.
  4. Run python3 ./bin/create_templates.py. This will create the SES Email templates used in the email reports
  5. Run ./bin/build.sh. This will generate the LUAU ZIP Artifact. You may need to edit the files permissions to run this
  6. Run ./bin/deploy.sh. This will deploy LUAU to your AWS Environment. You may need to edit the files permissions to run this

Package Structure

├── bin
│   ├── build.sh -- Builds deployment package
│   ├── create_templates.py -- Used to create email templates in SES
│   └── deploy.sh -- Deploys lambdas via CloudFormation
├── low_use -- Parses low-use instances and sends reports
│   ├── report_parser.py -- Parses low-use report
│   └── reporter.py -- Tags instance as LowUse, Whitelisted, or Scheduled For Deletion. Also sends SES Emails and stops instances
├── requirements.txt
├── resources
│   ├── env.properties -- Parameters for Lambdas (SES Email, etc.)
│   ├── sam.yaml -- SAM template for deployment
│   └── templates
│       ├── admin_report.json -- Email template for Admin Report
│       └── low_use_report.json -- Email template for creator-level report
├── tagger
│   ├── asg_tagger.py -- Tags Autoscaling groups and their instances
│   ├── ec2_tagger.py -- Tags EC2 resources (Instances, AMIs, EBS Volumes, SGs)
│   └── parser -- Parses AWS API Event JSON
│       ├── __init__.py
│       ├── asg_event.py 
│       ├── base_event.py
│       └── ec2_event.py
└── util
    ├── aws.py -- Basic AWS Wrapper (SES, TrustedAdvisor, EC2, ASG)
    └── dynamo.py -- Wrapper for Dynamo tables (CRUD Access)

  • bin: Contains build/deploy scripts
  • low_use: Will contain the Lambda function(s) responsible for processing Trusted Advisor data and emailing out the Low Use reports
  • resources: This contains configuration files used in the build/deploy processes. Right now it only contains the SAM template for the tagger.
  • tagger: This contains the Lambda functions responsible for auto-tagging AWS resources. Currently tags EC2, ASG, EBS, AMI, and Security Groups. This package also contains a parser subpackage used to parse the event data.
  • test: Where the tests go. Each Python package will have it's own test package called [package_name]_test. This also contains a folder with example event data for the events we want to handle.
  • util: This is a Python package that will contain utility modules that can be shared by the other packages. This includes things like AWS calls.

luau's People

Contributors

arvsr1988 avatar keithwhitley avatar priyaaank avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

xnge

luau's Issues

build.sh fails on python 3.7

the lines below look for python3.6.

find ./venv/lib/python3.6/site-packages/ | grep -E "(moto|mock|pytest|pytest_cov|coverage)" | xargs rm -rf
cp -r venv/lib/python3.6/site-packages/* build/

package incompatability on pip install

I created virtualenv with python 3.6 and ran pip install -r requirements.txt. I get this error.

moto 1.3.3 has requirement boto3>=1.6.16, but you'll have boto3 1.6.8 which is incompatible.
moto 1.3.3 has requirement botocore>=1.9.16, but you'll have botocore 1.9.8 which is incompatible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.