I'm sure this question was asked before and there a number of documentations from AWS but it seems not working for me. But cannot find a straight answer to my question, so asking here again.
I have a bunch of EC2 instances in the private subnet, where I don't need and in-comning connectivity from internet but need outgoing for apt-get update etc. So, if I do the followings:
- Create a subnet and an EIP
- then create a NAT gateway, utilizing those two
- then create a route-table with:
- destination 0.0.0.0/0 => NAT-Gateway (target)
- associate the subnet (above)
- spin up instances in the above subnet
should give that instance the outbound only connectivity? Anything I'm missing or doing wrong here? Thanks in advance!!
-S
It's close but not quite correct :)
To make it work you need two subnets and two route tables.
Public subnet
0.0.0.0/0
points to the IGW (not to the NAT gateway!)Private subnet
0.0.0.0/0
points to the NAT in the public subnet aboveHope that explains it :)