{"id":150,"date":"2020-12-02T22:23:06","date_gmt":"2020-12-02T22:23:06","guid":{"rendered":"http:\/\/blog.codeandtech.com\/blog\/?p=150"},"modified":"2020-12-02T22:23:06","modified_gmt":"2020-12-02T22:23:06","slug":"aws-lambda-alias-routing","status":"publish","type":"post","link":"https:\/\/blog.codeandtech.com\/blog\/2020\/12\/02\/aws-lambda-alias-routing\/","title":{"rendered":"AWS Lambda Alias Routing"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Lambda Version Alias<\/h3>\n\n\n\n<p>This example provides house alias routing can be used in API Gateway and in Kinesis Streams (lambda event mapping to alias)<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/shivaramani\/lambdaversion\">https:\/\/github.com\/shivaramani\/lambdaversion<\/a><\/p>\n\n\n\n<p>High level Steps<\/p>\n\n\n\n<ul><li>The solution has &#8220;src&#8221; and &#8220;templates&#8221;. src has the java sample lambda. templates have the .tf files.<\/li><li>Upon &#8220;mvn clean package&#8221; &#8220;target&#8221; folder will have the jar generated.<\/li><li>&#8220;exec.sh&#8221; has the aws cli\/bash commands to deploy the lambda function and modify the alias accordingly<\/li><\/ul>\n\n\n\n<ol><li>Initial Setup<ul><li>Build java source<\/li><li>Run terraform templates to create API Gateway\/Lambda. This pushes the above jar to the lambda<\/li><li>Created API points to lambda:active alias. &#8220;red&#8221; and &#8220;black&#8221; aliases are also created at this point<\/li><\/ul><\/li><li>Modify the code<ul><li>Run the &#8220;exec.sh&#8221;. This is similar to GIT pipelines deploying the function<\/li><li>At this point the the cli sets current version as red and new code being deployed as black<\/li><li>cli sets the routing pointing to black and additional routing config weightage for the fallback\/red<\/li><\/ul><\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;src&#8221; and &#8220;templates&#8221;. src has the java sample lambda. templates have the .tf files. Upon &#8220;mvn clean package&#8221; &#8220;target&#8221; folder will have the jar &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.codeandtech.com\/blog\/2020\/12\/02\/aws-lambda-alias-routing\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;AWS Lambda Alias Routing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/150"}],"collection":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":1,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":151,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions\/151"}],"wp:attachment":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}