简体   繁体   中英

How can I use an EC2 ip address in API Gateway?

I have a Flask API that I am serving with Gunicorn on an EC2 instance, I am trying to use AWS API Gateway to connect my endpoints but I get an error when trying to use the ip of my EC2 instance for the endpoint url.

My endpoint looks like this ec2-xx-xxx-xx.eu-west-.compute.amazonaws.com:8080/scraper/run

在此处输入图片说明

You should consider 2 options:

  1. If your EC2 is publicly available you should check the HTTP Proxy integration part to delegate the integration request and response configuration to your Flask API oterwise you will have to configure it on your API Gateway.

If your EC2 is publicly available you should have an inbound rule 0.0.0.0/0 on it. If not I think your should consider option 2.

  1. In that case, your EC2 is not publicly available this means API Gateway will not communicate with your instance through internet but through a Private Link.

Look at this blog post to configure your VPC Endpoint and then restrict and secure your communication : https://aws.amazon.com/fr/blogs/compute/introducing-amazon-api-gateway-private-endpoints/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM