npm package: @panadata/devops-cli
Description: A CLI that helps manage infrastructure, permissions and monitoring for complex architectures with multiple components in AWS.
Author: gkpty @gkpty
Latest version: 0.0.6

devops-cli
==========

A CLI that helps manage infrastructure, permissions and monitoring for complex architectures with multiple components in AWS.

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/devops-cli.svg)](https://npmjs.org/package/devops-cli)
[![Downloads/week](https://img.shields.io/npm/dw/devops-cli.svg)](https://npmjs.org/package/devops-cli)
[![License](https://img.shields.io/npm/l/devops-cli.svg)](https://github.com/panadata/devops-cli/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @panadata/devops-cli
$ devops COMMAND
running command...
$ devops (-v|--version|version)
@panadata/devops-cli/0.0.6 linux-x64 node-v14.17.5
$ devops --help [COMMAND]
USAGE
  $ devops COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`devops help [COMMAND]`](#devops-help-command)
* [`devops init`](#devops-init)
* [`devops logs`](#devops-logs)
* [`devops monitoring ACTION`](#devops-monitoring-action)
* [`devops permissions ACTION`](#devops-permissions-action)
* [`devops pipeline [ACTION]`](#devops-pipeline-action)
* [`devops resource:s3_bucket ACTION`](#devops-resources3_bucket-action)
* [`devops service:long_task ACTION`](#devops-servicelong_task-action)
* [`devops service:vm ACTION`](#devops-servicevm-action)

## `devops help [COMMAND]`

display help for devops

```
USAGE
  $ devops help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.3/src/commands/help.ts)_

## `devops init`

This creates the devops configuration files for your service. 

```
USAGE
  $ devops init

OPTIONS
  -d, --description=description
      Description of the service.

  -e, --envs=envs
      (required) [default: staging] A list of the different environments of the service/s

  -g, --global
      Initialize your devops workspace globally.

  -h, --help
      show CLI help

  -i, --ids=ids
      Id of the service for its respective environment in the format env=id. For services of type vm this is the isntance 
      id. For services of type long_task it is the cluster id

  -n, --name=name
      (required if the --global flag is NOT set) Name of the service. Required when initializing a service.

  -p, --pipeline=pipeline
      Name of the AWS codepipeline pipeline.

  -r, --resources=resources
      A List of resources in the format resource_type=resource_name. Available resource types include s3_bucket

  -s, --secrets=secrets
      List of names of the secrets for your app in caps, i.e SECRET_NAME

  -t, --sns_topic=sns_topic
      Name of the default sns topic you want to send alerts from this service to.

  -t, --type=long_task|vm|other
      (required if the --global flag is NOT set) Type of the service. Choose other if your service is not an AWS EC2 
      instance or an AWS copilot scheduled job.

  --aws_account=aws_account
      (required if the --global flag is set) Default aws profile youd like to use

  --aws_profile=aws_profile
      [default: default] (required if the --global flag is set) Default aws profile youd like to use with the devops cli

  --aws_region=us-east-2|us-east-1|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-1|ap-northeast-3|ap-northeast-2|ap-
  southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-north-
  1|me-south-1|sa-east-1|us-gov-east-1|us-gov-west-1
      (required if the --global flag is set) Default aws region youd like to use

  --copilot_app=copilot_app
      [default: default] Name of the aws copilot app. One copilot app may contain all of your copilot services.

DESCRIPTION
  After running succesfully this should create a devops directory in your project with a manifest.yml file that contains 
  your services info. Add the -g flag to initialize your devops workspace globally (this should only be done once after 
  installing the CLI).

EXAMPLES
  $ devops init -n=my_first_service -t=vm -d "this is the first service im managaing with devops" -e staging prod -i 
  staging=i-004214202 prod=i-453565299 -r s3_bucket=test-bucket
  $ devops init -g --aws_region=us-east-1 --aws_profile=default --aws_account=69123123420 --copilot_app=panadata -e 
  staging prod
```

_See code: [src/commands/init.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/init.ts)_

## `devops logs`

Interact with the AWS cloudwatch logs of the given service

```
USAGE
  $ devops logs

OPTIONS
  -a, --copilot_app=copilot_app  (required) [default: default] Name of the aws copilot app.

  -f, --filter=filter            Filter logs that contain a given string or pattern. For more information on filter
                                 pattern syntax see:
                                 https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html

  -h, --help                     show CLI help

  -n, --name=name                (required) Name of the service.

  -s, --start_time=start_time    [default: 1] Time range in hours you want to list logs for, default is 1 hour.

  -t, --tail                     Tail logs consecutively, as cloudwatch recieves new logs these will be logged in your
                                 console.

  --env=dev|staging|prod         (required) [default: staging] Name of the environment

  --type=long_task|vm|other      (required) Type of the service.

EXAMPLES
  $ devops logs -t
  $ devops logs -f "POST 200"
```

_See code: [src/commands/logs.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/logs.ts)_

## `devops monitoring ACTION`

Manage monitoring of a given service for the specified environments

```
USAGE
  $ devops monitoring ACTION

OPTIONS
  -a, --copilot_app=copilot_app
      (required) [default: default] Name of the aws copilot app.

  -e, --envs=dev|staging|prod
      (required) [default: staging] A list of the environments you want to monitor.

  -g, --global
      Create a global dashboard for all of your services for the given environments

  -h, --help
      show CLI help

  -n, --name=name
      (required) Name of the service.

  -t, --sns_topic=sns_topic
      Name of the sns topic you want to send alerts to.

  -t, --type=long_task|vm|other
      (required) Type of the service.

  --aws_account=aws_account
      (required) AWS account number.

  --aws_region=us-east-2|us-east-1|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-1|ap-northeast-3|ap-northeast-2|ap-
  southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-north-
  1|me-south-1|sa-east-1|us-gov-east-1|us-gov-west-1
      (required) AWS region.

DESCRIPTION
  Available actions include:
  - init: generates a cloudformation template with alarms, metrics and a dashboard for the specified environments of the 
  given service
  - deploy: deploys the cloudformation template with the alarms, metrics, and dashboard for the specified environments
  - delete: deletes alarms, metrics and dashboards associated to the given service for the specified environments

EXAMPLES
  $ devops monitoring init
  $ devops monitoring deploy
  $ devops monitoring delete
  $ devops monitoring ls
```

_See code: [src/commands/monitoring.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/monitoring.ts)_

## `devops permissions ACTION`

Manage the permissions of a given service for the specified roles

```
USAGE
  $ devops permissions ACTION

OPTIONS
  -a, --copilot_app=copilot_app
      (required) [default: default] Name of the aws copilot app.

  -h, --help
      show CLI help

  -n, --name=name
      (required) Name of the service.

  -p, --pipeline=pipeline
      (required) Name of the AWS codepipeline pipeline.

  -r, --roles=collaborator|owner
      (required) [default: collaborator] Name of the roles you want to generate permissions for.

  -t, --type=long_task|vm|other
      (required) Type of the service.

  --aws_account=aws_account
      (required) AWS account number.

  --aws_region=us-east-2|us-east-1|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-1|ap-northeast-3|ap-northeast-2|ap-
  southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-north-
  1|me-south-1|sa-east-1|us-gov-east-1|us-gov-west-1
      (required) AWS region.

  --group=group
      Name of the AWS IAM group that you want to attach the given policy to.

DESCRIPTION
  Available actions include:
  - init: generates a cloudformation template with the permissions for the specified roles
  - deploy: deploys the cloudformation template with the permissions for the specified roles
  - delete: removes permissions from the given role to the given service
  - ls: lists all the users/groups from the given role with permissions to the given service
  - attach: Attach permissions from the given role to a given team

EXAMPLES
  $ devops permissions init
  $ devops permissions deploy
  $ devops permissions delete
  $ devops permissions ls
```

_See code: [src/commands/permissions.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/permissions.ts)_

## `devops pipeline [ACTION]`

Interact with the AWS codepipeline CI/CD pipeline of a given service 

```
USAGE
  $ devops pipeline [ACTION]

OPTIONS
  -h, --help               show CLI help
  -m, --message=message    A message that describes the release to production
  -n, --name=name          (required) Name of the service.
  -p, --pipeline=pipeline  (required) Name of the AWS codepipeline pipeline.

DESCRIPTION
  Available actions include:
  - info: get infomration about the codepipeline
  - status: get the status of the latest execution
  - approve: make a manual approval in the given pipeline to promote changes to prod

EXAMPLES
  $ devops pipeline info
  $ devops pipeline status
  $ devops pipeline approve -m 'everything looks good'
```

_See code: [src/commands/pipeline.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/pipeline.ts)_

## `devops resource:s3_bucket ACTION`

Interact with a resource of type s3 bucket

```
USAGE
  $ devops resource:s3_bucket ACTION

OPTIONS
  -b, --bucket=bucket
      Name of the s3 bucket; Defaults to the first resource of type s3 in your service manifest.

  -h, --help
      show CLI help

  -n, --name=name
      (required) Name of the service.

  -o, --object=object
      Path of an s3 object.

  -p, --path=path
      Relative path were you want to save the object download.

  --aws_account=aws_account
      (required) AWS account number.

  --aws_region=us-east-2|us-east-1|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-1|ap-northeast-3|ap-northeast-2|ap-
  southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-north-
  1|me-south-1|sa-east-1|us-gov-east-1|us-gov-west-1
      (required) AWS region.

  --env=dev|staging|prod
      (required) [default: staging] Name of the environment

DESCRIPTION
  Available actions include:
  - ls: Lists all objects stored in the specified s3 bucket in descending order by lastModified date.
  - info: Get information of an s3 object.
  - download: Download an object from an s3 bucket

EXAMPLES
  $ devops resource:s3_bucket ls
  $ devops resource:s3_bucket info
  $ devops resource:s3_bucket download
```

_See code: [src/commands/resource/s3_bucket.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/resource/s3_bucket.ts)_

## `devops service:long_task ACTION`

Interact with a service of type long_task

```
USAGE
  $ devops service:long_task ACTION

OPTIONS
  -a, --copilot_app=copilot_app
      (required) [default: default] Name of the aws copilot app.

  -e, --execution_arn=execution_arn
      Amazon resource number (arn) of the step function execution

  -h, --help
      show CLI help

  -n, --name=name
      (required) Name of the service.

  --aws_account=aws_account
      (required) AWS account number.

  --aws_region=us-east-2|us-east-1|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-1|ap-northeast-3|ap-northeast-2|ap-
  southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-north-
  1|me-south-1|sa-east-1|us-gov-east-1|us-gov-west-1
      (required) AWS region.

  --env=staging|prod
      (required) Name of the environment

DESCRIPTION
  Available actions include:
  - ls: list step function executions
  - info: get general information about the step function
  - status: get information about the last step function execution
  - start: run the task for the given environment
  - stop: stop the task for the given environment

EXAMPLES
  $ devops service:long_task ls
  $ devops service:long_task info
  $ devops service:long_task status
  $ devops service:long_task start
  $ devops service:long_task stop
```

_See code: [src/commands/service/long_task.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/service/long_task.ts)_

## `devops service:vm ACTION`

Interact with a service of type vm

```
USAGE
  $ devops service:vm ACTION

OPTIONS
  -h, --help
      show CLI help

  -n, --name=name
      (required) Name of the service.

  --aws_account=aws_account
      (required) AWS account number.

  --aws_region=us-east-2|us-east-1|us-west-1|us-west-2|af-south-1|ap-east-1|ap-south-1|ap-northeast-3|ap-northeast-2|ap-
  southeast-1|ap-southeast-2|ap-northeast-1|ca-central-1|eu-central-1|eu-west-1|eu-west-2|eu-south-1|eu-west-3|eu-north-
  1|me-south-1|sa-east-1|us-gov-east-1|us-gov-west-1
      (required) AWS region.

  --env=staging|prod
      (required) Name of the environment

  --instance_type=t2.nano|t2.micro|t2.small|t2.medium|t2.large|t2.xlarge|t2.2xlarge|m5.large|m5.xlarge|m5.2xlarge|m5.4xl
  arge|m5.8xlarge|m5.12xlarge|m5.16xlarge|m5.24xlarge|c5.large|c5.xlarge|c5.2xlarge|c5.4xlarge|c5.9xlarge|c5.12xlarge|c5
  .18xlarge|c5.24xlarge|r5.large|r5.xlarge|r5.2xlarge|r5.4xlarge|r5.8xlarge|r5.12xlarge|r5.16xlarge|r5.24xlarge|r5.metal
  |r5d.large|r5d.xlarge|r5d.2xlarge|r5d.4xlarge|r5d.8xlarge|r5d.12xlarge|r5d.16xlarge|r5d.24xlarge
      (required) [default: m5.large] Name of the ssh key for the instance i.e. scrapkey

  --ssh_key_name=ssh_key_name
      (required) [default: scrapkey] Name of the ssh key for the instance i.e. scrapkey

DESCRIPTION
  Available actions include:
  - info: get infomration about the vm
  - status: get the status of the vm
  - start: start a vm
  - stop: stop a vm
  - reboot: reboot a given vm
  - connect: get the ssh connection string for a given instance

EXAMPLES
  $ devops service:vm info
  $ devops service:vm status
  $ devops service:vm start
  $ devops service:vm stop
  $ devops service:vm reboot
  $ devops service:vm connect
```

_See code: [src/commands/service/vm.ts](https://github.com/panadata/devops-cli/blob/v0.0.6/src/commands/service/vm.ts)_
<!-- commandsstop -->