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 your users and/or near an external DB.
Our Enterprise plan offers full access to this feature while our Team plan provides a more limited version. Please contact support@modal.com to get 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 function():
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-ashburn-1" OCI Virginia
--------------------------------------------------------------
"us-central" "us-central1" GCP Iowa
"us-chicago-1" OCI Chicago
--------------------------------------------------------------
"us-west" "us-west-1" AWS California
"us-west-2" AWS Oregon
"us-west1" GCP Oregon
"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-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
"ap-northeast-1" AWS Tokyo
"ap-northeast-3" AWS Osaka
--------------------------------------------------------------
"ap-southeast" "asia-southeast1" GCP Singapore
"ap-southeast-3" OCI Singapore
--------------------------------------------------------------
"ap-melbourne" "ap-melbourne-1" OCI Melbourne
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
--------------------------------------------------------------
"me" "me-west1" OCI Bahrain
--------------------------------------------------------------
"sa" "sa-east-1" AWS São Paulo
Regions 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"]
.
If you need more fine-grained region selection, higher concurrency limits, or to use region selection for GPU functions, please contact support@modal.com.