Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Deploying with the Serverless Toolkit

This is a Twilio Labs project

This means this project is 100% open-source. You can find its source code in the Twilio Labs GitHub organization.

We currently don't support the projects through our official support channels. But you are welcome to reach out to us on GitHub for any questions, issues or suggestions or to contribute to this project.

Learn more about Twilio Labs.

There are two ways you can use the toolkit. If you are already using the Twilio CLI, you can install it via a plugin. Alternatively, you can use the toolkit as a standalone using twilio-run via npm or another Node.js package manager.

Throughout the docs we'll reference the Twilio CLI commands.

Deploying new code

The Serverless Toolkit tries to make deploying as seamless and with as little configuration as possible. If you have a project set-up according to the Serverless project structure, all it takes to deploy is one short command.


        By default this will create a new environment for you with the following properties:

        • Domain Suffix: dev
        • Unique Name: dev-environment

        You can change the environment it deploys to by passing the domain suffix of the environment into the deploy command using the --environment flag. If an environment with that domain suffix already exists, it will deploy to that one, otherwise it will create a new one.


              If you don't pass any other options in, the Functions and Assets that are being deployed will be chosen based on your project structure. If you use a non-default folder name for the deployment of Assets or Functions, you can pass in the --assets-folder or --functions-folder flags to change them. Alternatively you can use the --no-assets and --no-functions flags to turn these features of completely.


                    Additionally any variables except ACCOUNT_SID and AUTH_TOKEN will be uploaded as part of your deployment. To change the variables that are being uploaded use the --env flag to point against another .env file.


                          There's a lot more configuration you can do for your deployment. The best way you can find out about the various options is using the --help flag. It will list all options you have available.

                          Replicating an existing deployment

                          Aside of deploying code to an environment by uploading everything again, you can take an existing deployment and activate it on another environment using the promote command. For example to move the same build from the dev environment to an environment with the domain suffix staging you can use the activate command.


                                What's next?

                                Now that you learned how you can deploy your Twilio Functions, why not learn more, like how you can locally develop and debug your Functions.

                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.