# spotinst-cli
spotinst-cli is is an interactive command line tool which allows you to to control your spotinst groups and instances.
### Installation
```
pip install spotinstcli
```
### 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.
spotinst-cli is is an interactive command line tool which allows you to to control your spotinst groups and instances.
### Installation
```
pip install spotinstcli
```
### 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.
Metadata
Release files for spotinstcli 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spotinstcli-0.1.3-py2-none-any.whl | Python 2 | none | any | Details |
Release files / spotinstcli-0.1.3-py2-none-any.whl
| Download URL | spotinstcli-0.1.3-py2-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
8ed68f27f8f6ee55ae87a1a9d0e6f2e40e5af571654554b005756af41f3a242b
|
|
BLAKE2b-256 checksum How to use checksums |
c176bfbdcb34380d6f65914cc5a3cab70844bf3b1e0b1bbfc7a1d1064262b267
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/2.7.15
|