Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (57 sloc) 2.85 KB


Preparing Environment

  1. Get the source code
git clone``
  1. Switch to the code directory
cd cfm-reslib
  1. Install requirements
pip install -r requirements.txt
  1. Create a virtual environment with all of the requirements
pipenv install

Run Tests

Unit tests can be executed using py.test or simply with:

pipenv run test


The building process creates a CloudFormation template that can be deployed and expose cfm-reslib to be imported by other CloudFormation stacks. This template uses Lambda and its source code needs to be uploaded to a bucket. The build script will create both a ZIP file and a template and will upload it to a given S3 bucket.

python $BUCKET

And just like when deploying the released versions of cfm-reslib, you can deploy this with aws CLI tool.

aws cloudformation create-stack --stack-name cfm-reslib --template-url$BUCKET/cfm-reslib-latest.template --capabilities CAPABILITY_IAM

Or when updating:

aws cloudformation update-stack --stack-name cfm-reslib --template-url$BUCKET/cfm-reslib-latest.template --capabilities CAPABILITY_IAM

Note that you won't be able to deploy multiple stacks of cfm-reslib in the same region because the exported name has to be unique across all stacks in a certain region.

Adding Custom Resources

There are two methods to implement a new custom resource. You will need to create a class for your resource in both.

  1. If the custom resource uses just one boto3 call to create, update and delete a resource, you can inherit from :class:`cfmreslib.boto.BotoResourceHandler`. Simply override all of the constants with the names of the methods that need to be called and you're done. Check out ElasticTranscoderPipeline for an example.
  2. If you need more control of the process, inherit from :class:`cfmreslib.base.CustomResourceHandler`. You will have to implement some methods that will be called for requests coming from CloudFormation. Check out Route53Certificate for an example.

Once you've added your custom resource, make sure to add it to ALL_RESOURCES at the end of


.. autoclass:: cfmreslib.base.CustomResourceHandler
   :member-order: bysource

.. autoclass:: cfmreslib.boto.BotoResourceHandler
   :member-order: bysource
You can’t perform that action at this time.