EC2中服务器的API GateWay [英] API GateWay to server in ec2

查看:165
本文介绍了EC2中服务器的API GateWay的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道API GateWay是否有可能将数据发送到特定的EC2实例(我的服务器)?

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

我的服务器(在Java中运行代码)应如何从网关获取数据?

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

谢谢你, 没事.

推荐答案

顾名思义,API网关只是您实际业务逻辑的网关. API网关无法在其上运行业务逻辑代码.您必须将API网关与一个集成点集成在一起.该集成点可以是另一个HTTP终端节点(REST服务),另一个AWS服务或Lambda函数.

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.

因此,要满足您的要求,您可以做的是使用要在EC2实例中执行的逻辑来托管REST服务.您可以通过API网关集成在EC2中托管的服务. API网关将为您生成一个HTTP终结点,该终结点又调用您在EC2中托管的服务.您应该与外界共享的API端点将仅是API网关生成的端点.请注意,您应该为您在EC2实例中托管的服务添加足够的安全性,以免被直接调用.请参阅下面的其他集成API网关,

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,

这篇关于EC2中服务器的API GateWay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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