Region selection

Modal allows you to specify which cloud region you would like to run a Function in. This may be useful if:

  • you are required (for regulatory reasons or by your customers) to process data within certain regions.
  • you want to reduce egress fees that result from reading data from a dependency like S3.
  • you have a latency-sensitive app where app endpoints need to run near an external DB.

Note that regardless of what region your Function runs in, all Function inputs and outputs go through Modal’s control plane in us-east-1.

Our Enterprise plan offers full access to this feature while our Team plan provides a more limited version. Please contact sales@modal.com if you need full access.

Specifying a region

To run your Modal Function in a specific region, pass a region= argument to the function decorator.

import os
import modal

app = modal.App("...")

@app.function(region="us-east") # also supports a list of options, for example region=["us-central", "us-east"]
def f():
    print(f"running in {os.environ['MODAL_REGION']}") # us-east-1, us-east-2, us-ashburn-1, etc.

You can specify a region in addition to the underlying cloud, @app.function(cloud="aws", region="us-east") would run your Function only in "us-east-1" or "us-east-2" for instance.

Region options

Modal offers varying levels of granularity for regions. Use broader regions when possible, as this increases the pool of available resources your Function can be assigned to, which improves cold-start time and availability.

United States (“us”)

Use region="us" to select any region in the United States.

     Broad            Specific             Description
 ==============================================================
  "us-east"           "us-east-1"          AWS Virginia
                      "us-east-2"          AWS Ohio
                      "us-east1"           GCP South Carolina
                      "us-east4"           GCP Virginia
                      "us-east5"           GCP Ohio
                      "us-ashburn-1"       OCI Virginia
 --------------------------------------------------------------
  "us-central"        "us-central1"        GCP Iowa
                      "us-chicago-1"       OCI Chicago
                      "us-phoenix-1"       OCI Phoenix
 --------------------------------------------------------------
  "us-west"           "us-west-1"          AWS California
                      "us-west-2"          AWS Oregon
                      "us-west1"           GCP Oregon
                      "us-west3"           GCP Utah
                      "us-west4"           GCP Nevada
                      "us-sanjose-1"       OCI San Jose

Europe (“eu”)

Use region="eu" to select any region in Europe.

     Broad            Specific             Description
 ==============================================================
  "eu-west"           "eu-central-1"       AWS Frankfurt
                      "eu-west-1"          AWS Ireland
                      "eu-west-2"          AWS London
                      "eu-west-3"          AWS Paris
                      "europe-west1"       GCP Belgium
                      "europe-west2"       GCP London
                      "europe-west3"       GCP Frankfurt
                      "europe-west4"       GCP Netherlands
                      "eu-frankfurt-1"     OCI Frankfurt
                      "eu-paris-1"         OCI Paris
                      "uk-london-1"        OCI London
 --------------------------------------------------------------
  "eu-north"          "eu-north-1"         AWS Stockholm

Asia–Pacific (“ap”)

Use region="ap" to select any region in Asia–Pacific.

     Broad            Specific             Description
 ==============================================================
  "ap-northeast"      "asia-northeast3"    GCP Seoul
                      "asia-northeast1"    GCP Tokyo
                      "ap-northeast-1"     AWS Tokyo
                      "ap-northeast-3"     AWS Osaka
 --------------------------------------------------------------
  "ap-southeast"      "asia-southeast1"    GCP Singapore
                      "ap-southeast-3"     AWS Jakarta
 --------------------------------------------------------------
  "ap-south"          "ap-south-1"         AWS Mumbai

Other regions

     Broad            Specific             Description
 ==============================================================
  "ca"                "ca-central-1"       AWS Montreal
                      "ca-toronto-1"       OCI Toronto
 --------------------------------------------------------------
  "jp"                "ap-northeast-1"     AWS Tokyo
                      "ap-northeast-3"     AWS Osaka
                      "asia-northeast1"    GCP Tokyo
 --------------------------------------------------------------
  "me"                "me-west1"           GCP Tel Aviv
 --------------------------------------------------------------
  "sa"                "sa-east-1"          AWS São Paulo

Region selection under the Team plan

Under the Team plan, you can specify any of the following broad regions for CPU-only Functions with concurrency limits: ["us", "us-east", "us-west", "eu"].

import os
import modal

app = modal.App("...")

@app.function(region="eu", concurrency_limit=5) # also supports a list of options, for example region=["eu", "us-west"]
def f():
    print(f"running in {os.environ['MODAL_REGION']}") # eu-west-1, eu-west-2, etc.

If you need more fine-grained region selection, higher concurrency limits, or to use region selection for GPU Functions, please contact support@modal.com.