| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The following example illustrates how the SDKs can simplify programming with Amazon EMR
The code sample below uses the StepFactory object, a helper class for creating common Amazon EMR step types, to create
an interactive Hive cluster with debugging enabled.
var emrClient =AWSClientFactory.CreateAmazonElasticMapReduceClient(RegionEndpoint.USWest2);
var stepFactory = new StepFactory();
var enabledebugging = new StepConfig{
Name = "Enable debugging",
ActionOnFailure = "TERMINATE_JOB_FLOW",
HadoopJarStep = stepFactory.NewEnabledebuggingStep()
};
var installHive = new StepConfig{
Name = "Install Hive",
ActionOnFailure = "TERMINATE_JOB_FLOW",
HadoopJarStep = stepFactory.NewInstallHiveStep()
};
var instanceConfig = new JobFlowInstancesConfig{
Ec2KeyName = "keypair",
HadoopVersion = "0.20",
InstanceCount = 5,
KeepJobFlowAliveWhenNoSteps = true,
MasterInstanceType = "m1.small",
SlaveInstanceType = "m1.small"
};
var request = new RunJobFlowRequest{
Name = "Hive Interactive",
Steps = {enabledebugging, installHive},
LogUri = "s3://myawsbucket",
Instances = instanceConfig
};
var result = emrClient.RunJobFlow(request);