Search code examples
pythonamazon-ec2bottle

Trouble accessing webservice from EC2 instance


I have a small bottle webservice running on EC2 virtual windows server i launched. I am able to access it on localhost or by using the IPV4 specified in the main method as below but I am not able to access it over internet from other computers. Please suggest me how to deal with this. I saw one similar question like this but the suggestions didnt work so am posting again. Apologies for that. Trying:http://172.31.30.244:8080/

@route('/')
def index():
    """ Display welcome & instruction messages """
    return "<p>Welcome to bottle powered server !</p> \
           <p>There are many ways to invoke the web service :\
       <ul><li>http://localhost:8080/in?s=type_your_string_here</li>\
       </ul>"

some code here for calculations

IN my Main method

if __name__ == '__main__':
    bottle.debug(True)
    run(host='172.31.30.244', port=8080,debug=True)

Solution

  • Ran bottle server on EC2 instance, opened a port 8083 and accessed using the fully_qualified_machine_name:8083 thank you for your suggestion on using the public DNS name. I was not opening the port properly which i later did using custom TCP under 'Add rule' for inbounds of EC2 instance