Easy Spring Boot Deployment With AWS Elastic Beanstalk

Easy Spring Boot Deployment With AWS Elastic Beanstalk

Find out how easy it is to secure and deploy your Spring Boot app with AWS Elastic Beanstalk.


Hello, thanks for this great tutorial. I managed to make the app work on AWS, however I have an issue on my localhost: it is still showing me the spring login page (even though the same code works on AWS…). I imagine that it is a problem with my environment variables. My computer is running ubuntu 18.04, and I have set the environment variables as you have shown, using the terminal with command export OKTA_OAUTH2_CLIENT_SECRET=secret, and when I run the echo $ command it works, however the app does not run properly on my localhost and I keep seeing the spring login page with an automatically generated password (just like in your first step). Do you have any advice on how I could resolve it? Thank you!

Matt Raible

If you’re seeing the default Spring login page, it usually means the Okta properties aren’t set for our Spring Boot starter. Make sure you have the issuer and client ID set as well.

Teo Meyerhog

Why don’t you clearly explain where to put the HelloWorldController class? This article has been a huge time waster because I don’t even know where to put the file.

Matt Raible

You can look at the repository for this blog post on GitHub at https://github.com/oktadeveloper/spring-aws-elastic-beanstalk. The HelloWorldController is in the com.okta.helloworld.controller package.

Narmada Nayunipati

Hi, I have managed to create EBS with this JAR and chaged the port to 5000 after 502 error encountered. After that, it giving me below error. Please help

2020/03/07 07:39:11 [error] 3271#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client:, server: , request: “GET / HTTP/1.1”, upstream: “”, host: "helloworld-env.eba-mghqv7mf…"
2020/03/07 07:39:12 [error] 3271#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client:, server: , request: “GET /favicon.ico HTTP/1.1”, upstream: “”, host: “helloworld-env.eba-mghqv7mf…”, referrer: “http://helloworld-env.eba-m…

Narmada Nayunipati

Its working now. I need to append /hello to EBS URL

Mahendra P

It’s a very useful article. I have created a self signed certificate and added in Springboot application and default port is 8082 which is https and diverted to 8082 if someone hit url on 8080. I have made a war file but when i deploy on elastic beanstalk , by default aws generates different url and it works like http but doesn’t work on https. Can you please give me some steps to make it working on https ?

Ayoade A. Joseph

Thanks so much Daniel for this simplified tutorial. I got it working using Simple Spring Authentication both locally and on AWS, however, I could not get it to work with Okta… I keep getting this “too many redirects” error and "clear cookie’ from all my browsers. On eclipse console, it says it throws a url exception. I have checked the environment variables over and over again, also my secret and id, cleared cookies. Still the same…
But thanks a lot, this is my first AWS beanstalk application.


Hello, I’ve followed the directions however when uploading onto elastic beanstalk my application seems to not be connecting to the rds and is there anyway to resolve this issue? is it because the server port is set to 5000?

Matt Raible

I’ve seen this happen when my client ID or issuer was incorrect. Does your issuer ending in “/oauth2/default”?

Ranielle Canlas

Okta Login is giving me “Bad Credentials” error during login, I already created a new user and reset the password, etc. It can’t authenticate a user.

Matt Raible

You should be able to click “Need help signing in?” at the bottom of the login form. That has a link to reset your password. If you’re certain you’re entering it correctly, you might want to contact developers@okta.com to have them look at your account.