In addition to allowing access to port 5000 via the Security Group, you also need to ensure that your app is listening on an IP which can accept TCP connections from outside. To listen on all IPs, in your app, use:
if __name__ == '__main__':
app.run(host='0.0.0.0', debug = False)
Instead of:
if __name__ == '__main__':
app.run(host='127.0.0.1', debug = False)
To see what address your application is listening on, you can run this command:
netstat -an | grep :5000
After making these changes, you will want to restart your Flask application.
I'm assuming you're just using this for development and testing, since you're keeping it on port 5000
, but, when you're ready to deploy your application into production, you need to put it behind a real webserver. I would recommend using nginx with uWSGI. Here is a guide to configuring Flask + nginx + uWSGI, and here is the official documentation from Flask on the subject.