Home > database >  AWS Cloudwatch synthetics - how to install external dependencies for runnning canaries
AWS Cloudwatch synthetics - how to install external dependencies for runnning canaries

Time:01-01

I have a python selenium script that needs a third party library ('redis' package for instance). I would like to run this script as an AWS cloudwatch synthetic canary. But it fails because it does not have this library installed.

So far I did not find in the documentation, nor in the AWS UI console how to pip install dependencies before executing the canary. Is it even possible ?

CodePudding user response:

You can use external dependencies, but you must package them yourself into a single .zip file, along with the script itself.

Upload the .zip file to S3 and point Synthetics to it when you create the canary.

Synthetics is picky about the .zip package structure. Newer runtime versions are less strict, but the default folder structures are:

  • Python: python/my_canary_filename.py
  • Node.js: nodejs/node_modules/myCanaryFilename.js
  • Related