Setting up a GraalVM Native Image project for the AWS SDK for Java - AWS SDK for Java
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.

At Amazon Web Services (AWS), we’re focused on finding ways to improve our products and provide a better customer experience. To do that, we need your feedback. Please take 5 minutes of your time to share insights regarding your experience with Java Spring and your need for Spring integration with AWS.

Click here to take a quick survey

This survey is hosted by an external company (Qualtrics), so the link above does not lead to our website. Please note that AWS will own the data gathered via this survey, and will not share the information/results collected with survey respondents. AWS handles your information as described in the AWS Privacy Notice.

Setting up a GraalVM Native Image project for the AWS SDK for Java

With versions 2.16.1 and later, the AWS SDK for Java provides out-of-the-box support for GraalVM Native Image applications. Use the archetype-app-quickstart Maven archetype to set up a project with built-in native image support.


Create a project using the archetype

To create a Maven project with built-in native image support, in a terminal or command prompt window, use the following command.


Replace com.example.mynativeimageapp with the full package namespace of your application. Also replace mynativeimageapp with your project name. This becomes the name of the directory for your project.

mvn archetype:generate \ \ -DarchetypeArtifactId=archetype-app-quickstart \ -DarchetypeVersion=2.16.1 \ -DnativeImage=true \ -DhttpClient=apache-client \ -Dservice=s3 \ -DgroupId=com.example.mynativeimageapp \ -DartifactId=mynativeimageapp \ -DinteractiveMode=false

This command creates a Maven project configured with dependencies for the AWS SDK for Java, Amazon S3, and the ApacheHttpClient HTTP client. It also includes a dependency for the GraalVM Native Image Maven plugin, so that you can build native images using Maven.

To include dependencies for a different Amazon Web Services, set the value of the -Dservice parameter to the artifict ID of that service. For example, dynamodb, iam, pinpoint, etc. For a complete list of artifact IDs, see the list of managed dependencies for on Maven Central.

To use an asynchronous HTTP client, set the -DhttpClient parameter to netty-nio-client. To use UrlConnectionHttpClient as the synchronous HTTP client instead of apache-client, set the -DhttpClient parameter to url-connection-client.

Build a native image

After you create the project, run the following command from your project directory, for example, mynativeimageapp:

mvn package -P native-image

This creates a native image application in the target directory, for example, target/mynativeimageapp.