In our current VPC we are using and ASG and ALB. We have some public subnets and some private subnets. We would like to be able to connect from time to time, those private subnets to pull some patches out of the internet.
Is my understand that the NAT Gateway requires an EIP. The EIP does not seem to be able to play with the ASG, since it spect an instance/IP. Not sure if the ASG is able to link an EC2 ( can be terminated ) to the EIP.
What changes shall I make to allow those private subnets to access internet, considering my constrains?
This is really an AWS questions rather than anything specifically to do with Terraform, so the documentation and discussion groups they host might be the best option.
Having said that, yes a NAT gateway would have a public IP address associated to allow access from the private subnet to the Internet. An ALB in the public subnet would also have a public IP address to allow access from the Internet.
The fact you are using an ASG has nothing to do with this (unless you are trying to associate an EIP directly with an EC2 instances, but you are talking about NAT & ALBs). You would setup a NAT gateway (or ideally multiple spread over different AZ for HA) to connect the private subnet to the Internet, an internet gateway in the public subnet and an ALB in the public subnet. You’d then have an ASG that creates multiple EC2 instances as required, with access inwards via the ALB and outwards via the NAT gateway.