Skip to content

Commit a0e21c6

Browse files
Merge pull request #20 from leandrodamascena/developer
New release
2 parents 407069d + 36c3a79 commit a0e21c6

File tree

5 files changed

+392
-10
lines changed

5 files changed

+392
-10
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ Following services are integrated
2121
- MSK
2222
- NAT GATEWAY
2323
- INTERNET GATEWAY (IGW)
24+
- CLASSIC/NETWORK/APPLICATION LOAD BALANCING
25+
- ROUTE TABLE
26+
- SUBNET
27+
- NACL
28+
- SECURITY GROUP
29+
- VPC PEERING
30+
- VPC ENDPOINT
31+
- EKS
2432

2533
### News
2634

aws-network-discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
from commands.vpc import Vpc
3838

39-
__version__ = "0.5.0"
39+
__version__ = "0.6.0"
4040

4141
AVAILABLE_LANGUAGES = ['en_US','pt_BR']
4242

shared/awscommands.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from shared.common import *
22
from shared.internal.security import IAM, IAMPOLICY
3-
from shared.internal.network import VPC, IGW, NATGATEWAY
4-
from shared.internal.compute import LAMBDA, EC2
3+
from shared.internal.network import VPC, IGW, NATGATEWAY, ELB, ELBV2, ROUTETABLE, SUBNET, NACL, SG, VPCPEERING
4+
from shared.internal.network import VPCENDPOINT
5+
from shared.internal.compute import LAMBDA, EC2, EKS
56
from shared.internal.database import RDS, ELASTICACHE, DOCUMENTDB
67
from shared.internal.storage import EFS, S3POLICY
78
from shared.internal.analytics import ELASTICSEARCH, MSK
@@ -14,18 +15,44 @@ def __init__(self, vpc_options: VpcOptions):
1415
self.vpc_options = vpc_options
1516

1617
def run(self):
18+
19+
""" IAM and VPC validations """
1720
IAM(self.vpc_options).run()
1821
VPC(self.vpc_options).run()
19-
LAMBDA(self.vpc_options).run()
22+
23+
""" Compute resources """
2024
EC2(self.vpc_options).run()
25+
LAMBDA(self.vpc_options).run()
26+
EKS(self.vpc_options).run()
27+
28+
""" Database resources """
2129
RDS(self.vpc_options).run()
22-
EFS(self.vpc_options).run()
2330
ELASTICACHE(self.vpc_options).run()
24-
IAMPOLICY(self.vpc_options).run()
25-
S3POLICY(self.vpc_options).run()
26-
ELASTICSEARCH(self.vpc_options).run()
2731
DOCUMENTDB(self.vpc_options).run()
32+
33+
""" Application resources """
2834
SQSPOLICY(self.vpc_options).run()
35+
36+
""" Storage resources """
37+
EFS(self.vpc_options).run()
38+
S3POLICY(self.vpc_options).run()
39+
40+
""" Analytics resources """
41+
ELASTICSEARCH(self.vpc_options).run()
2942
MSK(self.vpc_options).run()
43+
44+
""" Security resources """
45+
IAMPOLICY(self.vpc_options).run()
46+
47+
""" Network resources """
3048
IGW(self.vpc_options).run()
3149
NATGATEWAY(self.vpc_options).run()
50+
ELB(self.vpc_options).run()
51+
ELBV2(self.vpc_options).run()
52+
ROUTETABLE(self.vpc_options).run()
53+
SUBNET(self.vpc_options).run()
54+
NACL(self.vpc_options).run()
55+
SG(self.vpc_options).run()
56+
VPCPEERING(self.vpc_options).run()
57+
VPCENDPOINT(self.vpc_options).run()
58+

shared/internal/compute.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,38 @@ def run(self):
6767
except Exception as e:
6868
message = "Can't list EC2 Instances\nError {0}".format(str(e))
6969
exit_critical(message)
70+
71+
class EKS(object):
72+
73+
def __init__(self, vpc_options: VpcOptions):
74+
self.vpc_options = vpc_options
75+
76+
def run(self):
77+
try:
78+
client = self.vpc_options.client('eks')
79+
80+
response = client.list_clusters()
81+
82+
message_handler("\nChecking EKS CLUSTERS...", "HEADER")
83+
84+
if len(response["clusters"]) == 0:
85+
message_handler("Found 0 EKS Clusters in region {0}".format(self.vpc_options.region_name), "OKBLUE")
86+
else:
87+
found = 0
88+
message = ""
89+
for data in response["clusters"]:
90+
91+
cluster = client.describe_cluster(name=data)
92+
93+
if cluster['cluster']['resourcesVpcConfig']['vpcId'] == self.vpc_options.vpc_id:
94+
found += 1
95+
message = message + "\ncluster: {} - VpcId {}".format(
96+
data,
97+
self.vpc_options.vpc_id
98+
)
99+
100+
message_handler("Found {0} EKS Clusters using VPC {1} {2}".format(str(found), self.vpc_options.vpc_id, message),'OKBLUE')
101+
102+
except Exception as e:
103+
message = "Can't list EKS Clusters\nError {0}".format(str(e))
104+
exit_critical(message)

0 commit comments

Comments
 (0)