Specify a region for a function in serverless.yml

Hi :slight_smile:

In serverless.yml file, I can specify the stage and region for my functions by using provider.

provider:
  name: aws
  runtime: nodejs4.3
  stage: dev
  region: ap-northeast-1

I was wondering there is a way to assign the region and stage into each function. Like…

function:
    myUniqueFunction:
        handler: hander.js
        stage: v1
        region: ap-northeast-2

As a workaround, I compress the function files with deploy -n command and upload the zip file to the target region manually. If there is no way to handle this problem in severless.yml, is there better way to do this?

1 Like

Nope, region can’t be configured at a function level.

As this is not a common use case - most services will want to be in the same region if they have shared resources or just for administration purposes - I think your per-function deployment is a good work-around.

1 Like

Thank you! I agree that this is not a common requirement.