This commit is contained in:
carnal0wnage
2018-04-07 19:37:29 -04:00
parent 5de3e23dc4
commit 7c368b9a62
3 changed files with 23 additions and 18 deletions

View File

@@ -1,11 +0,0 @@
'''
This file is used to perform some ElasticBeanstalk actions
'''
from libs.elasticbeanstalk import *
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
#describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
#describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
#describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)

View File

@@ -4,14 +4,16 @@ EMR functions
import boto3 import boto3
import botocore import botocore
import os
import pprint import pprint
import sys,os import sys
pp = pprint.PrettyPrinter(indent=5, width=80) pp = pprint.PrettyPrinter(indent=5, width=80)
#from http://docs.aws.amazon.com/general/latest/gr/rande.html # from http://docs.aws.amazon.com/general/latest/gr/rande.html
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ] regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
def list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY): def list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
print("### Printing EMR Clusters ###") print("### Printing EMR Clusters ###")
try: try:
@@ -20,7 +22,7 @@ def list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
response = client.list_clusters() response = client.list_clusters()
#print response # print response
if response.get('Clusters') is None: if response.get('Clusters') is None:
print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID)) print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID))
@@ -42,6 +44,7 @@ def list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
except KeyboardInterrupt: except KeyboardInterrupt:
print("CTRL-C received, exiting...") print("CTRL-C received, exiting...")
def list_security_configurations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY): def list_security_configurations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
print("### Printing EMR Security Configuration ###") print("### Printing EMR Security Configuration ###")
try: try:
@@ -50,7 +53,7 @@ def list_security_configurations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
response = client.list_security_configurations() response = client.list_security_configurations()
#print response # print response
if response.get('SecurityConfigurations') is None: if response.get('SecurityConfigurations') is None:
print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID)) print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID))

13
modules/emr.py Normal file
View File

@@ -0,0 +1,13 @@
'''
This file is used to perform some EMR actions
'''
from libs.emr import *
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
def step_emr_list_clusters():
list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
def step_emr_list_security_configurations():
list_security_configurations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)