Skip to content

Instantly share code, notes, and snippets.

@dedunumax
Last active April 27, 2016 19:18
Show Gist options
  • Save dedunumax/b7a0f54d2535f74e7542 to your computer and use it in GitHub Desktop.
Save dedunumax/b7a0f54d2535f74e7542 to your computer and use it in GitHub Desktop.
import boto.emr
import boto.exception
from boto.emr.instance_group import InstanceGroup
__author__ = 'dedunu'
connection = boto.emr.connect_to_region(
region_name='us-east-1',
aws_access_key_id='<Your AWS Access Key>',
aws_secret_access_key='<You AWS Secred Key>',
)
api_params = {
'Instances.Ec2SubnetId': '<Your Subnet ID>',
'ReleaseLabel': 'emr-4.2.0',
}
instance_groups = list()
instance_groups.append(InstanceGroup(
num_instances=1,
role="MASTER",
type='m1.large',
market="ON_DEMAND",
name="Master nodes"))
instance_groups.append(InstanceGroup(
num_instances=1,
role="CORE",
type='m1.large',
market="ON_DEMAND",
name="Slave nodes"))
cluster_id = connection.run_jobflow(
name='test_emr_job_with_release_label',
# availability_zone='us-east-1a',
instance_groups=instance_groups,
# ami_version='3.0.0',
enable_debugging=False,
visible_to_all_users=True,
keep_alive=True,
job_flow_role="EMR_EC2_DefaultRole",
service_role="EMR_DefaultRole",
api_params=api_params,
)
print (cluster_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment