Skip to content

aptible/aptible-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Aptible CLI

Command-line interface for Aptible services.

Installation

NOTE: To install the aptible tool as a system-level binary, Aptible recommends you install the Aptible CLI directly, which is faster and more robust.

Add the following line to your application's Gemfile.

gem 'aptible-cli'

And then run bundle install.

Usage

From aptible help:

Commands:
  aptible apps                                                                                                                                                                                                                                                                                                                                                  # List all applications
  aptible apps:create HANDLE                                                                                                                                                                                                                                                                                                                                    # Create a new application
  aptible apps:deprovision                                                                                                                                                                                                                                                                                                                                      # Deprovision an app
  aptible apps:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE]                                                                                                                                                                                                                                                                                  # Rename an app handle. In order for the new app handle to appear in log drain and metric drain destinations, you must restart the app.
  aptible apps:scale SERVICE [--container-count COUNT] [--container-size SIZE_MB]                                                                                                                                                                                                                                                                               # Scale a service
  aptible backup:list DB_HANDLE                                                                                                                                                                                                                                                                                                                                 # List backups for a database
  aptible backup:orphaned                                                                                                                                                                                                                                                                                                                                       # List backups associated with deprovisioned databases
  aptible backup:purge BACKUP_ID                                                                                                                                                                                                                                                                                                                                # Permanently delete a backup and any copies of it
  aptible backup:restore BACKUP_ID [--environment ENVIRONMENT_HANDLE] [--handle HANDLE] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN]                                                                                                                                                                                                    # Restore a backup
  aptible config                                                                                                                                                                                                                                                                                                                                                # Print an app's current configuration
  aptible config:add [VAR1=VAL1] [VAR2=VAL2] [...]                                                                                                                                                                                                                                                                                                              # Add an ENV variable to an app
  aptible config:rm [VAR1] [VAR2] [...]                                                                                                                                                                                                                                                                                                                         # Remove an ENV variable from an app
  aptible config:set [VAR1=VAL1] [VAR2=VAL2] [...]                                                                                                                                                                                                                                                                                                              # Add an ENV variable to an app
  aptible config:unset [VAR1] [VAR2] [...]                                                                                                                                                                                                                                                                                                                      # Remove an ENV variable from an app
  aptible db:backup HANDLE                                                                                                                                                                                                                                                                                                                                      # Backup a database
  aptible db:clone SOURCE DEST                                                                                                                                                                                                                                                                                                                                  # Clone a database to create a new one
  aptible db:create HANDLE [--type TYPE] [--version VERSION] [--container-size SIZE_MB] [--disk-size SIZE_GB] [--key-arn KEY_ARN]                                                                                                                                                                                                                               # Create a new database
  aptible db:deprovision HANDLE                                                                                                                                                                                                                                                                                                                                 # Deprovision a database
  aptible db:dump HANDLE [pg_dump options]                                                                                                                                                                                                                                                                                                                      # Dump a remote database to file
  aptible db:execute HANDLE SQL_FILE [--on-error-stop]                                                                                                                                                                                                                                                                                                          # Executes sql against a database
  aptible db:list                                                                                                                                                                                                                                                                                                                                               # List all databases
  aptible db:modify HANDLE [--iops IOPS] [--volume-type [gp2, gp3]]                                                                                                                                                                                                                                                                                             # Modify a database disk
  aptible db:reload HANDLE                                                                                                                                                                                                                                                                                                                                      # Reload a database
  aptible db:rename OLD_HANDLE NEW_HANDLE [--environment ENVIRONMENT_HANDLE]                                                                                                                                                                                                                                                                                    # Rename a database handle. In order for the new database handle to appear in log drain and metric drain destinations, you must reload the database.
  aptible db:replicate HANDLE REPLICA_HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--logical --version VERSION] [--key-arn KEY_ARN]                                                                                                                                                                                                                 # Create a replica/follower of a database
  aptible db:restart HANDLE [--container-size SIZE_MB] [--disk-size SIZE_GB] [--iops IOPS] [--volume-type [gp2, gp3]]                                                                                                                                                                                                                                           # Restart a database
  aptible db:tunnel HANDLE                                                                                                                                                                                                                                                                                                                                      # Create a local tunnel to a database
  aptible db:url HANDLE                                                                                                                                                                                                                                                                                                                                         # Display a database URL
  aptible db:versions                                                                                                                                                                                                                                                                                                                                           # List available database versions
  aptible deploy [OPTIONS] [VAR1=VAL1] [VAR2=VAL2] [...]                                                                                                                                                                                                                                                                                                        # Deploy an app
  aptible endpoints:database:create DATABASE                                                                                                                                                                                                                                                                                                                    # Create a Database Endpoint
  aptible endpoints:database:modify --database DATABASE ENDPOINT_HOSTNAME                                                                                                                                                                                                                                                                                       # Modify a Database Endpoint
  aptible endpoints:deprovision [--app APP | --database DATABASE] ENDPOINT_HOSTNAME                                                                                                                                                                                                                                                                             # Deprovision an App or Database Endpoint
  aptible endpoints:https:create [--app APP] SERVICE                                                                                                                                                                                                                                                                                                            # Create an App HTTPS Endpoint
  aptible endpoints:https:modify [--app APP] ENDPOINT_HOSTNAME                                                                                                                                                                                                                                                                                                  # Modify an App HTTPS Endpoint
  aptible endpoints:list [--app APP | --database DATABASE]                                                                                                                                                                                                                                                                                                      # List Endpoints for an App or Database
  aptible endpoints:renew [--app APP] ENDPOINT_HOSTNAME                                                                                                                                                                                                                                                                                                         # Renew an App Managed TLS Endpoint
  aptible endpoints:tcp:create [--app APP] SERVICE                                                                                                                                                                                                                                                                                                              # Create an App TCP Endpoint
  aptible endpoints:tcp:modify [--app APP] ENDPOINT_HOSTNAME                                                                                                                                                                                                                                                                                                    # Modify an App TCP Endpoint
  aptible endpoints:tls:create [--app APP] SERVICE                                                                                                                                                                                                                                                                                                              # Create an App TLS Endpoint
  aptible endpoints:tls:modify [--app APP] ENDPOINT_HOSTNAME                                                                                                                                                                                                                                                                                                    # Modify an App TLS Endpoint
  aptible environment:ca_cert                                                                                                                                                                                                                                                                                                                                   # Retrieve the CA certificate associated with the environment
  aptible environment:list                                                                                                                                                                                                                                                                                                                                      # List all environments
  aptible environment:rename OLD_HANDLE NEW_HANDLE                                                                                                                                                                                                                                                                                                              # Rename an environment handle. In order for the new environment handle to appear in log drain/metric destinations, you must restart the apps/databases in this environment.
  aptible help [COMMAND]                                                                                                                                                                                                                                                                                                                                        # Describe available commands or one specific command
  aptible log_drain:create:datadog HANDLE --url DATADOG_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                                                             # Create a Datadog Log Drain
  aptible log_drain:create:elasticsearch HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                                                    # Create an Elasticsearch Log Drain
  aptible log_drain:create:https HANDLE --url URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                                                                       # Create a HTTPS Drain
  aptible log_drain:create:logdna HANDLE --url LOGDNA_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                                                               # Create a LogDNA Log Drain
  aptible log_drain:create:papertrail HANDLE --host PAPERTRAIL_HOST --port PAPERTRAIL_PORT --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                              # Create a Papertrail Log Drain
  aptible log_drain:create:sumologic HANDLE --url SUMOLOGIC_URL --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                                                         # Create a Sumologic Drain
  aptible log_drain:create:syslog HANDLE --host SYSLOG_HOST --port SYSLOG_PORT [--token TOKEN] --environment ENVIRONMENT [--drain-apps true/false] [--drain_databases true/false] [--drain_ephemeral_sessions true/false] [--drain_proxies true/false]                                                                                                          # Create a Papertrail Log Drain
  aptible log_drain:deprovision HANDLE --environment ENVIRONMENT                                                                                                                                                                                                                                                                                                # Deprovisions a log drain
  aptible log_drain:list                                                                                                                                                                                                                                                                                                                                        # List all Log Drains
  aptible login                                                                                                                                                                                                                                                                                                                                                 # Log in to Aptible
  aptible logs [--app APP | --database DATABASE]                                                                                                                                                                                                                                                                                                                # Follows logs from a running app or database
  aptible logs_from_archive --bucket NAME --region REGION --stack NAME [ --decryption-keys ONE [OR MORE] ] [ --download-location LOCATION ] [ [ --string-matches ONE [OR MORE] ] | [ --app-id ID | --database-id ID | --endpoint-id ID | --container-id ID ] [ --start-date YYYY-MM-DD --end-date YYYY-MM-DD ] ] --bucket=BUCKET --region=REGION --stack=STACK  # Retrieves container logs from an S3 archive in your own AWS account. You must provide your AWS credentials via the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  aptible maintenance:apps                                                                                                                                                                                                                                                                                                                                      # List Apps impacted by maintenance schedules where restarts are required
  aptible maintenance:dbs                                                                                                                                                                                                                                                                                                                                       # List Databases impacted by maintenance schedules where restarts are required
  aptible metric_drain:create:datadog HANDLE --api_key DATADOG_API_KEY --site DATADOG_SITE --environment ENVIRONMENT                                                                                                                                                                                                                                            # Create a Datadog Metric Drain
  aptible metric_drain:create:influxdb HANDLE --db DATABASE_HANDLE --environment ENVIRONMENT                                                                                                                                                                                                                                                                    # Create an InfluxDB Metric Drain
  aptible metric_drain:create:influxdb:custom HANDLE --username USERNAME --password PASSWORD --url URL_INCLUDING_PORT --db INFLUX_DATABASE_NAME --environment ENVIRONMENT                                                                                                                                                                                       # Create an InfluxDB Metric Drain
  aptible metric_drain:create:influxdb:customv2 HANDLE --org ORGANIZATION --token INFLUX_TOKEN --url URL_INCLUDING_PORT --bucket INFLUX_BUCKET_NAME --environment ENVIRONMENT                                                                                                                                                                                   # Create an InfluxDB v2 Metric Drain
  aptible metric_drain:deprovision HANDLE --environment ENVIRONMENT                                                                                                                                                                                                                                                                                             # Deprovisions a Metric Drain
  aptible metric_drain:list                                                                                                                                                                                                                                                                                                                                     # List all Metric Drains
  aptible operation:cancel OPERATION_ID                                                                                                                                                                                                                                                                                                                         # Cancel a running operation
  aptible operation:follow OPERATION_ID                                                                                                                                                                                                                                                                                                                         # Follow logs of a running operation
  aptible operation:logs OPERATION_ID                                                                                                                                                                                                                                                                                                                           # View logs for given operation
  aptible rebuild                                                                                                                                                                                                                                                                                                                                               # Rebuild an app, and restart its services
  aptible restart                                                                                                                                                                                                                                                                                                                                               # Restart all services associated with an app
  aptible services                                                                                                                                                                                                                                                                                                                                              # List Services for an App
  aptible ssh [COMMAND]                                                                                                                                                                                                                                                                                                                                         # Run a command against an app
  aptible version                                                                                                                                                                                                                                                                                                                                               # Print Aptible CLI version

Output Format

By default, the Aptible CLI outputs data as unstructured text, designed for human consumption.

If you need to parse the output in another program, set the APTIBLE_OUTPUT_FORMAT environment variable to json when calling the Aptible CLI for JSON output.

The default format is text.

Contributing

  1. Fork the project.
  2. Commit your changes, with specs.
  3. Ensure that your code passes specs (rake spec) and meets Aptible's Ruby style guide (rake rubocop).
  4. If you add a command, sync this README (bundle exec script/sync-readme-usage).
  5. Create a new pull request on GitHub.

Contributors

Copyright and License

MIT License, see LICENSE for details.

Copyright (c) 2019 Aptible and contributors.