Updated on 2023-11-22 GMT+08:00

Create

Creates a new service in the current working directory based on the specified template.

  • Create a service in the current working directory:
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs
  • Create a service in a new folder using a custom template:
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --path my-service

Options

  • --template-url or -u: A URL pointing to a remotely hosted template. Required if --template and --template-path are not present.
  • --template-path: The local path of your template. Required if --template and --template-url are not present.
  • --path or -p: The path where the service is created.
  • --name or -n: The name of the service in serverless.yml.

Examples

  • Create a new service
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --name my-special-service

    This example generates a Node.js runtime in the current working directory for the service with Huawei as the provider.

  • Create a named service in a (new) directory
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --path my-new-service

    This example will generate a Node.js runtime in the my-new-service directory for the service with Huawei as the provider. This directory will be automatically created if it does not exist. Otherwise Serverless will use the already present directory.

    Additionally, Serverless will rename the service according to the path you provide. In this example, the service will be renamed to my-new-service.