Hello, how are you?
I've read your description and here is my opinion.
When restart EC2 instance, IP address is changed.
To avoid this, we should purchase Elastic IP address and allocate this IP address to EC2 instance.
That's all.
If you have more questions, feel free to ask me.
Best regards, Peng.