{"id":34985273,"url":"https://github.com/kiquetal/aws-cdk-lambda-quarkus","last_synced_at":"2026-05-23T19:34:21.873Z","repository":{"id":283607830,"uuid":"951958057","full_name":"kiquetal/aws-cdk-lambda-quarkus","owner":"kiquetal","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-14T15:08:19.000Z","size":71026,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T16:21:34.592Z","etag":null,"topics":["aws-cdk-typescript","aws-cdk-v2","aws-lambda","java17","quarkus-native"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiquetal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-03-20T14:06:16.000Z","updated_at":"2025-05-14T15:08:23.000Z","dependencies_parsed_at":"2025-05-14T16:20:44.194Z","dependency_job_id":"c9e20536-d6d1-41e0-a3fc-a585b22b918a","html_url":"https://github.com/kiquetal/aws-cdk-lambda-quarkus","commit_stats":null,"previous_names":["kiquetal/aws-cdk-lambda-quarkus"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kiquetal/aws-cdk-lambda-quarkus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiquetal%2Faws-cdk-lambda-quarkus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiquetal%2Faws-cdk-lambda-quarkus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiquetal%2Faws-cdk-lambda-quarkus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiquetal%2Faws-cdk-lambda-quarkus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiquetal","download_url":"https://codeload.github.com/kiquetal/aws-cdk-lambda-quarkus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiquetal%2Faws-cdk-lambda-quarkus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33410343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T18:09:33.147Z","status":"ssl_error","status_checked_at":"2026-05-23T18:09:31.380Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["aws-cdk-typescript","aws-cdk-v2","aws-lambda","java17","quarkus-native"],"created_at":"2025-12-27T01:29:37.952Z","updated_at":"2026-05-23T19:34:21.865Z","avatar_url":"https://github.com/kiquetal.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CDK Lambda Quarkus Project\n\n![Quarkus](https://img.shields.io/badge/Quarkus-FF004B?style=for-the-badge\u0026logo=quarkus\u0026logoColor=white)\n![AWS Lambda](https://img.shields.io/badge/AWS_Lambda-FF9900?style=for-the-badge\u0026logo=amazonaws\u0026logoColor=white)\n![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n\nThis project demonstrates how to deploy a Quarkus application as an AWS Lambda function using AWS CDK with TypeScript.\n\n## 📋 Table of Contents\n\n- [Project Overview](#project-overview)\n- [Prerequisites](#prerequisites)\n- [Getting Started](#getting-started)\n  - [Enabling QEMU for Docker Multi-Architecture Support](#enabling-qemu-for-docker-multi-architecture-support)\n  - [CDK Useful Commands](#cdk-useful-commands)\n- [Building the Quarkus Application](#building-the-quarkus-application)\n- [Deploying with AWS CDK](#deploying-with-aws-cdk)\n- [Deploying with AWS CLI](#deploying-with-aws-cli)\n- [Testing the Lambda Function](#testing-the-lambda-function)\n- [LocalStack Integration](#localstack-integration)\n- [Configuration Options](#configuration-options)\n\n## 🔍 Project Overview\n\nThis project uses AWS CDK with TypeScript to define and provision AWS infrastructure for deploying a Quarkus application as a Lambda function. The Quarkus application can be deployed in different modes:\n\n- **JVM Mode**: Traditional Java deployment\n- **Native Mode**: GraalVM native image for faster startup and lower memory usage\n- **Native ARM64 Mode**: Native image optimized for ARM64 architecture\n\nThe `cdk.json` file tells the CDK Toolkit how to execute your app.\n\n## 🛠️ Prerequisites\n\n- Node.js and npm\n- AWS CLI configured with appropriate credentials\n- Maven\n- Java 17 or later\n- GraalVM (for native builds)\n- Docker (for native builds with container)\n- AWS SAM CLI (for local testing)\n- QEMU (for multi-architecture builds)\n\n## 🚀 Getting Started\n\n### Enabling QEMU for Docker Multi-Architecture Support\n\nTo build and run containers for different CPU architectures (like x86_64 and ARM64) on a single host, you need to enable QEMU in Docker. This is essential for cross-platform development and testing, especially when building native ARM64 images on x86_64 machines.\n\n#### Linux\n\n```bash\n# Install QEMU packages\nsudo apt-get update\nsudo apt-get install -y qemu-user-static binfmt-support\n\n# Register QEMU in the build agent\ndocker run --rm --privileged multiarch/qemu-user-static --reset -p yes\n```\n\n#### macOS\n\n```bash\n# QEMU is included with Docker Desktop for Mac\n# Just make sure you have the latest version of Docker Desktop installed\n\n# Verify QEMU is working\ndocker run --rm --platform=linux/arm64 arm64v8/ubuntu uname -m\n# Should output: aarch64\n```\n\n#### Windows\n\n```bash\n# QEMU is included with Docker Desktop for Windows\n# Make sure you have the latest version of Docker Desktop installed with WSL2 backend\n\n# Verify QEMU is working\ndocker run --rm --platform=linux/arm64 arm64v8/ubuntu uname -m\n# Should output: aarch64\n```\n\n#### Verifying QEMU Installation\n\nTo verify that QEMU is properly set up, run:\n\n```bash\n# Check if you can run ARM64 containers on x86_64 host (or vice versa)\ndocker run --rm --platform=linux/arm64 arm64v8/alpine uname -m\n# Should output: aarch64\n\ndocker run --rm --platform=linux/amd64 amd64/alpine uname -m\n# Should output: x86_64\n```\n\n### CDK Useful Commands\n\n* `npm run build` - Compile TypeScript to JavaScript\n* `npm run watch` - Watch for changes and compile\n* `npm run test` - Perform the Jest unit tests\n* `npx cdk deploy` - Deploy this stack to your default AWS account/region\n* `npx cdk diff` - Compare deployed stack with current state\n* `npx cdk synth` - Emits the synthesized CloudFormation template\n\n### Running the CDK App\n\n```bash\ncdk2 deploy --profile yourProfileName\n```\n\n## 🏗️ Building the Quarkus Application\n\n### Creating a JAR (JVM Mode)\n\n```bash\nmvn package\n```\n\n### Creating a Native Executable\n\n```bash\nmvn package -Pnative\n```\n\n### Creating a Native Executable for ARM64\n\n```bash\nmvn clean package -Pnative -Dquarkus.native.container-runtime=docker -DskipTests\n```\n\n\u003e **Note**: After building, the `function.zip` file from the target directory should be moved to a folder named `zipped` for deployment.\n\n## 🚢 Deploying with AWS CDK\n\nThe project includes CDK code to deploy the Quarkus Lambda function. The deployment process is handled by the CDK stack defined in the `lib` directory.\n\nTo deploy using CDK:\n\n```bash\nnpm run build\nnpx cdk deploy\n```\n\n## 🚢 Deploying with AWS CLI\n\nYou can deploy your Quarkus Lambda function directly using the AWS CLI. This section outlines the steps for different deployment options.\n\n### JVM Mode Deployment\n\n1. **Build the JVM package**:\n   ```bash\n   mvn package\n   ```\n\n2. **Create the Lambda function**:\n   ```bash\n   aws lambda create-function \\\n     --function-name quarkus-lambda-jvm \\\n     --zip-file fileb://lambda-pom/quarkus-lambda/target/function.zip \\\n     --handler io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest \\\n     --runtime java17 \\\n     --role arn:aws:iam::your-account-id:role/lambda-role \\\n     --memory-size 256 \\\n     --timeout 15 \\\n     --environment Variables={QUARKUS_LAMBDA_HANDLER=test}\n   ```\n\n### Native Mode Deployment\n\n1. **Build the native package**:\n   ```bash\n   mvn package -Pnative\n   ```\n\n2. **Create the Lambda function**:\n   ```bash\n   aws lambda create-function \\\n     --function-name quarkus-lambda-native \\\n     --zip-file fileb://lambda-pom/quarkus-lambda/target/function.zip \\\n     --handler not.used.in.provided.runtime \\\n     --runtime provided.al2023 \\\n     --role arn:aws:iam::your-account-id:role/lambda-role \\\n     --memory-size 128 \\\n     --timeout 15 \\\n     --environment Variables={DISABLE_SIGNAL_HANDLERS=true,QUARKUS_LAMBDA_HANDLER=two}\n   ```\n\n### Native ARM64 Mode Deployment\n\n\u003e **Important**: Make sure you have enabled QEMU for Docker multi-architecture support as described in the [Enabling QEMU for Docker Multi-Architecture Support](#enabling-qemu-for-docker-multi-architecture-support) section before proceeding with ARM64 builds.\n\n1. **Build the native ARM64 package**:\n   ```bash\n   mvn clean package -Pnative -Dquarkus.native.container-runtime=docker -DskipTests\n   ```\n\n2. **Create the Lambda function**:\n   ```bash\n   aws lambda create-function \\\n     --function-name quarkus-lambda-native-arm \\\n     --zip-file fileb://lambda-pom/quarkus-lambda/target/function.zip \\\n     --handler not.used.in.provided.runtime \\\n     --runtime provided.al2023 \\\n     --architectures arm64 \\\n     --role arn:aws:iam::your-account-id:role/lambda-role \\\n     --memory-size 128 \\\n     --timeout 15 \\\n     --environment Variables={DISABLE_SIGNAL_HANDLERS=true}\n   ```\n\n### Updating an Existing Function\n\n```bash\naws lambda update-function-code \\\n  --function-name quarkus-lambda-native \\\n  --zip-file fileb://lambda-pom/quarkus-lambda/target/function.zip\n```\n\n## 🧪 Testing the Lambda Function\n\n### Testing Locally with SAM\n\n```bash\nsam local invoke -t lambda-pom/quarkus-lambda/target/sam.jvm.yaml -e lambda-pom/quarkus-lambda/payload.json\n```\n\n#### With Environment Variables\n\nYou can pass environment variables to your Lambda function when testing locally with SAM using the `--env-vars` option:\n\n```bash\nsam local invoke -t lambda-pom/quarkus-lambda/target/sam.jvm.yaml -e lambda-pom/quarkus-lambda/payload.json --env-vars lambda-pom/quarkus-lambda/env.json\n```\n\nThe env.json file should have the following format:\n\n```json\n{\n  \"FunctionName\": {\n    \"ENVIRONMENT_VARIABLE_NAME\": \"value\"\n  }\n}\n```\n\nFor example, to set the `QUARKUS_LAMBDA_HANDLER` to use the \"test\" handler:\n\n```json\n{\n  \"QuarkusLambda\": {\n    \"QUARKUS_LAMBDA_HANDLER\": \"test\"\n  }\n}\n```\n\nYou can also specify environment variables directly on the command line:\n\n```bash\nsam local invoke -t lambda-pom/quarkus-lambda/target/sam.jvm.yaml -e lambda-pom/quarkus-lambda/payload.json --parameter-overrides ParameterKey=QUARKUS_LAMBDA_HANDLER,ParameterValue=test\n```\n\n### Testing Directly with AWS CLI\n\n```bash\naws lambda invoke outputjson --function-name quarkus-lambda-native --payload fileb://payload.json --profile yourProfileName\n```\n\nExpected output:\n```json\n{\n    \"StatusCode\": 200,\n    \"ExecutedVersion\": \"$LATEST\"\n}\n```\n\n## 📄 SAM Templates\n\nThis project includes SAM (Serverless Application Model) templates for different deployment scenarios. These templates define the Lambda function configuration and are used for both local testing and deployment.\n\n### JVM Mode Template\n\nThis template is used for deploying the Quarkus application in JVM mode, as shown earlier in the testing section.\n\n### Native Mode Template (Amazon Linux 2023)\n\nThis template is for deploying Quarkus native executables on Amazon Linux 2023 (x86_64 architecture):\n\n```yaml\nAWSTemplateFormatVersion: '2010-09-09'\nTransform: AWS::Serverless-2016-10-31\nDescription: AWS Serverless Quarkus Native (AL2023) - quarkus-amazon-lambda\nGlobals:\n  Api:\n    EndpointConfiguration: REGIONAL\n    BinaryMediaTypes:\n      - \"*/*\"\n\nResources:\n  QuarkusLambda:\n    Type: AWS::Serverless::Function\n    Properties:\n      Handler: not.used.in.provided.runtime\n      Runtime: provided.al2023\n      CodeUri: function.zip\n      MemorySize: 128\n      Timeout: 15\n      Policies: AWSLambdaBasicExecutionRole\n      Environment:\n        Variables:\n          DISABLE_SIGNAL_HANDLERS: true\n          QUARKUS_LAMBDA_HANDLER: test\n```\n\n### Native ARM64 Mode Template (Amazon Linux 2023)\n\nThis template is specialized for deploying Quarkus native executables on Amazon Linux 2023 with ARM64 architecture, which can provide better performance and cost efficiency on AWS Graviton processors:\n\n```yaml\nAWSTemplateFormatVersion: '2010-09-09'\nTransform: AWS::Serverless-2016-10-31\nDescription: AWS Serverless Quarkus Native ARM64 (AL2023) - quarkus-amazon-lambda\nGlobals:\n  Api:\n    EndpointConfiguration: REGIONAL\n    BinaryMediaTypes:\n      - \"*/*\"\n\nResources:\n  QuarkusLambda:\n    Type: AWS::Serverless::Function\n    Properties:\n      Handler: not.used.in.provided.runtime\n      Runtime: provided.al2023\n      Architectures:\n        - arm64\n      CodeUri: function.zip\n      MemorySize: 128\n      Timeout: 15\n      Policies: AWSLambdaBasicExecutionRole\n      Environment:\n        Variables:\n          DISABLE_SIGNAL_HANDLERS: true\n          QUARKUS_LAMBDA_HANDLER: test\n```\n\n### Testing with SAM Templates\n\nYou can use these templates for local testing with the SAM CLI:\n\n```bash\n# Test with JVM mode template\nsam local invoke -t lambda-pom/quarkus-lambda/target/sam.jvm.yaml -e lambda-pom/quarkus-lambda/payload.json\n\n# Test with native mode template\nsam local invoke -t lambda-pom/quarkus-lambda/target/sam.native.al2023.yaml -e lambda-pom/quarkus-lambda/payload.json\n\n# Test with native ARM64 mode template\nsam local invoke -t lambda-pom/quarkus-lambda/target/sam.native.al2023-arm.yaml -e lambda-pom/quarkus-lambda/payload.json\n```\n\n## 🔄 LocalStack Integration\n\nFor local development and testing, you can use LocalStack to emulate AWS services.\n\n### Starting LocalStack with Network\n\n```bash\nlocalstack start -d --network ls\n```\n\n### Getting the LocalStack IP\n\n```bash\ndocker inspect localstack-main | jq -r '.[0].NetworkSettings.Networks | to_entries | .[].value.IPAddress'\n```\n\n### Invoking Lambda with LocalStack\n\n```bash\nsamlocal local invoke -t target/sam.jvm.yaml -e payload.json --docker-network ls --add-host localhost.localstack.cloud:172.25.0.2\n```\n\n#### With Environment Variables\n\nYou can also pass environment variables when using LocalStack:\n\n```bash\nsamlocal local invoke -t target/sam.jvm.yaml -e payload.json --docker-network ls --add-host localhost.localstack.cloud:172.25.0.2 --env-vars lambda-pom/quarkus-lambda/env.json\n```\n\nOr directly on the command line:\n\n```bash\nsamlocal local invoke -t target/sam.jvm.yaml -e payload.json --docker-network ls --add-host localhost.localstack.cloud:172.25.0.2 --parameter-overrides ParameterKey=QUARKUS_LAMBDA_HANDLER,ParameterValue=test\n```\n\n## ⚙️ Configuration Options\n\n### Quarkus Lambda Handler\n\nYou can specify the Lambda handler using an environment variable:\n\n```bash\nQUARKUS_LAMBDA_HANDLER=s3 mvn install -DskipTests\n```\n\n### SAM Template for Dynamic Handler Selection\n\n```yaml\nAWSTemplateFormatVersion: '2010-09-09'\nTransform: AWS::Serverless-2016-10-31\nDescription: AWS Serverless Quarkus - quarkus-amazon-lambda-common-deployment\nGlobals:\n  Api:\n    EndpointConfiguration: REGIONAL\n    BinaryMediaTypes:\n      - \"*/*\"\n\nResources:\n  QuarkusLambda:\n    Type: AWS::Serverless::Function\n    Properties:\n      Handler: io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest\n      Runtime: java17\n      CodeUri: function.zip\n      MemorySize: 256\n      Timeout: 15\n      Policies: AWSLambdaBasicExecutionRole\n      Environment:\n        Variables:\n          QUARKUS_LAMBDA_HANDLER: test\n```\n\n### Environment Variables Override\n\n```json\n{\n  \"QuarkusLambda\": {\n    \"QUARKUS_LAMBDA_HANDLER\": \"test\"\n  }\n}\n```\n\n### Application Properties\n\n```properties\nquarkus.lambda.handler=${QUARKUS_LAMBDA_HANDLER:s3}\nquarkus.ssl.native=true\nquarkus.native.additional-build-args=--initialize-at-run-time=org.apache.http.impl.auth.NTLMEngineImpl\nquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.1.6.0-Final-java21-arm64\n```\n\n---\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiquetal%2Faws-cdk-lambda-quarkus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiquetal%2Faws-cdk-lambda-quarkus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiquetal%2Faws-cdk-lambda-quarkus/lists"}