尝试使用AmazonElasticMapReduce运行作业流程时出错

问题描述 投票:0回答:1

我正在尝试使用AmazonElasticMapReduce运行作业流程,并且收到以下错误:

Exception in thread "main" com.amazonaws.services.elasticmapreduce.model.AmazonElasticMapReduceException:
The supplied ami version is invalid.
(Service: AmazonElasticMapReduce; Status Code: 400; Error Code: ValidationException; Request ID:
9e5d5d67-cc98-4002-989e-a0df55517d62)

这是我的代码:

 public static void main(String[] args) throws Exception {
        AmazonElasticMapReduce mapReduce = new AmazonElasticMapReduceClient();
        HadoopJarStepConfig hadoopJarStep = new HadoopJarStepConfig()
                .withJar("s3n://bucket/jar")
                .withMainClass("some.pack.MainClass")
                .withArgs("s3n://bucket/input/", "s3n://bucket/output/");

        StepConfig stepConfig = new StepConfig()
                .withName("stepname")
                .withHadoopJarStep(hadoopJarStep)
                .withActionOnFailure("TERMINATE_JOB_FLOW");

        JobFlowInstancesConfig instances = new JobFlowInstancesConfig()
                .withInstanceCount(2)
                .withMasterInstanceType(InstanceType.M1_SMALL.toString())
                .withSlaveInstanceType(InstanceType.M1_SMALL.toString())
                .withHadoopVersion("2.6.0").withEc2KeyName("mykey")
                .withKeepJobFlowAliveWhenNoSteps(false)
                .withPlacement(new PlacementType("us-east-1a"));

        RunJobFlowRequest runFlowRequest = new RunJobFlowRequest()
                .withName("jobname")
                .withInstances(instances)
                .withSteps(stepConfig)
                .withLogUri("s3n://bucket/logs/");
        runFlowRequest.setServiceRole("EMR_DefaultRole");
        runFlowRequest.setJobFlowRole("EMR_EC2_DefaultRole");

        RunJobFlowResult runJobFlowResult = mapReduce.runJobFlow(runFlowRequest);
        String jobFlowId = runJobFlowResult.getJobFlowId();
        System.out.println("Ran job flow with id: " + jobFlowId);
    }

我尝试将.withAmiVersion()添加到具有不同AMI版本的RunJobFlowRequest,但这没有帮助。

amazon-web-services amazon-emr amazon-ami
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.