API GateWay to server in ec2

我与影子孤独终老i 提交于 2019-12-12 04:47:54

问题


I wanted to know if it possible that API GateWay sends data to a specific EC2 instance (my server)?

And how my server (that run codes in java) should get the data from the gateway?

Thank you, Nofar.


回答1:


As the name indicates API gateway is just a gateway to your actual business logic. API gateway cannot run business logic code on it's on. You have to integrate API gateway with an integration point. This integration point can be another HTTP endpoint (REST service), another AWS service or a Lambda function.

So to achieve your requirement what you can do is to host a REST service with the logic you want to execute in your EC2 instance. You can integrate the service you hosted in EC2 via API gateway. API gateway will generate an HTTP endpoint for you, which in turn call the service you hosted in EC2. The API endpoint you should share to the outside world would be the end point generated by API gateway only. Please note you should add enough security to the service you hosted in EC2 instance for not get called directly. Please see below the different integration API gateway has,



来源:https://stackoverflow.com/questions/46468251/api-gateway-to-server-in-ec2

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