Building the PowerDown CLI
The PowerDown CLI provides an alternate command line interface for interacting with the PowerDown service.
The PowerDown CLI is in beta release and supports the following functionality:
- Listing resources
- Display status of resources
- Power up and down resources
Running the Binaries
Prebuilt binaries for Linux, macOS and Windows are provided as part of each release. The packages are simple ZIP archives containing a single "fat" binary for CLI. To download, please see the release on GitHub and then download the appropriate package:
Building from Source
Building from source requires a current installed Go language environment. See Installing Go for details.
download the PowerDown CLI via:
git clone https://github.com/sensedeep/powerdown-cli
Build with Go
cd src/github.com/sensedeep/powerdown-cli go get go build -o power # Install to a binary directory in your PATH
Build via Make
cd powerdown-cli make
cp power /usr/local/bin or sudo make install
power --token-arg API-TOKEN init power list power up nginx 1h power down nginx power status nginx
Before you can use the CLI, you must get an authentication token via the PowerDown web UI. To do this, go to the Account -> Tokens -> New API Token page and create a new API token. This will generate a token that looks like:
Copy that token and then run:
and type in your authentication API token and it will be saved for future use. Treat your authentication token like you would treat any valuable password -- keep it safe and private.
power list # List all user resources power status i-76b3 # Use resource Name or Name Tag or partial power up i-076b3 4h # Duration defaults to 8 hours power off i-076b3 # Turn resource off if permitting power up i-076b3 till 7:00pm # Power up resource till 7:00pm local time
Resource names should be either a complete PowerDown name path as displayed in the resource list or any unique substring of that name or substring of the Tag Name. This permits easy naming. For example, to power up an Nginx Fargate container service that has the name "/powerdown/service/nginx-service":
power up nginx 1h