Copilot-cli: `app show` command experience

Created on 12 Dec 2019  路  3Comments  路  Source: aws/copilot-cli

Experience

The help menu

$ ecs-preview app show -h
Show details of your application.

Usage
  ecs-preview app show [flags]

Flags
  -a,  --app string              Name of the application.
  -e,  --env string              Name of the environment.
       --json                    Output in JSON format.
  -h,  --help                    Help for command.

Examples
  $ ecs-preview app show -a my-app

The interactive experience

$ ecs-preview app show
? Which application would you like to show?
> frontend
> backend
> my-app
> goose-app

? Which environment of "my-app" would you like to show?
> prod
> test

my-app:
   Environment:  test (us-west-2/1234567890)
   Production:   false

  Load Balanced Web App: 
     URL:      flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com
     Path:     *

  Service: 
      Memory:   512 MB
      CPU:      256
      Tasks:    5
      Port:     80
      ARN:      arn...

$ ecs-preview app show -a my-app --json

[
  {
    "AppName": "my-app",
    "Type": "Load Balanced Web App",
    "Project": "my-project",
    "Account": "1234567890"
    "Environments": [
      {
        "Name": "test",
        "Region": "us-west-2",
        "Prod": false,
        "LoadBalancerDNS": "flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com",
        "Path": "*"
      },
    ],
    "Service": {
      "Memory": 512
      "Cpu": 256
      "Tasks": 5
      "Port": 80
      "Arn": "arn..."
    }
  },
]
typenhancement

Most helpful comment

Should the default output be in a table-format? @iamhopaul123 @kohidave
For example,

$ ecs-preview app show front-end
Environment            Is Production?          Memory        CPU      Tasks            Path          URL      
-----------            --------------          ------        ---      -----            ----          ---
test                   No                      512           512      4/4 (Running)    /front-end    flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com
prod-iad               Yes                     1024          1024     6/12 (Running)   /front-end    flask-Ec2Se-KCH5OLWN57WM-992971783.us-east-1.elb.amazonaws.com

I believe this will make the output more grep-parseable, one thing that would be cool is for users to define their own columns.
For example:

$ ecs-preview app show front-end --columns "Environment,URL,Path"
Environment           URL                                                                Path
-----------           ---                                                                ----
test                  flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com     /front-end

All 3 comments

I was thinking, maybe to simplify things, app show would take two flags, app name and environment.

ecs-preview app show
? Which application would you like to show?
> ...
? Which environment of `front-end` would you like to show? 
> test
> prod

front-end:
   Environment:  test (us-west-2/1234567890)
   Production:   true

  Load Balanced Web App: 
     URL:      flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com
     Path:     /front-end

  Service: 
      Memory:   512 MB
      CPU:      1vcpu
      Tasks:    5
      ARN:      arn...

The service section can come later. I do like keeping the json option, though :D

Also, obligatory style-guide link.

Should the default output be in a table-format? @iamhopaul123 @kohidave
For example,

$ ecs-preview app show front-end
Environment            Is Production?          Memory        CPU      Tasks            Path          URL      
-----------            --------------          ------        ---      -----            ----          ---
test                   No                      512           512      4/4 (Running)    /front-end    flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com
prod-iad               Yes                     1024          1024     6/12 (Running)   /front-end    flask-Ec2Se-KCH5OLWN57WM-992971783.us-east-1.elb.amazonaws.com

I believe this will make the output more grep-parseable, one thing that would be cool is for users to define their own columns.
For example:

$ ecs-preview app show front-end --columns "Environment,URL,Path"
Environment           URL                                                                Path
-----------           ---                                                                ----
test                  flask-Ec2Se-KCH5OLWN57WM-992971783.us-west-2.elb.amazonaws.com     /front-end

May need to add "Service" info as well

Was this page helpful?
0 / 5 - 0 ratings