-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_cluster.py
More file actions
43 lines (41 loc) · 1.29 KB
/
create_cluster.py
File metadata and controls
43 lines (41 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Creates EMR Cluster, be sure to update Ec2KeyName with your correct key
import boto3
import sys
consent = raw_input("This may cost you are you sure you want to run this (Y/N)\n")
if consent.startswith('y'):
emr = boto3.client('emr')
response = emr.run_job_flow(
Name='GHA',
ReleaseLabel="emr-5.5.0",
Instances={
'Ec2KeyName': sys.argv[1],
'KeepJobFlowAliveWhenNoSteps': True,
'TerminationProtected': False,
'InstanceGroups': [
{
'InstanceCount': 1,
'InstanceRole': 'MASTER',
'InstanceType': 'r3.xlarge',
'Name': 'Master'
},
{
'InstanceCount': 20,
'InstanceRole': 'CORE',
'Market': 'SPOT',
'BidPrice': '.5',
'InstanceType': 'i2.2xlarge',
'Name': 'Core',
},
],
},
JobFlowRole='EMR_EC2_DefaultRole',
ServiceRole='EMR_DefaultRole',
VisibleToAllUsers=True,
Applications=[
{'Name': 'Hadoop'},
{'Name': 'Hive'},
{'Name': 'Spark'},
])
print(response)
else:
print('Closing.')