PowerDown CLI v0.6
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
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.
power [switches] CMD ACTIONS ARGS ...
-h, --help -n, --no-header -p, --prefix PREFIX --show-teams -t, --token -T, --token-arg TOKEN -V, --version
deinit down init resource(s) status up
Resources are server instances, databases, autoscale groups and PowerDown logical resource groups.
To use the PowerDown CLI, you must first initialize the CLI with a valid, current PowerDown API token.
Tokens are generated users via the PowerDown app. Tokens can have an expiry and multiple tokens can be active at any one time for a user.
Tokens are 35 character random values. For example:
To initialize the CLI, run the init command and power will prompt for the token. To erase the token, run:
You can override the stored token by using the --token-arg or --token command line options. It is not recommended to use --token-arg as command lines are often logged by web servers and proxies.
Commands use resource names and match resources based on the supplied name. The name is used to match either:
- the resource long name
- the resource Name tag
- or the resource ID
The match will be successful only if the search pattern matches exactly one resource.
To list the set of resources for your teams:
This will display a table of current resources with the resource short name, tag, state and desired state. For example:
Name Tag State Desired stage stage off off test test off off example/autoscale/prod-rocket-app prod-rocket-app on - example/server/i-0f8c46fc83164a542 trial-server off - example/autoscale/EC2ContainerServi ECS Instance - EC2Contai off - example/service/fargate-nginx fargate-nginx off -
Using the -v will display additional columns including the resource ID, machine type, cloud provider charge rate, and the cloud region.
Powering Up Resources
The up action will power up a resource for a period of time.
power up 4hr Name
There is an alternate form that specifies an end time instead of a duration:
power up Name till 7:00pm
The following end time formats are supported:
HH:MM HH:MM [AM|PM] MM/DD/YYYY HH:MM
Powering Down Resources
You can power down a resource if no other user is currently requiring the resource to be powered up.
power down Name
Show Resource Status
To display the status of a resource:
power status test
Name: test Type: group Id: 12953 State: off Desired: off End: forever Tag: test Rate: $0.0402 per hour Service: powerdown Region: global