CLI tool for interacting with Spotinst AWS elasticgroups
Project description
# spotinst-cli
spotinst-cli is is an interactive command line tool which allows you to to control your spotinst groups and instances.
### Usage
spotinst-cli has the following flags -
```
-h, --help show this help message and exit
-a ACCOUNT, --account=ACCOUNT spotinst account id defined as environment variable
-g GREP, --grep=GREP text to filter groups by
-u UNGREP, --ungrep=UNGREP text to exclude groups
-l, --list show group list and exit
-j, --json output pure json -- useful for piping into json parsers like jq
-d, --get-data get groups data from spotinst
-s, --get-status get groups status
--get-health get groups health per instance
--min=MIN update group minimum capacity, must supply with max and target
--target=TARGET update group target capacity, must supply with min and max
--max=MAX update group maximum capacity, must supply with min and target
--scale-up=SCALE_UP scale up group by X number of instances
--scale-down=SCALE_DOWN scale down group by X number of instances
--suspend suspend group activities
--unsuspend unsuspend group activities
--suspension-status get groups suspension status
--roll roll a group, must supply batch-size, and grace-period
--batch-size=BATCH roll batch size - must supply with the roll flag
--grace-period=GRACE roll grace period - must supply with the roll flag
--replace-ami=AMI replace AMI for group
--replace-health=HEALTH replace the health check type - can be HCS, EC2, ELB
--set-user-data=USER_DATA updated user data - supply a file path which contains the user data script (cloud init)
--get-user-data fetch the user data script (cloud init)
--roll-status check the status of deployments
-y, --skip-validation skip prompt validation for non-interactive mode
```
### Multiple Accounts
spotinst-cli can use environment variables to reference multiple provider accounts.
Set variables like:
export spotinst_account_prod="act-asdfasdf"
export spotinst_account_qa="act-hjklhjkl"
export spotinst_account_dev="act-zxcvzxcv"
$> spotinst-cli --account prod
====================================================
Getting groups from Spotisnt, please wait...
====================================================
===================================
Found the following groups:
===================================
+---+-------------------------------+--------------+-----+--------+-----+
| # | Group name | ID | Min | Target | Max |
+---+-------------------------------+--------------+-----+--------+-----+
| 1 | Group-A | sig-adsfadfd | 0 | 0 | 200 |
| 2 | Group-B | sig-fddgdfgd | 0 | 0 | 200 |
| 3 | Group-C | sig-hdfhsfdg | 0 | 52 | 200 |
| 4 | Web Servers | sig-hfhdgdhg | 0 | 0 | 4 |
| 5 | ECS | sig-dfghdfgh | 1 | 8 | 12 |
+---+-------------------------------+--------------+-----+--------+-----+
SpotInst account ids can be found in the web console under settings/account for each of your accounts.
There is currently no way to pull account ids from the SpotInst API.
### Installation
```
pip install spotinstcli
```
OR
```
git clone git@github.com:giladsh1/spotinst-cli.git
pip install $(pwd)/requirements.txt --user --upgrade
ln -s /usr/local/bin/spotinst-cli $(pwd)spotinst-cli/spotinst-cli
```
spotinst-cli is is an interactive command line tool which allows you to to control your spotinst groups and instances.
### Usage
spotinst-cli has the following flags -
```
-h, --help show this help message and exit
-a ACCOUNT, --account=ACCOUNT spotinst account id defined as environment variable
-g GREP, --grep=GREP text to filter groups by
-u UNGREP, --ungrep=UNGREP text to exclude groups
-l, --list show group list and exit
-j, --json output pure json -- useful for piping into json parsers like jq
-d, --get-data get groups data from spotinst
-s, --get-status get groups status
--get-health get groups health per instance
--min=MIN update group minimum capacity, must supply with max and target
--target=TARGET update group target capacity, must supply with min and max
--max=MAX update group maximum capacity, must supply with min and target
--scale-up=SCALE_UP scale up group by X number of instances
--scale-down=SCALE_DOWN scale down group by X number of instances
--suspend suspend group activities
--unsuspend unsuspend group activities
--suspension-status get groups suspension status
--roll roll a group, must supply batch-size, and grace-period
--batch-size=BATCH roll batch size - must supply with the roll flag
--grace-period=GRACE roll grace period - must supply with the roll flag
--replace-ami=AMI replace AMI for group
--replace-health=HEALTH replace the health check type - can be HCS, EC2, ELB
--set-user-data=USER_DATA updated user data - supply a file path which contains the user data script (cloud init)
--get-user-data fetch the user data script (cloud init)
--roll-status check the status of deployments
-y, --skip-validation skip prompt validation for non-interactive mode
```
### Multiple Accounts
spotinst-cli can use environment variables to reference multiple provider accounts.
Set variables like:
export spotinst_account_prod="act-asdfasdf"
export spotinst_account_qa="act-hjklhjkl"
export spotinst_account_dev="act-zxcvzxcv"
$> spotinst-cli --account prod
====================================================
Getting groups from Spotisnt, please wait...
====================================================
===================================
Found the following groups:
===================================
+---+-------------------------------+--------------+-----+--------+-----+
| # | Group name | ID | Min | Target | Max |
+---+-------------------------------+--------------+-----+--------+-----+
| 1 | Group-A | sig-adsfadfd | 0 | 0 | 200 |
| 2 | Group-B | sig-fddgdfgd | 0 | 0 | 200 |
| 3 | Group-C | sig-hdfhsfdg | 0 | 52 | 200 |
| 4 | Web Servers | sig-hfhdgdhg | 0 | 0 | 4 |
| 5 | ECS | sig-dfghdfgh | 1 | 8 | 12 |
+---+-------------------------------+--------------+-----+--------+-----+
SpotInst account ids can be found in the web console under settings/account for each of your accounts.
There is currently no way to pull account ids from the SpotInst API.
### Installation
```
pip install spotinstcli
```
OR
```
git clone git@github.com:giladsh1/spotinst-cli.git
pip install $(pwd)/requirements.txt --user --upgrade
ln -s /usr/local/bin/spotinst-cli $(pwd)spotinst-cli/spotinst-cli
```
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for spotinstcli-0.1.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a676e2af7c6260a3a2335a7d2fcecdaf642fd58169c987feca37caa642ac845 |
|
MD5 | 0c22658c2c6aa615f1685fe985fc670a |
|
BLAKE2b-256 | 2dd4e4e805ae0b220ac3542c656ee95b9ea7a9bd69a9266a6ebc42fed99b5eb5 |