项目作者: scalasm

项目描述 :
Python application that manages AWS EC2 snapshots
高级语言: Python
项目地址: git://github.com/scalasm/snapshotalyzer.git
创建时间: 2020-03-12T22:13:26Z
项目社区:https://github.com/scalasm/snapshotalyzer

开源协议:GNU General Public License v3.0

下载


Snapshotalyzer

Python application that manages AWS EC2 snapshots

Requirements

This project uses pipenv, so you need it to be installed in your sistem:

  1. pip3 install pipenv
  2. pipenv --three
  3. pipenv install boto3
  4. pipenv install -d ipython
  5. pipenv install -d pylint
  6. pipenv install -d setuptools

How to create a redistributable package

We use setup tools:

  1. pipenv run python setup.py bdist_wheel

Once you have done this, you can install it and run like a normal installed application:

  1. pip3 install dist/snapshotalyzer-0.1-py3-none-any.whl
  1. mario@scalasm-xps:~/src/online-courses/PythonCourse/Snapshotalyzer$ shotty
  2. Usage: shotty [OPTIONS] COMMAND [ARGS]...
  3. Shotty manages snapshots
  4. Options:
  5. --help Show this message and exit.
  6. Commands:
  7. instances Commands for instances
  8. snapshots Commands for snapshots
  9. volumes Commands for volumes
  1. mario@scalasm-xps:~/src/online-courses/PythonCourse/Snapshotalyzer$ pip3 show snapshotalyzer
  2. Name: snapshotalyzer
  3. Version: 0.1
  4. Summary: Snapshotalyzer is a tool to manage AWS EC2 snapshots
  5. Home-page: https://github.com/scalasm/snapshotalyzer
  6. Author: Mario Scalas
  7. Author-email: mario.scalas@gmail.com
  8. License: GPLv3+
  9. Location: /home/mario/.local/lib/python3.6/site-packages
  10. Requires: boto3, click
  11. Required-by:

How to run

Show help

  1. mario@scalasm-xps:~/src/online-courses/PythonCourse/Snapshotalyzer$ pipenv run
  1. python shotty/shotty.py --help
  2. Usage: shotty.py [OPTIONS] COMMAND [ARGS]...
  3. Commands for instances
  4. Options:
  5. --help Show this message and exit.
  6. Commands:
  7. list List EC2 instances
  8. start Start EC2 instances
  9. stop Stop EC2 instances

List EC2 instances

  1. pipenv install
  2. run python shotty/shotty.py list --project="Python Course"

will print out something like:

  1. i-06922f2f1a6ea5a46, x86_64, t2.micro, running, eu-central-1b, ec2-3-127-148-5.eu-central-1.compute.amazonaws.com, Python Course

Other EC2 commands

  1. pipenv run python shotty/shotty.py stop --project="Python Course"
  1. pipenv run python shotty/shotty.py start --project="Python Course"
  1. pipenv run python shotty/shotty.py snapshots list

Pipenv hints

Run the shell to get the exact environment:

  1. pipenv shell

Install additional dependencies

  1. pipenv install requests