Skip to content

Instantly share code, notes, and snippets.

@dedunumax
Created March 2, 2016 19:47
Show Gist options
  • Save dedunumax/5491fa5430427626ef47 to your computer and use it in GitHub Desktop.
Save dedunumax/5491fa5430427626ef47 to your computer and use it in GitHub Desktop.
import boto3
__author__ = 'dedunu'
connection = boto3.client(
'emr',
region_name='us-west-1',
aws_access_key_id='<Your AWS Access Key>',
aws_secret_access_key='<You AWS Secred Key>',
)
cluster_id = connection.run_job_flow(
Name='test_emr_job_with_boto3',
LogUri='s3://<your s3 location>',
ReleaseLabel='emr-4.2.0',
Instances={
'InstanceGroups': [
{
'Name': "Master nodes",
'Market': 'ON_DEMAND',
'InstanceRole': 'MASTER',
'InstanceType': 'm1.large',
'InstanceCount': 1,
},
{
'Name': "Slave nodes",
'Market': 'ON_DEMAND',
'InstanceRole': 'CORE',
'InstanceType': 'm1.large',
'InstanceCount': 2,
}
],
'Ec2KeyName': '<Ec2 Keyname>',
'KeepJobFlowAliveWhenNoSteps': True,
'TerminationProtected': False,
'Ec2SubnetId': '<Your Subnet ID>',
},
Steps=[],
VisibleToAllUsers=True,
JobFlowRole='EMR_EC2_DefaultRole',
ServiceRole='EMR_DefaultRole',
Tags=[
{
'Key': 'tag_name_1',
'Value': 'tab_value_1',
},
{
'Key': 'tag_name_2',
'Value': 'tag_value_2',
},
],
)
print (cluster_id['JobFlowId'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment