Services >> Cloud >> AWS >> CLI >> ec2 >> aws ec2 Command Line examples


### To get more help on available subcommands for aws ec2

aws ec2 help


## sample output

ec2
^^^


Description
***********

Amazon Elastic Compute Cloud (Amazon EC2) provides secure and
resizable computing capacity in the Amazon Web Services Cloud. Using
...
...

Available Commands
******************

* accept-address-transferaws

* accept-reserved-instances-exchange-quote

...


### Describe the security groups with table output format (instead of default JSON)

aws ec2 describe-security-groups --output table


## sample output

----------------------------------------------------------------------------
|                          DescribeSecurityGroups                          |
+--------------------------------------------------------------------------+
||                             SecurityGroups                             ||
|+-----------------------+------------------------------------------------+|
||  Description          |  default VPC security group                    ||
||  GroupId              |  sg-e8d8728d                                   ||
||  GroupName            |  default                                       ||
||  OwnerId              |  829526610228                                  ||
||  VpcId                |  vpc-df4f8eba                                  ||
|+-----------------------+------------------------------------------------+|
|||                             IpPermissions                            |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                          UserIdGroupPairs                          ||||
|||+---------------------------+----------------------------------------+|||
||||  GroupId                  |  sg-e8d8728d                           ||||
||||  UserId                   |  829526610228                          ||||
|||+---------------------------+----------------------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
|||                                 Tags                                 |||
||+------------------------------+---------------------------------------+||
|||  Key                         |  Purpose                              |||
|||  Value                       |  ICMP                                 |||
||+------------------------------+---------------------------------------+||
||                             SecurityGroups                             ||
|+-----------------------+------------------------------------------------+|
||  Description          |  default VPC security group                    ||
||  GroupId              |  sg-079d0420c4e7970a2                          ||
||  GroupName            |  default                                       ||
||  OwnerId              |  829526610228                                  ||
||  VpcId                |  vpc-06491db37d71ef6ef                         ||
|+-----------------------+------------------------------------------------+|
|||                             IpPermissions                            |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                          UserIdGroupPairs                          ||||
|||+--------------------+-----------------------------------------------+|||
||||  GroupId           |  sg-079d0420c4e7970a2                         ||||
||||  UserId            |  829526610228                                 ||||
|||+--------------------+-----------------------------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||                             SecurityGroups                             ||
|+-------------+----------------------------------------------------------+|
||  Description|  launch-wizard-4 created 2019-09-25T15:29:08.456+08:00   ||
||  GroupId    |  sg-03453e77bbd6c5635                                    ||
||  GroupName  |  launch-wizard-4                                         ||
||  OwnerId    |  829526610228                                            ||
||  VpcId      |  vpc-df4f8eba                                            ||
|+-------------+----------------------------------------------------------+|
|||                             IpPermissions                            |||
||+--------------------------------------------+-------------------------+||
|||  FromPort                                  |  3389                   |||
|||  IpProtocol                                |  tcp                    |||
|||  ToPort                                    |  3389                   |||
||+--------------------------------------------+-------------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||                             SecurityGroups                             ||
|+-----------------------+------------------------------------------------+|
||  Description          |  default VPC security group                    ||
||  GroupId              |  sg-0bd5ce07758202bee                          ||
||  GroupName            |  default                                       ||
||  OwnerId              |  829526610228                                  ||
||  VpcId                |  vpc-0b4257609c2c71668                         ||
|+-----------------------+------------------------------------------------+|
|||                             IpPermissions                            |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                          UserIdGroupPairs                          ||||
|||+--------------------+-----------------------------------------------+|||
||||  GroupId           |  sg-0bd5ce07758202bee                         ||||
||||  UserId            |  829526610228                                 ||||
|||+--------------------+-----------------------------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||                             SecurityGroups                             ||
|+--------------------------+---------------------------------------------+|
||  Description             |  enable http and httpd                      ||
||  GroupId                 |  sg-4f34b629                                ||
||  GroupName               |  enable-httpx-sg                            ||
||  OwnerId                 |  829526610228                               ||
||  VpcId                   |  vpc-df4f8eba                               ||
|+--------------------------+---------------------------------------------+|
|||                             IpPermissions                            |||
||+----------------------------------------------+-----------------------+||
|||  FromPort                                    |  80                   |||
|||  IpProtocol                                  |  tcp                  |||
|||  ToPort                                      |  80                   |||
||+----------------------------------------------+-----------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||
|||                             IpPermissions                            |||
||+----------------------------------------------+-----------------------+||
|||  FromPort                                    |  443                  |||
|||  IpProtocol                                  |  tcp                  |||
|||  ToPort                                      |  443                  |||
||+----------------------------------------------+-----------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||                             SecurityGroups                             ||
|+-------------+----------------------------------------------------------+|
||  Description|  launch-wizard-1 created 2021-03-15T23:01:27.788+08:00   ||
||  GroupId    |  sg-0a5520f33da2ca3f4                                    ||
||  GroupName  |  launch-wizard-1                                         ||
||  OwnerId    |  829526610228                                            ||
||  VpcId      |  vpc-df4f8eba                                            ||
|+-------------+----------------------------------------------------------+|
|||                             IpPermissions                            |||
||+----------------------------------------------+-----------------------+||
|||  FromPort                                    |  22                   |||
|||  IpProtocol                                  |  tcp                  |||
|||  ToPort                                      |  22                   |||
||+----------------------------------------------+-----------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||                             SecurityGroups                             ||
|+----------------------+-------------------------------------------------+|
||  Description         |  enable SSH and HTTP globally                   ||
||  GroupId             |  sg-0b615527f85597818                           ||
||  GroupName           |  enable-ssh-http-sg                             ||
||  OwnerId             |  829526610228                                   ||
||  VpcId               |  vpc-df4f8eba                                   ||
|+----------------------+-------------------------------------------------+|
|||                             IpPermissions                            |||
||+----------------------------------------------+-----------------------+||
|||  FromPort                                    |  80                   |||
|||  IpProtocol                                  |  tcp                  |||
|||  ToPort                                      |  80                   |||
||+----------------------------------------------+-----------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||
|||                             IpPermissions                            |||
||+----------------------------------------------+-----------------------+||
|||  FromPort                                    |  22                   |||
|||  IpProtocol                                  |  tcp                  |||
|||  ToPort                                      |  22                   |||
||+----------------------------------------------+-----------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||
||                             SecurityGroups                             ||
|+-----------------------+------------------------------------------------+|
||  Description          |  default VPC security group                    ||
||  GroupId              |  sg-04953f2dbecd0ea0d                          ||
||  GroupName            |  default                                       ||
||  OwnerId              |  829526610228                                  ||
||  VpcId                |  vpc-06ec08b5466c60620                         ||
|+-----------------------+------------------------------------------------+|
|||                             IpPermissions                            |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                          UserIdGroupPairs                          ||||
|||+--------------------+-----------------------------------------------+|||
||||  GroupId           |  sg-04953f2dbecd0ea0d                         ||||
||||  UserId            |  829526610228                                 ||||
|||+--------------------+-----------------------------------------------+|||
|||                          IpPermissionsEgress                         |||
||+------------------------------------------------+---------------------+||
|||  IpProtocol                                    |  -1                 |||
||+------------------------------------------------+---------------------+||
||||                              IpRanges                              ||||
|||+----------------------------+---------------------------------------+|||
||||  CidrIp                    |  0.0.0.0/0                            ||||
|||+----------------------------+---------------------------------------+|||
||||                             Ipv6Ranges                             ||||
|||+----------------------------------------+---------------------------+|||
||||  CidrIpv6                              |  ::/0                     ||||
|||+----------------------------------------+---------------------------+|||