kyiu
kyiu

Reputation: 1976

AWS Elastic Beanstalk (single instance) : how to enable HTTPS for a Spring Boot application?

I recently started exploring AWS and have successfully deployed a Spring Boot application on a single Elastic Beanstalk instance. As a next step, I'd like to have my application use HTTPS. Given that my app is packaged as a jar, I strictly followed this official documentation: Terminating HTTPS on EC2 instances running Java SE.

But my app still works with HTTP only. Did anybody managed to do so ? Any help or link to a working example would be appreciated.

Some technical details about my app: it's a Maven-based Spring Boot project. As explained in the doc, I've created the +.ebextensions+ folder with all the config files at the root of my project. I then used maven-antrun-plugin to include the .ebextensions folder in the jar file.

Thanks in advance for your answers.

Upvotes: 0

Views: 555

Answers (1)

Marcin
Marcin

Reputation: 238051

Its likely that you are using current version of EB, which is for Amazon Linux 2 (AL2); not stated in the question what is used. The tutorial you've linked uses old version of the EB, which is for Amazon Linux 1 (AL1).

Subsequently, it will not work. Specifically, the nginx settings from the tutorial (.ebextensions/nginx/conf.d/ and .ebextensions/nginx/conf.d/https.conf) will be ignored. The reason is that for AL2, the nginx settings should be provided using .platform/nginx/conf.d and .platform/nginx/nginx.conf.

Also please be aware that there are many differences between AL1 and AL2 in EB, and more changes may be required in the tutorial to make it work on AL2:

Since its not explicitly stated in your question, which version of EB are you using, if this is indeed AL2, you could try running your app using old version of AL1. This at least would enable you to confirm that it actually works. Then you could think of how to port it to AL2.

Upvotes: 1

Related Questions