Openshift and AWS Lambda Deployment With Quarkus
Nowadays Quarkus is known as Supersonic Subatomic Java. It provides a lot of features to facilitate build and deployment.
Join the DZone community and get the full member experience.Join For Free
Nowadays Quarkus is known as Supersonic Subatomic Java. It provides a lot of features to facilitate build and deployment. To did my best by creating a small blog application with quarkus with installed features: rest-client, security, spring-data-jpa, smallrye-health and openapi, Kubernetes, and AWS deployment to tried it real.
- JDK 11— for running app
- Gradle 6+ — for packaging
- OpenShift CLI — for deploying on OpenShift
- AWS CLI, AWS SAM CLI — for deploying AWS Lambda
Quarkus provides extensions for building (and pushing) container images. Currently, it supports Jib, S2I, Docker.
To working with Docker containerization add Gradle dependency:
Configure the docker image and remote registry in
Or override properties on Gradle command:
As it’s possible to create a multistage Dockerfile to avoid packaging:
To deploy on Openshift without Quarkus possible to define template.yaml:
By using docker containerization it’s also possible to deploy an application using image-stream from the docker registry.
But, Quarkus offers the ability to automatically generate Kubernetes resources. It currently supports generating resources for Kubernetes, OpenShift, and Knative.
To enable the generation of necessary templates you need to include the target in
Optionally you could set up the custom configuration for your template:
After packaging quarkus generate target templates:
Deploy application via command:
oc create -f build/kubernetes/openshift.yml
Note: use only the last version of quarkus — 1.4.1.
Dependency for Gradle:
After packaging quarkus generate sam templates for AWS:
For deploying an application as an AWS Lambda use template from the build. For native build use template
I followed quarkus-documentation:
Note: For using Docker containerization you need to exclude
Note: To avoiding timeout error (502 — BAD GATEWAY) — increase
quarkus-amazon-lambda-httpdependency on jar packaging (packaging with the condition properties
Opinions expressed by DZone contributors are their own.