The cloud resources cleanup utility
Project description
cloudwash
Introduction
cloudwash
is a library written in python that can be used to monitor and remove the unused cloud resources in public and private cloud providers.
Most importantly, cloudwash
provides the CLI utility called 'swach
' that can be used to fire commands to cleanup the resources on cloud.
cloudwash supports following cloud providers:
- Amazon EC2
- Google Cloud
- Microsoft Azure
- RedHat Enterprize Virtualization Manager - RHEV (Provisioned)
- RedHat Openstack (Provisioned)
- VMWare vCenter (Provisioned)
The list of resources it helps to clean are:
- VMs
- Network Interfaces
- Public IPs
- Disks
Installation
cloudwash
can be installed via pip
once you clone this git repository locally.
It is always a good idea to use virtualenv to install pip packages.
For Linux Users, Depending on the distribution you are using, you may need to install following packages (or similar for your distribution of linux):
- libcurl-devel
- openssl-devel
- libxml2-devel
- libxml2-static
- gcc
Pycurl is a one of the dependent package of cloudwash
that wants you to install above dependencies.
Read more about it http://pycurl.io/docs/latest/install.html
Installation:
# git clone https://github.com/RedHatQE/cloudwash.git
# cd cloudwash
# pip install .
# cp settings.yaml.template settings.yaml
Configuration
To use this tool one needs to copy the settings.yaml.template
to settings.yaml
as instructed in Installation section above.
Then, edit the settings.yaml
and feed all the configuration needed to connect with the cloud providers as clients.
cloudwash
uses the DynaConf
configuration python module to access the data in settings.yaml
and it allows an unique way of declaring secrets via Environment variables instead of putting in plain settings.yaml
.
e.g: The Azure password field can be set via environment variable by exporting the environment variable
# export CLEANUP_PROVIDERS__AZURE__PASSWORD = myPa$$worb"
Usage Examples
- Cleanup Help:
# swach --help
Usage: swach [OPTIONS] COMMAND [ARGS]...
A Cleanup Utility to remove the VMs, Discs and Nics from Providers!
Options:
-d, --dry Only show what will be removed from Providers!
--help Show this message and exit.
Commands:
azure Cleanup Azure provider
ec2 Cleanup Amazon provider
gce Cleanup GCE provider
openstack Cleanup OSP provider
rhev Cleanup RHEV provider
vmware Cleanup VMWare provider
- Cleanup Cloud Provider help:
# swach azure --help
Usage: swach azure [OPTIONS]
Cleanup Azure provider
Options:
--all Remove all unused Resources from the provider
--nics Remove only unused NICs from the provider
--discs Remove only unused DISCs from the provider
--vms Remove only unused VMs from the provider
--pips Remove only PiPs from the provider
--help Show this message and exit.
- Cleanup Dry Run (Monitor only mode):
# swach -d azure --all
<<<<<<< Running the cleanup script in DRY RUN mode >>>>>>>
The AZURE providers settings are initialized and validated !
=========== DRY SUMMARY ============
VMs:
Deletable: ['test-bvhoduliam']
Stoppable: ['foremanqe-nightly2']
DISCs:
Deletable: ['test-axodawttrw-nic0']
NICs:
Deletable: ['test-axodawttrw-nic0']
PIPs:
Deletable: ['test-axodawttrw-nic0']
====================================
- Actual Cleanup Run:
# swach azure --all
<<<<<<< Running the cleanup script in ACTION mode >>>>>>>
The AZURE providers settings are initialized and validated !
Stopped [] and removed ['test-bvhoduliam'] VMs from Azure Cloud.
Removed following and all unused nics from Azure Cloud.
['test-axodawttrw-nic0']
Removed following and all unused discs from Azure Cloud.
['test-bvhoduliam-osdisk']
Removed following and all unused pips from Azure Cloud.
['test-axodawttrw-pip0']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cloudwash-0.1.1.tar.gz
.
File metadata
- Download URL: cloudwash-0.1.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f39b54f92712205b8b36ad2f95d014f76ac6ed5f783df6bfcd65d44d706001b5 |
|
MD5 | 5344b44eb8b7485d46eeddaa34b47051 |
|
BLAKE2b-256 | a9b813fe60091358a1c45ba478d7c8ffe3ca2618f8b5756eef2475dd8a92ff52 |