Convert Figma logo to code with AI

jorgebastida logogordon

λ Gordon is a tool to create, wire and deploy AWS Lambdas using CloudFormation

2,045
137
2,045
67

Top Related Projects

⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.

10,636

Python Serverless Microframework for AWS

11,885

Serverless Python

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM

20,922

Pulumi - Infrastructure as Code in any programming language 🚀

Quick Overview

Gordon is an open-source tool designed to simplify the deployment and management of AWS Lambda functions using Python. It provides a streamlined way to create, package, and deploy serverless applications on AWS, offering a more intuitive and developer-friendly approach compared to traditional AWS Lambda management methods.

Pros

  • Simplifies the process of creating and deploying AWS Lambda functions
  • Supports multiple Python runtimes and versions
  • Integrates well with other AWS services like API Gateway and CloudFormation
  • Provides a CLI for easy management and deployment

Cons

  • Limited to Python-based Lambda functions
  • May have a learning curve for developers new to serverless architectures
  • Requires familiarity with AWS services and concepts
  • Less actively maintained compared to some other serverless frameworks

Code Examples

  1. Defining a simple Lambda function:
from gordon import gordon

@gordon.lambda_
def hello_world(event, context):
    return {
        'statusCode': 200,
        'body': 'Hello, World!'
    }
  1. Creating an API Gateway endpoint:
from gordon import gordon

@gordon.api.get('/hello')
def hello_api(event, context):
    return {
        'statusCode': 200,
        'body': 'Hello from API Gateway!'
    }
  1. Setting up a scheduled Lambda function:
from gordon import gordon

@gordon.cron('rate(1 hour)')
def scheduled_task(event, context):
    print("This function runs every hour")

Getting Started

  1. Install Gordon using pip:

    pip install gordon
    
  2. Create a new Gordon project:

    gordon startproject myproject
    cd myproject
    
  3. Define your Lambda functions in app.py:

    from gordon import gordon
    
    @gordon.lambda_
    def my_function(event, context):
        return "Hello from Gordon!"
    
  4. Deploy your project:

    gordon build
    gordon apply
    

Competitor Comparisons

⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.

Pros of Serverless

  • Larger community and ecosystem, with more plugins and integrations
  • Supports multiple cloud providers (AWS, Azure, Google Cloud, etc.)
  • More comprehensive documentation and tutorials

Cons of Serverless

  • Steeper learning curve due to more complex configuration
  • Can be overkill for simple projects or AWS-only deployments
  • Slower deployment times for large projects

Code Comparison

Gordon:

functions:
  hello:
    code: code/
    handler: handler.hello
    description: My first Lambda function

Serverless:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get

Gordon focuses on simplicity and AWS-specific deployments, while Serverless offers a more feature-rich and flexible approach. Gordon's configuration is typically more concise, making it easier for beginners or small projects. Serverless, on the other hand, provides more advanced features and cross-cloud support, but at the cost of increased complexity.

Both frameworks aim to simplify serverless deployments, but they cater to different use cases and preferences. Gordon is ideal for AWS-centric projects seeking simplicity, while Serverless is better suited for complex, multi-cloud deployments or those requiring extensive customization.

10,636

Python Serverless Microframework for AWS

Pros of Chalice

  • Official AWS project with active development and support
  • Tighter integration with AWS services and best practices
  • More comprehensive documentation and examples

Cons of Chalice

  • Limited to Python development only
  • Less flexibility in project structure and customization
  • Steeper learning curve for developers new to AWS

Code Comparison

Chalice:

from chalice import Chalice

app = Chalice(app_name='helloworld')

@app.route('/')
def index():
    return {'hello': 'world'}

Gordon:

- name: hello
  description: Hello World Function
  runtime: python3.6
  handler: handler.hello
  code: ./code

Gordon focuses on a YAML-based configuration approach, while Chalice uses a Python decorator-based style for defining Lambda functions and API routes. Chalice's approach may feel more familiar to Python developers, but Gordon's YAML configuration can be more concise for simple functions.

Both frameworks aim to simplify serverless development on AWS, but they take different approaches. Chalice offers a more opinionated, Python-centric solution with deeper AWS integration, while Gordon provides a more flexible, language-agnostic approach with support for multiple runtimes and services.

11,885

Serverless Python

Pros of Zappa

  • More active development and larger community support
  • Supports a wider range of AWS services and integrations
  • Offers more advanced features like custom domains and SSL certificates

Cons of Zappa

  • Steeper learning curve for beginners
  • Can be more complex to configure for simple applications
  • Requires more AWS knowledge and setup

Code Comparison

Zappa:

from zappa.asynchronous import task

@task
def my_async_task():
    # Perform asynchronous operations
    pass

Gordon:

from gordon import events

@events.sns_subscriber('my-topic')
def handle_sns_event(event):
    # Handle SNS event
    pass

Both Zappa and Gordon aim to simplify serverless deployments on AWS, but they have different approaches and feature sets. Zappa focuses on deploying Python WSGI applications, while Gordon is more oriented towards event-driven architectures. Zappa offers more flexibility and advanced features, making it suitable for complex applications. Gordon, on the other hand, provides a simpler setup process and is easier to use for basic serverless functions and event-driven workflows.

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM

Pros of AWS SAM CLI

  • Official AWS tool with extensive documentation and community support
  • Seamless integration with AWS services and CloudFormation
  • Local testing and debugging capabilities for Lambda functions

Cons of AWS SAM CLI

  • Steeper learning curve for developers new to AWS ecosystem
  • Limited to AWS-specific deployments and services

Code Comparison

AWS SAM CLI:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler

Gordon:

- name: hello-world
  type: lambda
  runtime: python3.6
  handler: handler.hello
  memory: 128
  timeout: 3

Gordon offers a simpler YAML configuration for Lambda functions, while AWS SAM CLI provides a more comprehensive CloudFormation-based template. AWS SAM CLI's approach allows for more detailed resource definitions and integrations with other AWS services, but may require more verbose configurations. Gordon's syntax is more concise and easier to read for simple Lambda deployments, but may lack some of the advanced features and integrations offered by AWS SAM CLI.

20,922

Pulumi - Infrastructure as Code in any programming language 🚀

Pros of Pulumi

  • Supports multiple cloud providers (AWS, Azure, GCP, etc.) and programming languages (Python, TypeScript, Go, etc.)
  • Offers a more comprehensive infrastructure-as-code solution with state management and collaboration features
  • Provides a rich ecosystem of pre-built components and integrations

Cons of Pulumi

  • Steeper learning curve, especially for those new to infrastructure-as-code concepts
  • Requires more setup and configuration compared to Gordon's simpler approach
  • May be overkill for small projects or teams primarily focused on AWS Lambda deployments

Code Comparison

Gordon (Python):

@gordon.event(topic='arn:aws:sns:...')
def handler(event, context):
    print(event)
    return event

Pulumi (Python):

import pulumi_aws as aws

topic = aws.sns.Topic("my-topic")
lambda_func = aws.lambda_.Function("my-function",
    code=pulumi.AssetArchive({"index.py": pulumi.StringAsset("...")}),
    handler="index.handler",
    runtime="python3.8")
aws.lambda_.EventSourceMapping("topic-subscription",
    event_source_arn=topic.arn,
    function_name=lambda_func.name)

Gordon focuses on simplifying AWS Lambda deployments with a decorator-based approach, while Pulumi offers a more comprehensive infrastructure-as-code solution with support for multiple cloud providers and programming languages.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

gordon

GitHub license Python Versions Beta PyPI version Travis Build Join the chat at https://gitter.im/jorgebastida/gordon

Gordon is a tool to create, wire and deploy AWS Lambdas using CloudFormation

Documentation: https://gordon.readthedocs.io/en/latest/

Features

  • 100% CloudFormation resource creation
  • 100% Boilerplate free
  • 100% isolated and dead-simple multi-stage and multi region deployments
  • Python/Javascript/Java/Golang/Scala... runtimes supported.
  • Run Lambdas locally (Python/Javascript/Java/Golang/Scala...)
  • Simple yml configuration
  • Seamless integration with (pip,npm, gradle, ...)
  • 100% Customizable lambda build process. Use Docker, Makefile or... a simple shell script.
  • Supported integrations
    • APIGateway
    • Scheduled CloudWatch Events (cron)
    • CloudWatch Events
    • Dynamodb Streams
    • Kinesis Streams
    • S3
  • AWS Lambda Versions and Aliases
  • VPC support
  • Dynamic stage parametrization including:
    • Environment variables
    • Jinja2 values
    • ARN translation helpers
  • Extensive Documentation
  • Good test suite
  • Love ❤️

Example Projects

We think documentation and examples are an important pillar... so here you have a nice list of things you can play with!

Why should you use this project?

Because this project doesn't introduce anything new. Gordon is just a thin layer of sugar around AWS services and few conventions, which makes deploying and wiring Lambdas really easy.

Under the hood, gordon just generates self-contained CloudFormation templates... which is great!

Why introduce yet-another framework when you can build lambdas using AWS services and tools you already know how to use (pip, npm, grunt, gulp, gradle, Makefile...)

Keep it simple! 😀

Isolation between stages?

Yes, we believe that there must be 100% isolation between your application stages (dev, staging, prod...). That means that resources which (for example) serve a development purpose must not be related to the ones which are serving production load.

One example of this is that it is an AWS best practice to use different AWS accounts between stages. Although this is not required, it makes evident that mixing resources between stages is a bad idea.

This completely clashes with the suggested approach for services such as apigateway, where they emphasize to have several "stages" for the same apigateway resource. We disagree and completely ignore that functionality because we believe is the wrong approach.

Gordon keeps reproducibility and isolation at it's core. When you apply gordon projects in different stages or regions, you'll deploy completely isolated Cloudformation stacks which will contain an exact and isolated copy of all the resources you have defined.

Why CloudFormation?

One of the best advantages of using AWS is the fact that reproducibility is at it's core and their ecosystem is full of services which encourage it. Their flagship is CloudFormation.

Then... why not just use CloudFormation? Well, there are three reasons:

  1. Complexity: CloudFormation stacks are defined using JSON templates which are a nightmare to write and maintain. And remember... Friends don't let friends write JSON files.
  2. Glue: There is a lot of glue to put in between a "normal user" and the reality-check of deploying and wiring a Lambda into AWS.
  3. APIs: Not all AWS APIs are released when services are announced... ain't frameworks (boto3), nor integrations with CloudFormation.

This project tries to solve these three issues by:

  1. Creating a really thin layer of conventions on top of easy to maintain YAML files.
  2. Making everything work out of the box as well trying to make people not shoot themselves in the foot.
  3. Working around the lack of CloudFormation/Framework APIs (keeping in mind they will eventually happen).

Does gordon use gordon to deploy gordon?

Yes, we eat our own dog food; We use gordon to create gordon. The idea is that, (unlike many other projects) we don't think streaming API commands to AWS is a nice solution, so instead, we fill the gaps with custom CloudFormation resources.

Those Custom CloudFormation resources are implemented using Lambdas (deployed by gordon)... crazy uh?!

Why all this madness? Again... because reproducibility. If you manage some resources using CloudFormation, and some others streaming API commands, if/when you try to reproduce or decommission your environment... you are pretty much f***.

Feedback

We would love to hear as much feedback as possible! If you have any comment, please drop me an email to me@jorgebastida.com