# isitfit
[![PyPI version](https://badge.fury.io/py/isitfit.svg)](https://badge.fury.io/py/isitfit)
A simple command-line tool to check if an AWS EC2/Redshift account is fit or underused.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Installation](#installation)
- [pip-fu](#pip-fu)
- [Usage](#usage)
- [Pre-requisites](#pre-requisites)
- [Synopsis](#synopsis)
- [Display version](#display-version)
- [Cost-weighted average utilization](#cost-weighted-average-utilization)
- [Recommended optimizations](#recommended-optimizations)
- [Filtering on region](#filtering-on-region)
- [Filtering on tags](#filtering-on-tags)
- [Dumping tags to CSV](#dumping-tags-to-csv)
- [Pushing tags from CSV](#pushing-tags-from-csv)
- [Generating suggested tags](#generating-suggested-tags)
- [Basic](#basic)
- [Advanced](#advanced)
- [Non-default awscli profile](#non-default-awscli-profile)
- [Assumed roles](#assumed-roles)
- [Caching results with redis](#caching-results-with-redis)
- [Datadog integration](#datadog-integration)
- [Share results by email](#share-results-by-email)
- [Verbosity](#verbosity)
- [What does Underused mean?](#what-does-underused-mean)
- [Statistics and Usage Tracking](#statistics-and-usage-tracking)
- [Changelog](#changelog)
- [License](#license)
- [Dev notes](#dev-notes)
- [Author](#author)
- [Security contact information](#security-contact-information)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Installation
To install `isitfit` with `pip3`:
```
pip3 install isitfit
```
and then just test that it's installed with
```
isitfit version
```
### pip-fu
If you're new to python, here's some pip-fu for help:
If you don't have `pip3` installed yet, you can install it on Ubuntu 18.04 with:
```
sudo apt-get install python3-pip
```
To install with pip but without using `sudo`, you could use
```
pip3 install --user isitfit
```
If you've just installed `pip3`, running `isitfit version` right after this step would yield an error `command not found`.
Restarting the machine would set the proper environment variables so that `isitfit version` would work.
You could restart it with `sudo shutdown -r now`.
## Usage
### Pre-requisites
The AWS CLI should be configured with the account's access keys:
`aws configure`
The keys should belong to a user/role with the following minimal policies:
`AmazonEC2ReadOnlyAccess, CloudWatchReadOnlyAccess`
For Redshift analysis, the user/role also needs: `redshift:DescribeClusters`
If you have a Datadog account, check section [Datadog integration](#datadog-integration)
For pushing tags, the user/role will also need to have the following existing policy:
`ResourceGroupsandTagEditorFullAccess`
For advanced tag suggestions and other server-side services, the following existing policy is also required:
`STS_AssumeRole`
### Synopsis
Check [SYNOPSIS.md](SYNOPSIS.md)
To get help hints in the command-line use the `--help`
```
> isitfit --help
> isitfit cost --help
> isitfit cost analyze --help
```
### Display version
Check the version of `isitfit`
```
isitfit version
```
### Cost-weighted average utilization
Calculate AWS EC2 Cost-Weighted Average Utilization
```
> isitfit cost analyze
Field Value
------------------------------- -----------
Analysis start date 2019-06-07
Analysis end date 2019-09-05
EC2 Regions 2 (us-east-1, us-west-2)
EC2 machines (total) 8
EC2 machines (analysed) 3
EC2 Billed cost 165 $
EC2 Used cost 9 $
EC2 CWAU = Used / Billed 6 %
Redshift Regions 1
Redshift clusters (total) 2
Redshift clusters (analysed) 2
Redshift Billed cost 100 $
Redshift Used cost 34 $
Redshift CWAU 34 %
For reference:
* CWAU >= 70% is well optimized
* CWAU <= 30% is underused
```
Save intermediate results to CSV files with:
```
> isitfit cost analyze --save-details
(output truncated)
Detail file 1/2: Per ec2 and day: /tmp/isitfit-cost-analyze-ec2-details-1-xd_gg2we.csv
Detail file 2/2: Per ec2 only : /tmp/isitfit-cost-analyze-ec2-details-2-138d1ip7.csv
(output truncated)
> head -n 1 /tmp/isitfit-cost-analyze-ec2-details-1-xd_gg2we.csv
region instance_id Timestamp SampleCount Average Minimum Maximum Unit instanceType API Name cost_hourly nhours
us-west-2 i-02432bc7 2019-08-29 1440.0 0.4859 0.3278 21.9999 Percent t2.micro t2.micro 0.0136705882 24.0
> head -n 1 /tmp/isitfit-cost-analyze-ec2-details-2-138d1ip7.csv
instance_id capacity used
i-024... 29.54 0.14
```
Note that `isitfit cost analyze` will prompt the user for the number of days on which to perform the analysis.
By default, it's 90 days. To skip the prompt, just use the `--ndays` option, eg `isitfit cost analyze --ndays=90`.
### Recommended optimizations
Find all recommended type changes
```
> isitfit cost optimize
Recommended savings: -74 $ (over next 3 months)
EC2 Details
+-----------+---------------------+-----------------+--------------------+------------------------------------+-----------+--------------------+-----------+--------------------------------------------------+
| region | instance_id | instance_type | classification_1 | classification_2 | cost_3m | recommended_type | savings | tags |
|-----------|---------------------+-----------------+--------------------+------------------------------------+-----------+--------------------+-----------+--------------------------------------------------|
| us-west-2 | i-069a7808addd143c7 | t2.medium | Underused | Burstable intraday, No memory data | 117 | t2.small | -59 | Name = ****** |
| us-west-2 | i-34ca2fc2 | t2.nano | Normal | No memory data | 14 | | 0 | opsworks:layer:php-app = PHP App Server |
| | | | | | | | | opsworks:stack = ****************** |
| | | | | | | | | opsworks:instance = ******************** |
| | | | | | | | | Name = ************* |
+-----------+---------------------+-----------------+--------------------+------------------------------------+-----------+--------------------+-----------+--------------------------------------------------+
Saving final results to /tmp/isitfit-full-41o1b4o8.csv
Save complete
Redshift cluster classification
+-----------+---------------------+------------+-----------------+-------------+-------------+--------+------------------+
| Region | ClusterIdentifier | NodeType | NumberOfNodes | CpuMaxMax | CpuMinMin | Cost | classification |
|-----------+---------------------+------------+-----------------+-------------+-------------+--------+------------------|
| us-east-1 | redshift-cluster-1 | dc2.large | 2 | 0 | 0 | 0.25 | Normal |
| us-east-1 | redshift-cluster-2 | dc2.large | 3 | 56 | 0 | 0.25 | Normal |
+-----------+---------------------+------------+-----------------+-------------+-------------+
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
isitfit-0.18.0.tar.gz (73个子文件)
isitfit-0.18.0
PKG-INFO 376B
isitfit.egg-info
PKG-INFO 376B
requires.txt 315B
SOURCES.txt 2KB
entry_points.txt 73B
top_level.txt 8B
dependency_links.txt 1B
isitfit
tags
tagsCsvDiff.py 5KB
tagsImplier.py 9KB
tagsSuggestBasic.py 3KB
tagsDump.py 595B
tagsSuggestAdvanced.py 4KB
__init__.py 0B
tagsPush.py 6KB
cost
catalog_ec2.py 2KB
cloudtrail_iterator.py 17KB
cacheManager.py 3KB
cloudtrail_ec2type.py 2KB
catalog_redshift.py 534B
ec2_common.py 5KB
redshift_optimize.py 4KB
ec2_optimize.py 14KB
redshift_common.py 6KB
datadogManager.py 8KB
account_cost_optimize.py 7KB
mainManager.py 6KB
base_reporter.py 3KB
account_cost_analyze.py 11KB
base_iterator.py 7KB
ec2_analyze.py 18KB
__init__.py 500B
redshift_analyze.py 8KB
cloudwatchman.py 8KB
dotMan.py 2KB
utils.py 10KB
tests
tags
test_tagsPush.py 5KB
__init__.py 0B
test_utils.py 3KB
cost
test_mainManager.py 420B
test_datadogManager.py 346B
__init__.py 0B
test_ec2Analyze.py 5KB
redshift
test_cloudwatchman_ec2.py 5KB
test_cloudwatchman_redshift.py 2KB
__init__.py 0B
test_analyzer.py 3KB
test_iterator_ec2.py 3KB
test_reporter.py 4KB
test_cli.py 1KB
test_iterator_redshift.py 2KB
test_cloudtrail_iterator_functional.py 3KB
test_emailMan.py 1KB
test_apiMan.py 3KB
test_dotMan.py 1KB
__init__.py 0B
test_tqdmman.py 399B
emailMan.py 2KB
__init__.py 25B
migrations
cli.py 2KB
migman.py 4KB
__init__.py 0B
miglist.py 1KB
apiMan.py 13KB
tqdmman.py 631B
cli
tags.py 2KB
core.py 5KB
__init__.py 0B
click_descendents.py 1KB
version.py 422B
cost.py 4KB
setup.cfg 38B
setup.py 2KB
README.md 19KB
共 73 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功