LocalStack Extensions
With LocalStack 1.0 we have introduced LocalStack Extensions that allow developers to extend and customize LocalStack. Both the feature and the API are currently experimental and may be subject to change.
Extensions are a LocalStack Pro feature. To use and install extensions, use the CLI to first log in to your account
Usage: localstack extensions [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
init Initialize the LocalStack extensions environment
install Install a LocalStack extension
uninstall Remove a LocalStack extension
To install an extension, specify the name of the pip dependency that contains the extension. For example, for the official Stripe extension, you can either use the package distributed on pypi:
Developing Extensions
LocalStack exposes a Python API for building extensions that can be found in the core codebase in .
The basic interface to implement is as follows:
A minimal example would look like this:
import logging
from localstack.extensions.api import Extension
LOG = logging.getLogger(__name__)
class ReadyAnnoucerExtension(Extension):
name = "my_ready_annoucer"
LOG.info("my plugin is laded and localstack is ready to roll!")
Package your Extension
You can either use Plux to discover the entrypoints from your code when building and publishing your distribution, or manually define them as in the example below.
A minimal setup.cfg
for the extension above could look like this:
The entry point group is the Plux namespace , and the entry point name is the plugin name my_ready_announcer
. The object reference points to the plugin class.