[{"data":1,"prerenderedAt":152},["ShallowReactive",2],{"content-svc-lambda-paved-path-java-replatforming-access-patterns":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":22,"menu":23,"menuType":148,"isCollapseableMenu":26,"nextDocItem":59,"previousDocItem":29,"contributorPaths":149,"contentName":151,"slug":55,"readingTime":40},"\u003Cp>\u003Cstrong>Web Applications \u002F REST APIs\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Cp>With a server, VM or a container service, when you write an API, and you expose it with an HTTP server listening to a \nport. Application frameworks like Spring Boot convert HTTP requests to Java objects, and your application code runs and \nresponds.\u003C\u002Fp>\n\u003Cp>You can&#39;t make an HTTP request directly to a Lambda function because it can&#39;t accept in-bound connections. You can still\nbuild HTTP APIs with Lambda, by using services such as \u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Fapi-gateway\u002F\">Amazon API Gateway\u003C\u002Fa> and \n\u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Felasticloadbalancing\u002Fapplication-load-balancer\u002F\">Application Load Balancer\u003C\u002Fa> (ALB) that receive \nHTTP requests and integrate with Lambda. They convert the HTTP request to JSON and call the Lambda function&#39;s invoke API.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fimage12.png\" alt=\"\">\u003C\u002Fp>\n\u003Cp>There are two common patterns used to re-platform applications with minimal code changes.\u003C\u002Fp>\n\u003Col>\n\u003Cli>AWS Lambda Web Adapter\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-lambda-web-adapter\">AWS Lambda Web Adapter\u003C\u002Fa> is a \u003Ca href=\"https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fruntimes-extensions-api.html\">Lambda Extension\u003C\u002Fa> \nthat you configure to be used with your Lambda function. It takes an HTTP request as a JSON event and uses it to make an\nHTTP request for your application. The advantage of this approach is that your application code doesn&#39;t need to change \nat all. The disadvantage is that you have to initialize an HTTP server, which isn&#39;t strictly needed. This extends the \nfirst invoke latency and increases memory used.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fimage13.png\" alt=\"\">\u003C\u002Fp>\n\u003Col start=\"2\">\n\u003Cli>AWS Serverless Java Container\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-serverless-java-container\">AWS Serverless Java Container\u003C\u002Fa> is a Java library that you\nadd to your application as a dependency.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fserverless-java-container.png\" alt=\"\">\u003C\u002Fp>\n\u003Cp>You add a new class to your application that implements the \u003Ca href=\"https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fjava-handler.html\">Lambda request handler interface\u003C\u002Fa>.\nThis will be the entry point to your function.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fimage14.png\" alt=\"\">\u003C\u002Fp>\n\u003Cp>This has a reference to your Spring application class (Struts, Jersey, and Spark also supported) when Lambda initializes\nyour function, it will also initialize your Spring application.\u003C\u002Fp>\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration\">From Serverful to Serverless Java with AWS Lambda\u003C\u002Fa> \nworkshop gives you a step-by-step guide of how to migrate a Spring Boot application to Lambda using the AWS Serverless Java Container library.\u003C\u002Fp>\n",{"title":6,"order":7,"callout":8,"resources":12,"learningGoals":20},"Access Patterns",2,{"title":9,"description":10,"link":11},"Workshop","The workshop gives you a step-by-step guide of how to migrate a Spring Boot application to Lambda using the AWS Serverless Java Container library.","https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration",[13,17],{"link":14,"type":15,"text":16},"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-lambda-web-adapter","Repo","AWS Lambda Web Adapter",{"link":18,"text":19,"type":15},"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-serverless-java-container","AWS Serverless Java Container",[21],"To learn the different approaches to replatforming REST APIs on Lambda","**Web Applications \u002F REST APIs**\n\nWith a server, VM or a container service, when you write an API, and you expose it with an HTTP server listening to a \nport. Application frameworks like Spring Boot convert HTTP requests to Java objects, and your application code runs and \nresponds.\n\nYou can't make an HTTP request directly to a Lambda function because it can't accept in-bound connections. You can still\nbuild HTTP APIs with Lambda, by using services such as [Amazon API Gateway](https:\u002F\u002Faws.amazon.com\u002Fapi-gateway\u002F) and \n[Application Load Balancer](https:\u002F\u002Faws.amazon.com\u002Felasticloadbalancing\u002Fapplication-load-balancer\u002F) (ALB) that receive \nHTTP requests and integrate with Lambda. They convert the HTTP request to JSON and call the Lambda function's invoke API.\n\n![](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fimage12.png)\n\nThere are two common patterns used to re-platform applications with minimal code changes.\n\n1. AWS Lambda Web Adapter\n\nThe [AWS Lambda Web Adapter](https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-lambda-web-adapter) is a [Lambda Extension](https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fruntimes-extensions-api.html) \nthat you configure to be used with your Lambda function. It takes an HTTP request as a JSON event and uses it to make an\nHTTP request for your application. The advantage of this approach is that your application code doesn't need to change \nat all. The disadvantage is that you have to initialize an HTTP server, which isn't strictly needed. This extends the \nfirst invoke latency and increases memory used.\n\n![](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fimage13.png)\n\n2. AWS Serverless Java Container\n\nThe [AWS Serverless Java Container](https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-serverless-java-container) is a Java library that you\nadd to your application as a dependency.\n\n![](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fserverless-java-container.png)\n\nYou add a new class to your application that implements the [Lambda request handler interface](https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fjava-handler.html).\nThis will be the entry point to your function.\n\n![](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fassets\u002Fimage14.png)\n\nThis has a reference to your Spring application class (Struts, Jersey, and Spark also supported) when Lambda initializes\nyour function, it will also initialize your Spring application.\n\nThe [From Serverful to Serverless Java with AWS Lambda](https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration) \nworkshop gives you a step-by-step guide of how to migrate a Spring Boot application to Lambda using the AWS Serverless Java Container library.\n",[24,44,56,85,102,114,138],{"title":25,"collapsible":26,"isCollapsed":27,"content":28},"Introduction",false,true,[29],{"title":25,"order":30,"callout":31,"prerequisite":32,"resources":35,"time":40,"path":41,"id":42,"link":43},1,{"title":9,"description":10,"link":11},[33,34],"Some understanding of Java","Some Understanding of AWS Lambda",[36],{"link":37,"text":38,"type":39},"https:\u002F\u002Faws.amazon.com\u002Flambda\u002F","Learn more about Lambda","text","2 min","introduction","introduction.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fintroduction",{"title":45,"collapsible":26,"isCollapsed":26,"content":46},"Access patterns",[47],{"title":6,"order":7,"callout":48,"resources":49,"learningGoals":52,"time":40,"path":53,"id":54,"link":55},{"title":9,"description":10,"link":11},[50,51],{"link":14,"type":15,"text":16},{"link":18,"text":19,"type":15},[21],"access-patterns","access-patterns.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Faccess-patterns",{"title":57,"collapsible":26,"isCollapsed":27,"content":58},"SnapStart",[59],{"title":60,"youtubeVideoID":61,"order":7,"callout":62,"resources":65,"learningGoals":80,"time":40,"path":82,"id":83,"link":84},"Performance - SnapStart","ZbnAithBNYY",{"title":9,"description":63,"link":64},"Learn how SnapStart addresses Java function performance, how to enable SnapStart with IaC, and how to customize your SnapStart behavior with runtime hooks.","https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F03-snapstart",[66,70,73,77],{"link":67,"text":68,"type":69},"https:\u002F\u002Fserverlessland.com\u002Fpatterns\u002Fapigw-lambda-snapstart","API Gateway to Lambda with SnapStart","Pattern",{"link":71,"type":69,"text":72},"https:\u002F\u002Fserverlessland.com\u002Fpatterns\u002Fapigw-lambda-rds-snapstart","REST API with Amazon API Gateway, Amazon RDS and AWS Lambda with SnapStart",{"link":74,"type":75,"text":76},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fstarting-up-faster-with-aws-lambda-snapstart\u002F?ref=serverlessland","Blog","Starting up faster with AWS Lambda SnapStart",{"link":78,"type":75,"text":79},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Freducing-java-cold-starts-on-aws-lambda-functions-with-snapstart\u002F?ref=serverlessland","Reducing Java cold starts on AWS Lambda functions with SnapStart",[81],"Learn how Lambda SnapStart improves first invoke latency","snapstart","snapstart.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fsnapstart",{"title":86,"collapsible":26,"isCollapsed":27,"content":87},"Performance",[88],{"title":86,"youtubeVideoID":89,"order":7,"callout":90,"resources":92,"learningGoals":96,"time":98,"path":99,"id":100,"link":101},"sVJOJUD0fhQ",{"title":9,"description":91,"link":11},"Learn how to optimize Java Lambda functions.",[93],{"link":94,"type":75,"text":95},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Foptimizing-aws-lambda-function-performance-for-java\u002F?ref=serverlessland","Optimizing AWS Lambda function performance for Java",[97],"How to optimization your Java function","1 min","performance","performance.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fperformance",{"title":103,"collapsible":26,"isCollapsed":27,"content":104},"Observability - Logging ",[105],{"title":106,"order":7,"callout":107,"learningGoals":108,"time":110,"path":111,"id":112,"link":113},"Observability - Logging",{"title":9,"description":10,"link":11},[109],"How to meet your logging requirements with Lambda","4 min","observability-and-logging","observability-and-logging.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fobservability-and-logging",{"title":115,"collapsible":26,"isCollapsed":27,"content":116},"Observability - Metrics",[117],{"title":115,"order":7,"callout":118,"resources":122,"learningGoals":132,"time":134,"path":135,"id":136,"link":137},{"title":119,"description":120,"link":121},"Watch the video","AWS Lambda Powertools: Lessons from the road to 10 million downloads.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=dH2GP6Lydj8",[123,126,129],{"link":124,"text":125,"type":15},"https:\u002F\u002Fawslabs.github.io\u002Faws-lambda-powertools-java\u002Fcore\u002Fmetrics\u002F","Lambda Powertools for Java - Metrics",{"link":127,"text":128,"type":15},"https:\u002F\u002Fawslabs.github.io\u002Faws-lambda-powertools-java\u002F","Lambda Powertools for Java",{"link":130,"text":131,"type":15},"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Faws-embedded-metrics-java","EMF Client Library",[133],"How to efficiently write metrics with Lambda","3 min","metrics","metrics.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fmetrics",{"title":139,"collapsible":26,"isCollapsed":27,"content":140},"Health checks",[141],{"title":142,"order":7,"learningGoals":143,"time":98,"path":145,"id":146,"link":147},"Health Checks",[144],"To understand when to use health checks with Lambda","health-checks","health-checks.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fhealth-checks","LESSON",[150],"content\u002Fcontributors\u002Fmark-sailes.json","Java Replatforming",1792751693805]