Speed Up Your Alexa Skill Deployment to Lambda
Using ASK CLI
If you’re using ASK CLI, you’re using
$ ask deploy to get your code up on Lambda. Using that command every time, though, will significantly increase your time waiting for deployment. The deploy command doesn’t just deploy the code to Lambda, but also sends changes to the skill and the interaction model. If you’ve only changed the fulfillment, skip the unnecessary steps and target just Lambda with the
$ ask deploy -t lambda.
node_modules directory size
The primary problem for skill deployment is the
node_modules directory. This directory rarely changes, but comes along for the ride on every deploy anyway. Reducing the size of this directory will have the biggest impact on your deployment time.
Two projects can help. The first is node-prune by TJ Holowaychuk. It removes unnecessary files from module directories, like README files. The modclean project takes this even further, adding directories to the cruft it removes. Directories including tests or examples are taken away, leaving you with a much smaller
node_modules directory to deploy.