Graal Cloud Native (GCN) is a build of a curated set of Micronaut®
framework modules and their required libraries for building portable cloud native microservices that take
full advantage of powerful cloud platform services and that can be compiled ahead-of-time by GraalVM Native Image.
GCN also provides project creation utilities and VS Code extensions for application development and deployment.
The modules provide platform-independent support for a set of core cloud services including object storage,
secret management, streaming, tracing, and more.
This guide walks you through the steps to successfully create, build, test and deploy a cloud native application to Oracle Cloud Infrastructure,
Amazon Web Services (AWS), and Google Cloud Platform (GCP).
We showcase these capabilities by building a Java application which accesses cloud object storage in a vendor-independent way.
Java Framework Experience
You have a basic understanding of Java microservice frameworks such as Micronaut, Helidon, Spring Boot, or Quarkus.
This guide describes how to create a Micronaut
application that runs natively on Oracle Cloud Infrastructure, Amazon Web Services, and Google Cloud Platform without
any source code changes.
The application demonstrates how to store and retrieve user profile pictures in Oracle Cloud Infrastructure, Amazon Web Services and Google Cloud Platform Object Storage using
the Micronaut Object Storage API.
Windows platform: The GCN guides are compatible with Gradle only. Maven support is coming soon.
Create a new project using the following selections. (Alternatively, use these shortcuts for Maven
Project Type: Application (Default)
Project name: GettingStarted
Base Package: com.example (Default)
Clouds: AWS, GCPandOCI
Language: Java (Default)
Build Tool: Gradle (Groovy) or Maven
Test Framework: JUnit (Default)
Java Version: 17 (Default)
Micronaut Version: (Default)
Cloud Services: Object Storage
Features: GraalVM Native Image (Default)
Sample Code: Yes (Default)
Click Generate Project and then click
Download Zip. The GCN Launcher creates an application with
the default package com.example in a directory named GettingStarted. The application ZIP
file will be downloaded to your default downloads directory. Unzip it, open it in Visual Studio (VS) Code, and
proceed to the next steps.
The GCN Launcher creates the following sample source code files that use the Micronaut
Object Storage API to create, read, and delete objects in the major cloud providers:
an interface describing the endpoints of the "profile pictures" microservice:
4. Build a Native Executable of Your Application with GraalVM
To build a native executable of your application, you should install GraalVM with Native Image. Once your local
environment is setup, use the command below to build a native executable. Then run it and test it as above.
Using the OCI DevOps Resources in VS Code,
you can easily deploy a Java application to Oracle Cloud Infrastructure, make source code changes,
push them into the Oracle Cloud Infrastructure Git repository, and then trigger the build of a container image with
your native executable or a container image with JVM using the predefined Oracle Cloud Infrastructure Build Pipelines.
With your AWS account ready and access to EKS configured, simply invoke command:
./mvnw deploy -Dpackaging=docker-native -pl aws
This will build a native executable, package it as a container image and push the container image to the correct Amazon Web Services container registry.
When you setup your Kubernetes deployment for Amazon Web Services EKS, simply invoke the command:
With your GCP account ready and access to GKE configured, simply invoke command:
./mvnw deploy -Dpackaging=docker-native -pl gcp
This will build a native executable, package it as a container image and push the container image to the correct Google container registry.
When you setup your Kubernetes deployment for GKE, simply invoke the command:
kubectl apply -f deployment.yml
7. Developing the Application in VS Code
Develop Java applications in VS Code with Graal Cloud Native support.
It offers help in the
form of relevant code completion suggestions when editing GCN specific configuration files.
Java language support speeds up development of Java code with hints, etc.
When developing database applications, the GCN tooling provides advanced database related
code completion for find… () methods:
It offers the SQL code completion in @Query annotations among others, and so on.
GCN provides easy step-by-step guides, and companion sample applications,
for the developer to learn how to use a specific cloud service (such as Micronaut Data).
Browse the GCN site for list of modules and guides to learn more.