@panadata/devops-cli

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

Usage no npm install needed!

<script type="module">
  import panadataDevopsCli from 'https://cdn.skypack.dev/@panadata/devops-cli';
</script>

README

devops-cli

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

oclif Version Downloads/week License

Usage

$ npm install -g @panadata/devops-cli
$ devops COMMAND
running command...
$ devops (-v|--version|version)
@panadata/devops-cli/0.0.4 linux-x64 node-v14.17.5
$ devops --help [COMMAND]
USAGE
  $ devops COMMAND
...

Commands

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

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

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

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

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

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

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

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

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

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