Restrict HTTP Access to Elastic Beanstalk

两盒软妹~` 提交于 2019-12-01 05:36:31

I have restricted HTTP access to an Elastic Beanstalk application to only certain IP addresses.
Following is my procedure.

  1. Create new beanstalk environment in the VPC(Amazon Virtual Private Cloud).
    Please read following documents.
    Using AWS Elastic Beanstalk with Amazon VPC
    Example: Launching an AWS Elastic Beanstalk Application in a VPC
    note: I tried to create a new beanstalk environment(Tomcat) in the VPC using AWS Tookit for Eclipse last month. But I could not create a new beanstalk environment due to the bug of AWS Toolkit for Eclipse. Finally, I could create a new beanstalk environment using a elastic-beanstalk-create-environment command. Therefore I recommend to use elastic-beanstalk-create-environment command.

  2. Create a new Network ACL(VPC's function) and open the inbound tab and configure to restrict source IP addresses. Set this Network ACL to the subnet of VPC which have a beanstalk's ELB.

I was able to limit access to folders with the following X-FORWARDED restrictions:

<Directory "/var/www/html/folder_name">
    SetEnvIf X-FORWARDED-FOR x.x.x.x allow
    SetEnvIf X-FORWARDED-FOR a.a.a.a allow
    Order deny,allow
    Deny from all
    Allow from env=allow
</Directory>

This was done in the httpd.conf file, but I'm hoping it will also work in an .htaccess file. However, I'm supposedly not using an ELB, just a single instance and what ever load-balancing AWS may or may not already implement.

Hope this helps.

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