File tree 1 file changed +19
-7
lines changed
1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 5
5
ec2 = boto3 .resource ('ec2' )
6
6
instance_iterator = ec2 .instances .all ()
7
7
8
+ print ('-' * 90 )
9
+ print ('| {:{width}} | {:{width}} | {:{width}} | {:{width}} | {:{width}} | {:{width}} | {:{width}} |' .format (
10
+ 'instance_id' ,
11
+ 'instance_state' ,
12
+ 'key_name' ,
13
+ 'public_ip' ,
14
+ 'private_ip' ,
15
+ 'instance_type' ,
16
+ 'security_group' ,
17
+ width = '9' ))
18
+ print ('-' * 90 )
19
+
8
20
for eachinstance in instance_iterator :
9
- print (eachinstance .id ,
10
- eachinstance .state ['Name' ],
11
- eachinstance .key_name ,
12
- eachinstance .public_ip_address ,
13
- eachinstance .private_ip_address ,
14
- eachinstance .instance_type ,
15
- eachinstance .security_groups [0 ]['GroupName' ],
21
+ print ("|" , eachinstance .id ,
22
+ "|" , eachinstance .state ['Name' ],
23
+ "|" , eachinstance .key_name , " \t " ,
24
+ "|" , eachinstance .public_ip_address ,
25
+ "|" , eachinstance .private_ip_address ,
26
+ "|" , eachinstance .instance_type ,
27
+ "|" , eachinstance .security_groups [0 ]['GroupName' ], "|" ,
16
28
)
17
29
18
30
You can’t perform that action at this time.
0 commit comments