tencent cloud

All product documents
Serverless Application Center
.yml File Specification
Last updated: 2024-12-02 10:48:10
.yml File Specification
Last updated: 2024-12-02 10:48:10
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

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

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
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon