Amazon Elastic MapReduce
Developer Guide (API Version 2009-03-31)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

Using the AWS SDK for .Net to Create an Amazon EMR Cluster

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.


If you are adding IAM user visibility to a new cluster, call RunJobFlow and set VisibleToAllUsers=true, otherwise IAM users cannot view the cluster.

            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);