Code Monkey home page Code Monkey logo

temporal-proto2json-lambda's Introduction

Temporal Proto to JSON Lambda

An AWS Lambda function for converting Temporal Workflow History exports from protobuf to JSON.

Prerequisites

  • 2x S3 buckets
    • One bucket configured to receive Workflow Histories from Temporal (protobuf). To test the Lambda function, this should already have at least one exported workflow history.
    • The other is the target for this function; it's where the converted JSON will be sent.
  • An IAM role that Lambda can assume when running your function. This role needs the following policy;
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "logs:CreateLogStream",
                "logs:CreateLogGroup",
                "logs:PutLogEvents"
            ],
            "Resource": [
                "arn:aws:s3:::REPLACE_WITH_SOURCE_BUCKET/*",
                "arn:aws:logs:*:*:*"
            ]
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::REPLACE_WITH_TARGET_BUCKET/*"
        }
    ]
}

Lambda Configuration

  • Runtime: Python 3.x
  • Architecture: arm64
  • Execution Role: Use the role that has the policy from the prereqs attached.

Once the function is created;

  • Add an S3 trigger
    • The bucket will be your SOURCE bucket
    • Prefix: temporal-workflow-history/
  • Add an environment variable specifying the target bucket. NOTE: just use the bucket name, don't prefix it with s3://.
    • S3_TARGET_BUCKET - 'bucket_name'

Package the function and upload it to Lambda

  • Create lambda_funciton.zip;
chmod +x create_zip.sh
./create_zip.sh
  • In the code tab in Lambda, select Upload from > .zip file and upload the zip.
  • To test, select the s3-put template on the test tab in Lambda. Modify s3:bucket:name and s3:object:key so that they use the real location of a workflow history export proto in your source bucket.

TODO

  • Turn this into a CF/TF script

temporal-proto2json-lambda's People

Contributors

brendan-myers avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.