Is possible to use Amazon Elastic Beanstalk with SSL (HTTPS) without a Load Balancer?

别来无恙 提交于 2021-02-10 08:56:31

问题


From now on, my application needs a secure connection (HTTPS). I verify that most of tutorials for adding secure connections (https) on Amazon Web Services Elastic Beanstalk uses the Elastic Load Balancer as a tunnel.

In my case I'm running a single instance, in fact I don't need a Load Balancer. How can I add a secure connection to my instance without a Elastic Load Balancer? Is that possible?

I am using 64bit Amazon Linux 2017.03 v2.4.4 running PHP 7.0 Elastic Beanstalk.


回答1:


That is definitely possible. Here is an example from AWS using Apache.

The basic steps are:

  1. Enable SSL on the server
  2. Get a certificate authority (CA) signed certificate. For testing purposes you can create a self signed cert. Here is an example of how to do that using openssl.



回答2:


Edit

You can also use CloudFront for this. This will also allow you to use certification from Certification Manager. Just remember to create them in N-Virginia region.

WARNING

The data between CloudFront and Elastic Beanstalk is still going to be exchanged over http as your container doesn't support https.

You also need to change the following settings:

  • Under Allowed HTTP Methods you need to selected at least GET, HEAD, OPTIONS, but most likely you'll want also POST/PUT

  • You don't want CloudFront to cache your results, so you'll need to set the Cache Policy to Managed-CachingDisabled

  • You also want your all the request's headers, cookies & query strings to be passed on to the Origin i.e. your Elastic BeanStalk Container. To do so you need to set the Origin Request Policy to Managed-AllViewer




回答3:


https can be configured without a load balancer using a proxy server which is your case (php with Amazon Linux 2+) should be nginx. I have created a gist for configuring https in EBS and it fits in Free Tier 🎉🎉🎉 but for java. You can see more examples here but first find what proxy server you are using(apache or nginx) as the configuration varies accordingly. For more info see Reverse proxy configuration



来源:https://stackoverflow.com/questions/46308909/is-possible-to-use-amazon-elastic-beanstalk-with-ssl-https-without-a-load-bala

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!