Skip to content

Commit

Permalink
Merge pull request #27 from bonclay7/docs
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
bonclay7 authored Aug 22, 2016
2 parents 579c0f6 + c58de50 commit f0b1b06
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 22 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ History
------------------

* First release on PyPI.

0.1.1 (2016-08-22)
------------------

* Documentation update
* rst files in pip package
13 changes: 13 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
67 changes: 47 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------
Expand All @@ -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``:
Expand All @@ -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
~~~~~~~~~~~~~~~
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion amicleaner/__init__.py
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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/',
Expand Down
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tox]
envlist = py27

[testenv]
command = py.test -v --ignore=venv --cov . --pep8 tests

0 comments on commit f0b1b06

Please sign in to comment.