Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Amplify use ssl certificate in spring boot backend for https

Tags:

I made a frontend in aws amplify and created a custom domain over amplify with route 53. Then I created a subdomain, for example api.domain.com for my spring boot backend rest api. The subdomain only uses http. For using it with https I need to specify:

server.ssl.key-store, server.ssl.key-store-password and server.ssl.keyAlias

In the documentation I found the following hint but I can't get access to the certificate on Amazon Certificate Manager (ACM): AWS Amplify Console generates a free HTTPS certificate on all pages and automatically activates it on all Route53 managed domains. The SSL certificate is generated by Amazon Certificate Manager and supports wildcard domains. ACM handles the complexity of creating and managing public SSL/TLS certificates for your AWS-based Web sites and applications. With the wildcard option, the main domain and all subdomains are covered by a single certificate.

So the question is, how to get access to the information I need to specify in spring boot?

like image 896
3r1c Avatar asked Aug 06 '20 14:08

3r1c


People also ask

Does backend need SSL?

Yes, you will need SSL for your backend. that is the important place where all the logic and data is being stored. On the front-end not so important, but if you are tackling with payment or any other confidential information yes, you do need it in front-end.

Does API gateway use https?

APIs built on Amazon API Gateway can accept any payloads sent over HTTPS for HTTP APIs, REST APIs, and WebSocket APIs.

Does API gateway do SSL termination?

An API gateway sits between clients and services. It acts as a reverse proxy, routing requests from clients to services. It may also perform various cross-cutting tasks such as authentication, SSL termination, and rate limiting. If you don't deploy a gateway, clients must send requests directly to front-end services.


1 Answers

Based on the comments.

The ACM certs can only be used on a load balancer, API gateway and CloudFront distribution. They can't be used on an EC2 instance.

There are two options to rectify the issue:

  • Add load balancer in front of your EC2 instance, a CloudFront distribution or proxy your API through API gateway. On these AWS services you can just install your ACM cert.
  • Setup SSL certificate on the instance itself. To do this you have to get a third party certificate. A popular choice is https://letsencrypt.org/ which provides free public certificates.
like image 58
Marcin Avatar answered Sep 27 '22 16:09

Marcin