How to get an overview of all EC2 instances?
With the script, the EC2 instances of a created role are determined, listed and their IPs and other meta data are given, in order to connect to SSH.
Preconditions
You need access to jumphost with you personal OpenSSH access key. Access an environment via OpenSSH or Putty
Step 1 - Show help context
~$ r3 instance list -h
# Response
List EC2 Instances
optional arguments:
-h, --help show this help message and exit
--all List all EC2 Instances
Step 2 - List EC2 instances
~$ r3 instance list
# Response
Project: test Company: root360 Environment: test
+----------+-----------------------------------------------------+--------------+--------------+---------+---------------------+
| Roles | Name | IP | InstanceType | Status | CreationTime |
+----------+-----------------------------------------------------+--------------+--------------+---------+---------------------+
| admin | root360-test-test-admin-i-0b9be6e23b388e4a4 | 10.76.57.20 | t2.large | running | 2017-01-26_08:39:33 |
| api | root360-test-test-api-auth-i-08d7be895b2a900e0 | 10.76.58.159 | c4.large | running | 2017-09-23_06:55:59 |
| api | root360-test-test-api-auth-i-0161a421fb5ad6fb4 | 10.76.57.89 | c4.large | running | 2017-09-23_05:56:34 |
| api | root360-test-test-api-auth-i-06eb545c4ef8377a6 | 10.76.57.95 | c4.large | running | 2018-01-31_07:13:46 |
| natgw | root360-test-test-natgw-i-0106289d926d132eb | 10.76.56.12 | t2.micro | running | 2017-01-16_09:30:16 |
| nfs | root360-test-test-nfs-i-031d744e559b6ab76 | 10.76.57.58 | t2.micro | running | 2017-01-16_10:10:43 |
| solr | root360-test-test-solr-i-0d45513c4f892375c | 10.76.57.13 | c4.large | running | 2017-01-26_09:14:21 |
| web | root360-test-test-web-i-0490d421af4e4bd28 | 10.76.57.70 | c4.large | running | 2017-06-07_17:19:38 |
| web | root360-test-test-web-i-02e9d4a46ebe13eda | 10.76.58.195 | c4.large | running | 2017-06-07_17:08:36 |
+----------+-----------------------------------------------------+--------------+--------------+---------+---------------------+
The output is grouped by the role of the EC2 instances.
Status of an instance
Status (state) | description |
running | Instance is started and running |
terminated | Instance has been stopped and deleted |
stopping | Instance is down |
stopped | Instance has been downgraded |
shutting down | The instance is stopped for deletion |
pending | Instance is started |
rebooting | Instance is restarted |
Related tutorials
Related components
root360 Knowledge Base - This portal is hosted by Atlassian (atlassian.com | Privacy Policy)