Sync commands

The sync commands are used to synchronize online resources to an on-premises machine.

Command description

You can run the sync -h or sync --help command to obtain the help document.

Parameter description

ParameterAbbreviationRequired in YAML modeRequired in CLI modeDescription
region-NoNoThe name of the region. Valid values: cn-hangzhou, cn-beijing, cn-beijing, cn-hangzhou, cn-shanghai, cn-qingdao, cn-zhangjiakou, cn-huhehaote, cn-shenzhen, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1
service-name-NoYesThe name of the service.
function-name-NoNoThe name of the function.
trigger-name-NoNoThe name of the trigger.
target-dir-NoNoThe destination directory.
type-NoNoThe type of the synchronization. You can synchronize code and configurations. By default, both code and configurations are synchronized. Valid values: code and config

The current command also supports some global parameters (such as -a/--access, --debug, etc.). For details, please refer to Serverless Devs global parameters document

Examples

  • If a resource description file (YAML) is available, you can run the s sync command to synchronize online resources to a local machine.
  • In the CLI mode (no YAML), you must specify the names of the service and function. For example, s cli fc sync --region cn-hanghzou --service-name fc-deploy-service --function-name http-trigger-py36.

Example output:

fc-deploy-test: 
  codeFiles:  
    http-trigger-py36: /Users/jiangyu/demo/test/start-fc-http-python3/1583208943291465_cn-hangzhou_fc-deploy_service_http-trigger-py36
  configYmlPath: /Users/jiangyu/demo/test/start-fc-http-python3/s.cn-hangzhou-fc-deploy-service.sync.yaml

Permissions and policies

We recommend that you use the AliyunFCReadOnlyAccess policy when you use this command.

Edit this page on GitHub Updated at Wed, Sep 21, 2022