Would you like to have “Corretto” with that?

Mani
3 min readFeb 3, 2019

--

Yep, I would like to have Amazon Corretto with my Java app running on AWS Fargate ;-)

From https://aws.amazon.com/corretto/“Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK). Corretto comes with long-term support that will include performance enhancements and security fixes. Amazon runs Corretto internally on thousands of production services and Corretto is certified as compatible with the Java SE standard. With Corretto, you can develop and run Java applications on popular operating systems, including Linux, Windows, and macOS.”

Amazon Corretto is now generally available — https://aws.amazon.com/blogs/opensource/amazon-corretto-8-generally-available/

Java is close to my heart, I love the language and wanted to quickly spin an “hello world” app leveraging Spring Boot on the very popular AWS Fargate — which allows you to run Docker containers without having to manage servers or clusters ..

Here are the simple steps:

Step 1

I cloned the simple Spring boot app code available at https://spring.io/guides/gs/spring-boot-docker/ and added some minor changes to display a few Java system properties.

Application.Java
Dockerfile

Clone the https://github.com/spring-guides/gs-spring-boot-docker.git. Before building the code, replace Dockerfile (in the gs-spring-boot-docker/complete directory) and Application.java (at gs-spring-boot-docker/complete/src/main/java/hello) with the code at https://github.com/cmanikandan/fargate-corretto

Build the code using Maven or Gradle, I used Gradle.

./gradlew build

I did some local testing on Docker using the Dockerfile at gs-spring-boot-docker/complete

docker build -t fargate-corretto .

docker run -p 8080:8080 fargate-corretto

Step 2

Push the images to Amazon ECR and test it on AWS Fargate.

I used the simple third party, open source — Fargate CLI available at http://somanymachines.com/fargate/ to quickly deploy the container as a Fargate task.

At gs-spring-boot-docker/complete directory :

fargate task run web

fargate task ps web (to get the IP address of the running task)

Open the app running on this IP address and bingo, we get our Spring Boot App running on AWS Fargate, using the OpenJDK from Amazon Corretto !!

AWS Fargate app using the OpenJDK from Amazon Corretto

Make sure you delete the Fargate task after the testing is done

fargate task delete web

Enjoy running your Java apps using Amazon Corretto — no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK) — on the cloud or on your server/desktop/laptop running Linux or MacOS or Windows !!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mani
Mani

Written by Mani

Principal Solutions Architect at AWS India, and I blog/post about interesting stuff that I am curious about and which is relevant to developers & customers.

No responses yet

Write a response