Package: fabnodes
fabnodesfabnodesis a Python CLI application that creates prefabricated lambda nodes.
Using these 'node prefabs' one can create complicated distributed processes.RequirementsThe python requirements are stored in requirements.txt.fabnodescurrently usescfndslto generate CloudFormation
JSON files. The instructions to installcfndslis available through the
provided link.Basic setupInstall the requirements:$ pip install -r requirements.txtRun the application:$ python -m fabnodes --helpTo run the tests (todo):$ pytestPrefab: Basic NodeThe Basic Node (samples/basic_node/node.py) will create the most basic node
with the following features:NSQS inputs, whereNcan be 0 or greaterMSNS outputs, whereMcan be 0 or greater1 Lambda Function that triggers on any input, and can write to any outputBelow is a masterpiece that will attempt to illustrate:==========================================================================



                                    |----------- Basic Node ----------|

.. -> SNS(SomeNode.alpha) ----\                          /--> SNS(output) -> ..
                               ---> SQS(input) -> Lambda
.. -> SNS(random topic)    ---/                          \--> (something)



==========================================================================To create this node yourcwdneeds to be the same asnode.py:fabnodes create node.py --account-arn XXXXXXXXXXXXAt the moment the account-arn needs to be passed in because security.This will make the calls required to CloudFormation that will create the above
infrastructure.Use-cases:The basic node has the following use-cases:The Source Node: A node that reads from an input source (that isn't
another prefab node) that then can forward to many through a topic (0:Mnode)The Router: A node that takes an input and can 'farm' it out to
specifically made workers (other prefab nodes) through named topics (1:Mnode)The Worker: A node that listens on a topic, performs a specific task,
then creates output (1:1node)The Ingest: A node that listens to many topics, consumes data, and then
produces output for a non-prefab node (M:0node)The Sample: node.pyBelow is an explanation of the provided sample.@fablib.Distribution('jlh-dev-lambda-functions')
@fablib.Inputs([
    {'name': 'Router', 'source': 'snsRouterTopicId'}])
@fablib.Outputs([
    {'name': 'Alpha'}])
@fablib.Node('BasicNode', 'comRoaetFabnodeSample', 'Basic Node')
def lambda_handler(events, context):
    client = boto3.client('sns')
    sns_target_arn = os.environ['Alpha']
    body_content = json.dumps(events)
    response = client.publish(
        TargetArn=sns_target_arn,
        Message=json.dumps({'default': body_content}),
        MessageStructure='json'
    )
    print(response)Thelambda_handlermethod is defined exactly as a normal lambda handlerThe decorators:Distribution: defines the S3 bucket to put the code intoInputs(a list of dictionaries): creates an SQS trigger that is subscribed
to the defined SNS topicOutputs(a list of dictionaries): creates an SNS topic that can be
referenced in theos.environdictionaryNode: defines the name of the lambda function, the name of the stack, and
the description of the stackThe name of the stack can be used as a reference in other prefabs to
create the input/output connectionsReferencesfabnodesis a Python CLI application generated fromhttps://github.com/roaet/rorochip-cookies