You can control the security to your VPC in two ways:
Security Groups : It acts as a virtual firewall for associated EC2 instances that control both inbound and outbound traffic at the instance level.
Network access control lists (NACL) : It acts as a firewall for associated subnets that control both inbound and outbound traffic at the subnet level.