S A R
S A R

Reputation: 229

AWS change primary public IPv4 for an NAT Gateway

I'm having an private subnet and a NAT gateway connected to it. The NAT gateway has its own primary public IPv4 assigned by default while creating.

I have an EC2 inside the private subnet which is trying to connect to an 3rd party service provider to get some data and our IP address needs to be whitelisted in their systems. For that I have already created an Elastic IP and whitelisted with the 3rd party service provider.

Since the NAT gateway created its own primary public IPv4 address, is it possible to remove that and add the whitelisted IP address to the NAT gateway?

Upvotes: 3

Views: 3577

Answers (1)

Abraam Magued
Abraam Magued

Reputation: 716

In the direct way, you cannot. You cannot change primary IP of your NatGatway after creating it, instead you can add a secondary one.

So to address your issue of whitelisting, You have one of 2 options:

  • You can create a new natgateway: When you create the NATGW, you have the option to choose a specific EIP allocation; and so you can use the EIP you whitelisted the other end.

  • (If deleting and recreating is not an option): You can add a secondary IP to your NATGW, and associate with the needed EIP you want to associate: In that case, probably you will need to whitelist both IPs: The one created by default, and the latter you added. So basically, not what you need, as you would need to whitelist the original one as well.

Upvotes: 3

Related Questions