AWS Lambda Alias Routing

Lambda Version Alias

This example provides house alias routing can be used in API Gateway and in Kinesis Streams (lambda event mapping to alias)

https://github.com/shivaramani/lambdaversion

High level Steps

  • The solution has “src” and “templates”. src has the java sample lambda. templates have the .tf files.
  • Upon “mvn clean package” “target” folder will have the jar generated.
  • “exec.sh” has the aws cli/bash commands to deploy the lambda function and modify the alias accordingly
  1. Initial Setup
    • Build java source
    • Run terraform templates to create API Gateway/Lambda. This pushes the above jar to the lambda
    • Created API points to lambda:active alias. “red” and “black” aliases are also created at this point
  2. Modify the code
    • Run the “exec.sh”. This is similar to GIT pipelines deploying the function
    • At this point the the cli sets current version as red and new code being deployed as black
    • cli sets the routing pointing to black and additional routing config weightage for the fallback/red

Leave a Reply

Your email address will not be published. Required fields are marked *