{"id":22334437,"url":"https://github.com/adambien/aws-quarkus-lambda-cdk-plain","last_synced_at":"2025-04-07T10:25:29.756Z","repository":{"id":40454955,"uuid":"429580361","full_name":"AdamBien/aws-quarkus-lambda-cdk-plain","owner":"AdamBien","description":"Quarkus JAX-RS App Deployed with AWS CDK as AWS Lambda behind HTTP API, REST API, Application Load Balancer and as Function URL","archived":false,"fork":false,"pushed_at":"2025-03-04T19:28:38.000Z","size":133,"stargazers_count":66,"open_issues_count":1,"forks_count":30,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-31T09:04:19.987Z","etag":null,"topics":["alb","api-gateway","aws","aws-lambda","cdk","cdkv2","cloud","elb","elbv2","faas","functionurl","furl","java","lambda","loadbalancer","microservice","serverless"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdamBien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-18T21:08:36.000Z","updated_at":"2025-03-04T19:28:42.000Z","dependencies_parsed_at":"2024-05-02T22:38:49.565Z","dependency_job_id":"c7ba0fef-2cef-43f0-94a1-20b9d5755a9e","html_url":"https://github.com/AdamBien/aws-quarkus-lambda-cdk-plain","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamBien%2Faws-quarkus-lambda-cdk-plain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamBien%2Faws-quarkus-lambda-cdk-plain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamBien%2Faws-quarkus-lambda-cdk-plain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamBien%2Faws-quarkus-lambda-cdk-plain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdamBien","download_url":"https://codeload.github.com/AdamBien/aws-quarkus-lambda-cdk-plain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247633701,"owners_count":20970376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alb","api-gateway","aws","aws-lambda","cdk","cdkv2","cloud","elb","elbv2","faas","functionurl","furl","java","lambda","loadbalancer","microservice","serverless"],"created_at":"2024-12-04T05:07:52.364Z","updated_at":"2025-04-07T10:25:29.734Z","avatar_url":"https://github.com/AdamBien.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MicroProfile with Quarkus as AWS Lambda Function deployed with Cloud Development Kit (CDK) v2 for Java\n\nA lean starting point for building, testing and deploying Quarkus MicroProfile applications deployed as AWS Lambda behind API Gateway.\nThe business logic, as well as, the Infrastructure as Code deployment are implemented with Java.\n\n# TL;DR\n\nA Quarkus MicroProfile application:\n\n```java\n\n@Path(\"hello\")\n@ApplicationScoped\npublic class GreetingResource {\n\n    @Inject\n    Greeter greeter;\n\n    @GET\n    @Produces(MediaType.TEXT_PLAIN)\n    public String hello() {\n        return this.greeter.greetings();\n    }\n\n    @POST\n    @Consumes(MediaType.TEXT_PLAIN)\n    public void hello(String message) {\n        this.greeter.greetings(message);\n    }\n}\n```\n...with an additional dependency / [extension](https://quarkus.io/guides/amazon-lambda-http) for AWS REST APIs Gateway:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.quarkus\u003c/groupId\u003e\n    \u003cartifactId\u003equarkus-amazon-lambda-rest\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n\nor HTTP APIs Gateway (default configuration):\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.quarkus\u003c/groupId\u003e\n    \u003cartifactId\u003equarkus-amazon-lambda-http\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n\n...deployed with AWS Cloud Development Kit:\n\n```java\n\nFunction createFunction(String functionName,String functionHandler, \n    Map\u003cString,String\u003e configuration, int memory, int maximumConcurrentExecution, int timeout) {\n\n        return Function.Builder.create(this, functionName)\n                .runtime(Runtime.JAVA_21)\n                .code(Code.fromAsset(\"../lambda/target/function.zip\"))\n                .handler(functionHandler)\n                .memorySize(memory)\n                .functionName(functionName)\n                .environment(configuration)\n                .timeout(Duration.seconds(timeout))\n                .reservedConcurrentExecutions(maximumConcurrentExecution)\n                .build();\n    }\n```\nYou choose between HTTP APIs gateway and REST APIs gateway with the `httpAPIGatewayIntegration` variable:\n\n``` java\npublic class CDKApp {\n    public static void main(final String[] args) {\n\n            var app = new App();\n            var appName = \"quarkus-apigateway-lambda-cdk\";\n            Tags.of(app).add(\"project\", \"MicroProfile with Quarkus on AWS Lambda\");\n            Tags.of(app).add(\"environment\",\"development\");\n            Tags.of(app).add(\"application\", appName);\n\n            var httpAPIGatewayIntegration = true;\n            new CDKStack(app, appName, true);\n            app.synth();\n        }\n    }\n}\n```\n\n## Prerequisites\n\n## Java\n\n1. Java / openJDK is installed\n2. [Maven](https://maven.apache.org/) is installed\n\n## AWS \n\nSame installation as [aws-cdk-plain](https://github.com/AdamBien/aws-cdk-plain):\n\n0. For max convenience use the [`default` profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html). A profile named `default` doesn't have to be specificed with the `--profile` flag or configured in CDK applications.\n1. Install [AWS CDK CLI](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html)\n2. [`cdk boostrap --profile YOUR_AWS_PROFILE`](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)\n\nThis template ships with AWS HTTP APIs Gateway. REST APIs Gateway is also supported. You can switch between both by using the corresponding extension (see [Choosing between HTTP APIs and REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html). \n\nPrivate APIs are only supported by [REST API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html).\n\nYou can also build AWS Lambda `function.zip` and executable Quarkus JAR by extracting the extension into a Maven profile. Checkout: [https://adambien.blog/roller/abien/entry/hybrid_microprofile_deployments_with_quarkus](https://adambien.blog/roller/abien/entry/hybrid_microprofile_deployments_with_quarkus).\n\nSee you at: [airhacks.live](https://airhacks.live)\n\n# in action\n\n## full build\n\nBuild the Quarkus project `lambda` and deploy it with `cdk` as AWS Lambda:\n\n```\ncd lambda\n./buildAndDeployDontAsk.sh\n```\n\n## continuous and accelerated deployment\n\nTo continuously deploy the AWS Lambda at any changes, perform: \n\n```\ncd cdk\ncdk watch\n```\n\nNow on every: `mvn package` in `lambda` directory / project the JAX-RS application is re-deployed automatically.\n\n## local deployment\n\nYou can run the `lambda` project as regular Quarkus application with:\n\n`mvn compile quarkus:dev`\n\nThe application is available under: `http://localhost:8080/hello`\n\n## Deploying MicroProfile / Quarkus Application as AWS Lambda with Java AWS CDK\n\n[![Deploying MicroProfile / Quarkus Application as AWS Lambda with Java AWS CDK](https://i.ytimg.com/vi/NA0WjIgp4CQ/mqdefault.jpg)](https://www.youtube.com/embed/NA0WjIgp4CQ?rel=0)\n\n\n## Accelarating deployments with CDK v2 Watch\n\n\nUsing `cdk watch` for faster deployments\n\n[![Accelerating Deployment with CDK v2 Watch](https://i.ytimg.com/vi/SK7ic9wTYqU/mqdefault.jpg)](https://www.youtube.com/embed/SK7ic9wTYqU?rel=0)\n\nSee you at: [airhacks.live](https://airhacks.live)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadambien%2Faws-quarkus-lambda-cdk-plain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadambien%2Faws-quarkus-lambda-cdk-plain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadambien%2Faws-quarkus-lambda-cdk-plain/lists"}