I'm new to AWS, and I have an instance on EC2 that I would like to restrict to just the IPs in my home network. What is the difference between the subnets and security groups that are associated with a VPC? From my understanding, it is the security group that does the IP address permissions but I'm not too sure what the subnet accomplishes.
Also, how does the network ACL play into this?
https://i.stack.imgur.com/4KYWT.png
Do I specify the allowed IP addresses in source?
EDIT: VPN information
After thinking about it, instead of whitelisting certain external IP addresses, I wanted to make the EC2 instance only accessible when connected with a VPN. So even computers on my home network wouldn't be able to access unless using a VPN. Would this require me to set up a OpenVPN server on EC2 that would access a private subnet?
Also, the EC2 instance would require accessing the internet, would that mean it is under a public subnet instead?
Thanks!