Git Product home page Git Product logo

rimironenko / aws-sam-gradual-deployment Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 145 KB

An AWS SAM application with gradual deployment of a Lambda function written in Java. The application uses an auto-generated AWS SAM pipeline and linear deployment preference of a new version of the Lambda function.

License: MIT License

Java 100.00%
aws aws-sam aws-lambda-java aws-sam-pipeline lambda-deployment sam-deploy github-actions

aws-sam-gradual-deployment's Introduction

App

This project contains an AWS SAM application with AWS Java SDK 2.x dependencies. The application uses AWS SAM capability for a gradual deployment of Lambda functions and AWS SAM pipeline triggered by GitHub actions. The infrastructure is present on the picture given below. Architecture diagram

Please read more about this in my Medium blog post.

Prerequisites

Development

The generated function handler class just returns the input. The configured AWS Java SDK client is created in DependencyFactory class and you can add the code to interact with the SDK client based on your use case.

Building the project

sam build

Testing it locally

sam local invoke

Deployment

The generated project contains a default SAM template file template.yaml where you can configure different properties of your lambda function such as memory size and timeout. You might also need to add specific policies to the lambda function so that it can access other AWS resources.

To deploy the application, you can run the following command:

sam deploy --guided

See Deploying Serverless Applications for more info.

Traffic shifting after a deployment

PreTrafficHookHandler Lambda function validates the inftasrtucture before starting the traffic shifting. It takes the lifecycle status from the environemnt configuration, but can execute any custom business logic to decide if the traffic shifting can be started for a new Lambda version.

SAM template contains "DeploymentPreference" property for API Gateway Lambda handler that starts the traffic shifting as configured if the PreTrafficHookHandler reports success.

aws-sam-gradual-deployment's People

Contributors

rimironenko avatar

Watchers

 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.