AWS services fail with No region provided error

AWS services fail with a Java "No region provided" error in Databricks Runtime 7.0 and above.

Written by arjun.kaimaparambilrajan

Last published at: September 19th, 2023


Your code snippets that use AWS services fail with a java.lang.IllegalArgumentException: No region provided error in Databricks Runtime 7.0 and above. The same code worked in Databricks Runtime 6.6 and below.

You can verify the issue by running the example code snippet in a notebook. In Databricks Runtime 7.0 and above, it will return the exception shown in the example error message.

Example code snippet (Scala):

import com.amazonaws.regions.Regions
import com.amazonaws.regions.Regions

 val sts: AWSSecurityTokenService = AWSSecurityTokenServiceClientBuilder.standard()

Example error message:

java.lang.IllegalArgumentException: No region provided
        at com.amazonaws.AmazonWebServiceClient.setRegion(
        at com.amazonaws.client.builder.AwsClientBuilder.setRegion(
        at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(


There was a change in the AWS Java SDK version 1.11.655 which causes this issue in Databricks Runtime 7.0 and above.


You must set the sts_regional_endpoints value to regional on the cluster. This ensures that the AWS STS endpoint for the currently configured region is used.

  1. Open the Clusters page.
  2. Select a cluster.
  3. Click Edit.
  4. Click Advanced Options.
  5. Click Spark.
  6. In the Environment Variables field, enter AWS_STS_REGIONAL_ENDPOINTS="regional".
  7. Save the change and start, or restart, the cluster.

Was this article helpful?