Amazon AWS EC2,允许入站http请求 [英] Amazon AWS EC2, Allow inbound http Request

查看:246
本文介绍了Amazon AWS EC2,允许入站http请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在AWS EC2实例中部署了一个nodejs应用程序.它具有带有"/api/companies"端点的API网关.启动服务器后,我可以从实例终端进行cURL调用,并且它可以正确返回结果.但是我无法从浏览器向EC2实例发出请求.我不确定如何修改入站规则以使其正常工作

I have deployed a nodejs application in AWS EC2 instance. It has API gateway with '/api/companies' endpoint. After starting my server I am able to cURL from the instance terminal and it returns the result correctly. But I am not able to make the request from my browser to the EC2 instance. I am not sure exactly how to modify the inbound rules to make this work

推荐答案

您可能想查看

You might want to check out the Security Group Rules documentation, but the gist is:

  1. 在VPC中为EC2实例创建一个新的安全组
  2. 在入站规则"中,创建一个新规则
  3. 将源"设置为您的IP地址. (可选,如果要允许从任何IP地址访问,请在源中输入0.0.0.0/0)
  4. 将协议设置为tcp,并将端口设置为80443,具体取决于您的应用程序使用什么
  1. Create a new Security Group in your VPC for your EC2 instance
  2. In the Inbound rules, create a new rule
  3. Set the Source to your IP address. (Optional, if you want to allow access from any IP address, enter 0.0.0.0/0 in the Source)
  4. Set the Protocol to tcp, and set the Port to 80 or 443 depending on what your application uses

这篇关于Amazon AWS EC2,允许入站http请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆