AWS NewConnectionError urlib on EC2

Viewed 60

I'm working on the backend. After completing the test in the local environment, it was uploaded to EC2 and operated as a docker.

Other parts work well, but only the part that brings the url does not work.

I got a elastic ip and connected it.

My Docker Log

Max retries exceeded with url: /features/2040000/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc33a10d160>: Failed to establish a new connection: [Errno 110] Connection timed out'))

I opened the firewall only to my address from the outside and it worked Local, but it does not work in a cloud environment.

This is the beginning of my code

def test(custnum: str, status: int):
    
    URL = url_test
    
    
    URL = URL + str(custnum) + "/"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0",
        "Accept-Encoding": "*",
        "Connection": "keep-alive"
    }
    
    try :
        response = requests.get(URL, headers=headers)
        if response.status_code == 200:
            res = json.loads(response.content.decode('utf-8'))
            

Is there anything else I should do other than this as I open the inbound through the security group? Or am I doing something wrong?

First of all, thank you for your help.

0 Answers
Related