AWS Classroom Series – 24/Aug/2021

Public and Private Subnets

  • So far, we have create a network and a internet gateway, we have created a route from default route table to internet gateway Preview
  • So AWS allows us to create route tables in vpc.
  • Subnets can be associated with route tables
  • Lets create two route tables Preview Preview
  • Route table which has route to internet gateway is public. Preview
  • If we have not associated subnets to a specific route table, then by default they will use default route table (main yes)
  • This can be changed when we add explicit associations to the route table Preview Preview
  • A subnet is considered as private if it does not have route to internet gateway and is considered as public if it has route to internet gateway.So in our case
    • subnet1 and subnet 2 are public
    • subnet3 and subnet 4 are private
  • Lets create
    • one ec2 instance in public subnet with public ip address Preview Preview
    • one ec2 instance in private subnet with only private ip address Preview Preview
  • Lets ssh
    • into ec2 instance in public subnet Preview
    • We cannot directly access ec2 in private subnet, we can use ec2 in public subnet to connect to ec2 in private subnet (bastion host)
  • Now lets see if the machine in private subnet gets internet access (no)
  • In many cases, we would require machines in private subnet to access internet for security updates, software installations etc. But we donot want machines in private subnet to be accessed from internet in any case.

Network Address Translation

  • Basic NAT Preview

  • Now if we can some how implement NAT in our VPC then our private subnets can access internet Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Widget by Acurax Small Business Website Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube