title: Failure to launch AWS-EMR cluster in Frankfurt, but successful in N. Virginia
body: <p>I'm trying to launch a small EMR cluster via the Java SDK for AWS. I'm trying, and failing miserably, to launch it in Frankfurt (eu-central-1), but successful when launching it in N. Virginia (us-east-1).</p>
  
  <p>My configuration:</p>
  
  <ul>
  <li>macOS 10.12.1</li>
  <li>Java 1.8.102</li>
  <li>AWS SDK for Java 1.11.60</li>
  <li>Hadoop 2.7.3</li>
  <li>IntelliJ 2016.2.4</li>
  </ul>
  
  <p>I have already verified the following:</p>
  
  <ol>
  <li>The Instance Type that I'm requesting (<code>M1Medium</code>) exists in both regions.</li>
  <li>The Hadoop version I'm requesting for the cluster (2.7.3) is the one that exists in the EMR version (5.2.0).</li>
  <li>I have the appropriate <code>IAM Roles</code> to support the clusters (the default ones - <code>EMR_EC2_DefaultRole</code> &amp; <code>EMR_DefaultRole</code>), and they obviously work correctly because they are used to launch the cluster in N. Virginia.</li>
  <li>I have EC2 key pairs for both regions.</li>
  <li>I have validated that EMR is available as a service in both regions.</li>
  <li>I have validated that I'm using the correct availability zones for both regions, and that these zones are healthy, via the EC2 dashboard through my web browser.</li>
  <li>For each cluster attempt, I'm using an S3 bucket at the same region for input, output and EMR logs.</li>
  </ol>
  
  <p>This is the code to launch a cluster in Frankfurt:</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      parseArgs(args);
  
      if (environment.equals("local")) {
          // Local machine, single node setup. Used in order to debug the M-R logic.
          String[] p1args = {"input", "output", environment};
          Phase1.main(p1args);
      } else {
          // EMR setup. This is the main intent of this app.
          AWSCredentials credentials = null;
          try {
              credentials = new ProfileCredentialsProvider().getCredentials();
          } catch (Exception e) {
              throw new AmazonClientException(
                      "Cannot load the credentials from the credential profiles file. " +
                              "Please make sure that your credentials file is at the correct " +
                              "location (~/.aws/credentials), and is in valid format.",
                      e);
          }
  
          AmazonElasticMapReduce mapReduce = new AmazonElasticMapReduceClient(credentials);
  
          HadoopJarStepConfig jarStep1 = new HadoopJarStepConfig()
                  .withJar("s3n://skill-finder-eu-central-1/jars/SkillFinder.jar")
                  .withMainClass("Phase1")
                  .withArgs("s3n://skill-finder-eu-central-1/input-10K", "s3n://skill-finder-eu-central-1/output-eu-central-1", environment);
  
          StepConfig step1Config = new StepConfig()
                  .withName("Phase 1")
                  .withHadoopJarStep(jarStep1)
                  .withActionOnFailure("TERMINATE_JOB_FLOW");
  
          JobFlowInstancesConfig instances = new JobFlowInstancesConfig()
                  .withInstanceCount(5)
                  .withMasterInstanceType(InstanceType.M1Medium.toString())
                  .withSlaveInstanceType(InstanceType.M1Medium.toString())
                  .withHadoopVersion("2.7.3")
                  .withEc2KeyName("AWS-EU-CENTRAL-1")
                  .withKeepJobFlowAliveWhenNoSteps(false)
                  .withPlacement(new PlacementType("eu-central-1a"));
  
          RunJobFlowRequest runFlowRequest = new RunJobFlowRequest()
                  .withName("skill-finder")
                  .withInstances(instances)
                  .withSteps(step1Config)
                  .withJobFlowRole("EMR_EC2_DefaultRole")
                  .withServiceRole("EMR_DefaultRole")
                  .withReleaseLabel("emr-5.2.0")
                  .withLogUri("s3n://skill-finder-eu-central-1/logs/")
                  .withBootstrapActions();
  
          System.out.println("Submitting the JobFlow Request to Amazon EMR and running it...");
          RunJobFlowResult runJobFlowResult = mapReduce.runJobFlow(runFlowRequest);
          String jobFlowId = runJobFlowResult.getJobFlowId();
          System.out.println("Ran job flow with id: " + jobFlowId);
      }
  
  }
  </code></pre>
  
  <p>When launching in N. Virginia, I just replace <code>eu-central-1</code> with <code>us-east-1</code>.</p>
  
  <p>This is the exception:</p>
  
  <pre><code>Exception in thread "main" com.amazonaws.services.elasticmapreduce.model.AmazonElasticMapReduceException: Specified Availability Zone is not supported. (Service: AmazonElasticMapReduce; Status Code: 400; Error Code: ValidationException; Request ID: 578db9ad-b3bf-11e6-9a57-5179acb16d3f)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1545)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1183)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:964)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:676)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:650)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:633)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$300(AmazonHttpClient.java:601)
  at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:583)
  at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:447)
  at com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient.doInvoke(AmazonElasticMapReduceClient.java:1469)
  at com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient.invoke(AmazonElasticMapReduceClient.java:1445)
  at com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient.runJobFlow(AmazonElasticMapReduceClient.java:1255)
  at MRTaskLauncher.main(MRTaskLauncher.java:97)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
  </code></pre>