From c58de5024da9b60fe6400eefdbeaeee6e0e65fd6 Mon Sep 17 00:00:00 2001 From: Guy Rodrigue Koffi Date: Mon, 22 Aug 2016 15:39:29 +0200 Subject: [PATCH] update docs --- HISTORY.rst | 6 ++++ MANIFEST.in | 13 ++++++++ README.rst | 67 +++++++++++++++++++++++++++++------------- amicleaner/__init__.py | 2 +- setup.py | 4 ++- tox.ini | 5 ++++ 6 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 MANIFEST.in create mode 100644 tox.ini diff --git a/HISTORY.rst b/HISTORY.rst index c237a15..b2f7ef6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,3 +6,9 @@ History ------------------ * First release on PyPI. + +0.1.1 (2016-08-22) +------------------ + +* Documentation update +* rst files in pip package diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..db82a89 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,13 @@ + +include CONTRIBUTING.rst + +include CONTRIBUTING.rst +include HISTORY.rst +include LICENSE +include README.rst + +recursive-include tests * +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] + +recursive-include docs *.rst conf.py diff --git a/README.rst b/README.rst index d125b62..74b747b 100644 --- a/README.rst +++ b/README.rst @@ -17,9 +17,10 @@ You can either run in ``fetch and clean`` mode where the tool will retrieve all your private **AMIs** and EC2 instances, exclude AMIs being holded by your EC2 instances (it can be useful if you use autoscaling, and so on ...). It applies a filter based on their **names** or **tags** -and a number of **previous AMIs** you want to keep. +and a number of **previous AMIs** you want to keep. You can also check and +delete EBS snapshots left orphaned by manual deletion of AMIs. -It can simply remove AMIs with a list of provided ids ! +It can simply remove AMIs with a list of provided ids. Prerequisites ------------- @@ -44,8 +45,8 @@ or with ``awscli`` : export AWS_PROFILE=profile-name -How does it work ? ------------------- +Minimum AWS IAM permissions +~~~~~~~~~~~~~~~~~~~~~~~~~~~ To run the script properly, your ``aws`` user must have at least these permissions in ``iam``: @@ -72,19 +73,39 @@ permissions in ``iam``: ] } -Getting help -~~~~~~~~~~~~ +Installation +------------ + +amicleaner is available on pypi and can be installed on your system + +From pypi +~~~~~~~~~ + +.. code:: bash + + [sudo] pip install aws-amicleaner + +From source +~~~~~~~~~~~ + +You can also clone or download from github the source and install with pip .. code:: bash - amicleaner/cli.py --help + cd aws-amicleaner/ + pip install [--user] -e . + +Usage +----- -Clean a list of AMIs -~~~~~~~~~~~~~~~~~~~~ + +Getting help +~~~~~~~~~~~~ .. code:: bash - amicleaner/cli.py --from-ids ami-abcdef01 ami-abcdef02 + amicleaner --help + Fetch and clean ~~~~~~~~~~~~~~~ @@ -93,35 +114,41 @@ Print report of groups and amis to be cleaned .. code:: bash - amicleaner/cli.py --full-report + amicleaner --full-report Keep previous number of AMIs .. code:: bash - amicleaner/cli.py --full-report --keep-previous 10 + amicleaner --full-report --keep-previous 10 Regroup by name or tags .. code:: bash - amicleaner/cli.py --mapping-key tags --mapping-values role env + amicleaner --mapping-key tags --mapping-values role env Skip confirmation, can be useful for automation .. code:: bash - amicleaner/cli.py -f --keep-previous 2 + amicleaner -f --keep-previous 2 + + +Activate orphan snapshots checking +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code:: bash + + amicleaner --check-orphans + -Using virtual env -~~~~~~~~~~~~~~~~~ +Delete a list of AMIs +~~~~~~~~~~~~~~~~~~~~~ .. code:: bash - $ virtualenv env - $ . env/bin/activate - (env) aws-amicleaner $ pip install -r requirements.txt - (env) aws-amicleaner $ amicleaner/cli.py + amicleaner --from-ids ami-abcdef01 ami-abcdef02 .. |Circle CI| image:: https://circleci.com/gh/bonclay7/aws-amicleaner/tree/master.svg?style=svg diff --git a/amicleaner/__init__.py b/amicleaner/__init__.py index 5a59d05..443ab15 100644 --- a/amicleaner/__init__.py +++ b/amicleaner/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- __title__ = 'amicleaner' -__version__ = '0.1.0' +__version__ = '0.1.1' __short_version__ = '.'.join(__version__.split('.')[:2]) __author__ = 'Guy Rodrigue Koffi' __author_email__ = 'koffirodrigue@gmail.com' diff --git a/setup.py b/setup.py index 9518641..313cdf0 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,8 @@ with open('README.rst') as readme_file: readme = readme_file.read() +with open('HISTORY.rst') as history_file: + history = history_file.read() install_requirements = ['awscli', 'argparse', 'boto', 'boto3', 'prettytable', 'blessings'] @@ -19,7 +21,7 @@ name='aws-amicleaner', version=__version__, description='Cleanup tool for AWS AMIs and snapshots', - long_description=readme, + long_description=readme + "\n\n" + history, author=__author__, author_email=__author_email__, url='https://github.com/bonclay7/aws-amicleaner/', diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..cb4df15 --- /dev/null +++ b/tox.ini @@ -0,0 +1,5 @@ +[tox] +envlist = py27 + +[testenv] +command = py.test -v --ignore=venv --cov . --pep8 tests