Cloud Functions locations

Cloud Functions is regional, which means the infrastructure that runs your
Cloud Function is located in specific regions and is managed by Google to be
redundantly available across
all the zones within those regions.

When selecting what regions to run your functions in, your primary
considerations should be latency and availability. You can
generally select regions close to your users, but you
should also consider the location of the
other products and services
that your app uses. Using services across multiple regions can affect
your app's latency, as well as pricing.

Cloud Functions is available in the following regions:

us-central1 (Iowa)

us-east1 (South Carolina)

us-east4 (Northern Virginia)

europe-west1 (Belgium)

europe-west2 (London)

asia-east2 (Hong Kong)

asia-northeast1 (Tokyo)

Functions in a given region in a given project must have unique (case
insensitive) names, but functions across regions or across projects may share
the same name.

Best practices for changing region

By default, functions run in the us-central1 region. Note that this may be
different from the region of an event source, such as a Storage bucket. If
you need to change the region where a function runs, follow the
recommendations in this section for each function trigger type.

To set the region where a function runs, set the region parameter in the
function definition as shown:

You can specify multiple regions by passing multiple comma-separated region
strings in functions.region(). See
change a function's region
for more information on recommended procedures.

HTTP and client-callable functions

For HTTP and callable functions, we recommend that you first set your function to the
destination region, or closest to where most expected customers are located, and
then alter your original function to redirect its HTTP request to the new
function (they can have the same name). If clients of your HTTP function support
redirects, you can simply change your original function to return an HTTP
redirect status (301) along with the URL of your new function. If your clients
do not handle redirects well, you can proxy the request from the original
function to the new function by initiating a new request from the original
function to the new function. The final step is to ensure that all clients are
calling the new function.

Client-side location selection for callable functions

Regarding the callable function, client callable setups should follow the same
guidelines as HTTP functions. The client can also specify a region, and
must do so if the function runs in any region other than us-central1.

To set
regions on the client, specify the desired region at initialization:

Unity

Background functions

Background functions adopt an at-least-once event delivery semantic, which means
that under some circumstances they may receive duplicate events. So, you should
implement functions to be
idempotent. If your function
is already idempotent, then you can redeploy the function in the new region with
the same event trigger and remove the old function after you verify that the
new function is correctly receiving traffic. During this transition, both
functions will receive events. See
change a function's region
for the recommended sequence of commands to change regions for functions.

If your function is not currently idempotent, or its idempotency does not
extend beyond the region, then we recommend that you first implement
idempotency before moving the function.

If you are interacting with a Realtime Database instance, a Cloud Firestore
instance, or a Storage bucket inside of the function, then the recommended
region is the same as if you had a function triggered by one of those
resources. Otherwise, use the default region of us-central1.
Note also that functions connected to Firebase Hosting must be
located in us-central1.

Selecting regions based on Cloud Firestore and Storage locations

The available regions for functions do not match precisely with the regions
available for your Cloud Firestore database and your Cloud Storage buckets.

Note that if your function and your resource (database instance or Storage
bucket) are in different locations, then you could potentially experience
increased latency and
billing costs.

Here's a mapping of the closest functions-supported regions for Cloud Firestore
and Cloud Storage: