Tencent-SCF - Deploying
The Serverless Framework was designed to provision your Serverless Cloud Functions, Events and infrastructure Resources safely and quickly. It does this via a couple of methods designed for different types of deployments.
Deploy All
This is the main method for doing deployments with the Serverless Framework:
serverless deploy
Use this method when you have updated your Function, Event or Resource configuration in serverless.yml
and you want to deploy that change (or multiple changes at the same time) to Tencent Cloud.
Note: You can always enforce a deployment using the --force
option, or specify a different configuration file name with the the --config
option.
Tips
-
Use this in your CI/CD systems, as it is the safest method of deployment.
-
You can print the progress during the deployment if you use
verbose
mode, like this: serverless deploy --verbose -
This method defaults to
dev
stage andap-guangzhou
region. You can change the default stage and region in yourserverless.yml
file by setting thestage
andregion
properties inside aprovider
object as the following example shows:# serverless.yml service: service-name provider: name: tencent stage: production region: ap-beijing
-
You can also deploy to different stages and regions by passing in flags to the command:
serverless deploy --stage production --region ap-beijing
-
You can specify your own COS bucket which should be used to store all the deployment artifacts. The
cosBucket
config which is nested underprovider
lets you e.g. set thename
for this bucket. If you don't provide your own bucket, Serverless will create a bucket which by default.
Deploy Function
This deployment method simply overwrites the zip file of the current function on Tencent Cloud.
serverless deploy function --function myFunction
Tips
- Use this when you are developing and want to test because it's much faster.
- During development, people will often run this command several times, as opposed to
serverless deploy
which is only run when larger infrastructure provisioning is required.
Check out the deploy command docs for all details and options.