Reputation: 39
I host 2 different flask applications with docker on EC2. One of them is running at port 80 and the other at port 5000.
My question is; Can I get a separate elastic ip for port 80 and a separate elastic ip address for port 5000 on AWS? Because if I don't get separate ip for these, I'm having problems with domain redirecting.
Upvotes: 0
Views: 830
Reputation: 2123
No need to create and attach another NIC, you can assgin two IPs to the same interface:
See the following link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/MultipleIP.html
After the discussion in comments, you should be binding to 0.0.0.0 if you want the container to be accessible from outside. If you have:
if __name__ == '__main__':
app.run()
Change it to, in your both flask app
if __name__ == '__main__':
app.run(host='0.0.0.0')
Upvotes: 2
Reputation: 1016
Yes, you just need multiple ENI https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html
Upvotes: 2