I have two AWS EC2 instances namely EC2A
and EC2B
. Both instances;
EC2A has both public IP and private IP, while EC2B has private IP only. I am able to login to EC2A from my desktop but not to EC2B since it doesn't have a public IP, but it is possible to SSH into EC2B from EC2A.
I am able to update and install YUM packages in EC2A, but not in EC2B (since there is no internet). I have whitelisted IP of EC2A for ports 80 and 443 in security group attached to EC2B.
Is there any way to make use of internet in EC2A for installing YUM packages or to access internet in EC2B by making use of internet in EC2A? How can I achieve this?
With your current architecture, no it would not be possible.
While you could configure your 'public' instance as a NAT instance, that would require the 'private' instance to be in a separate subnet, with a Route Table entry that directs all traffic to the 'public' instance.
The normal setup for a public and private instance would be: