tencent cloud

Feedback

.yml File Specification

Last updated: 2021-03-05 15:26:29

    Serverless Framework uses the project configuration file serverless.yml to identify the application type and configure the resources. After you develop a project locally, you must configure the .yml file first before you can deploy the project in the cloud by running the sls deploy command to pass the configuration information in serverless.yml and the specified parameters or code directory in inputs to the Serverless Components deployment engine.

    Basic Information

    The first-level field in a basic serverless.yml file is configured as follows:

    # Organization information (optional)
    app: '' # Application name. If it is left empty, the instance name of the current component will be used by default
    stage: '' # Environment name. The default value is `dev`. We recommend you use the `${env.STAGE}` variable to define the environment name
    
    # Component information
    component: scf # Component name, which is required. It is `scf` in this example
    name: scfdemo # Component instance name, which is required
    
    # Component parameter configuration, which configures specific resource information for each component
    inputs:
    

    Detailed Configuration

    In the inputs field, the corresponding information will be configured for the resources created by each component in the cloud. The SCF Component is taken as an example here. The second-level directory in the input field is as follows:

    inputs:
      name: xxx # Function name, which is `${name}-${stage}-${app}` by default
      src: ./src # Project code path in the default format. Create a specifically named COS bucket and upload it
      handler: index.main_handler # Entry
      runtime: Nodejs10.15 # Runtime environment, which is Nodejs10.15 by default
      region: ap-guangzhou # Function region
      description: This is a function in ${app} application.
      environment: # Environment variable
        variables: # Environment variable object
          TEST: value
      layers: # Layer configuration
        - name: scfLayer # Layer name
          version: 1 # Version
      events: # Trigger configuration
        - timer: # Scheduled trigger
            parameters:
              cronExpression: '*/5 * * * * * *' # Trigger once every 5 seconds
              enable: true

    Full Configuration List

    Below is the list of full configuration information for each component of Serverless Framework:

    Basic components

    Framework components

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support