I have an EC2 instance in a public subnet and I assigned an EIP to the instance and the IP address is Whitelisted to reach my company's network. The Instance must have a public IP address but I don't want to use EIP here. Whenever I restart the server the IP address is changing so I thought If I create a NAT Gateway and arrange the routeing table to use connect my company's network but when I do that I cannot reach the instance. NAT Gateway for the private network for but is there a way to set a static IP address to reach some places?
Default settings for the route table
Setting use NAT Gateway by default access did not work
Adding a new route for the company network did not work
To have a static IP address within AWS, you must use an Elastic IP. Even if you use a NAT Gateway, it consumes an EIP.
From the docs: