# What is a VPC

VPC = Virtual Privat Cloud

* This is an instance that can be deployed to a region over multiple availability zones
* It kind of acts like a private network that contains multiple subnets
* The great thing about it is that it is private and secure
* The resources can communicate between subnets but they do not communicate outside of the subnet

<figure><img src="https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FQCObMgHfn2f243io9M8G%2Fimage.png?alt=media&#x26;token=ee7bcfa4-8322-41a0-bd91-292a032fd828" alt=""><figcaption></figcaption></figure>

* To be able to serve the app to the internet (let's say it's a webapp) we can add the private subnets `10.0.1.0/24` and `10.0.4.0/24` to a <mark style="color:orange;">`internet gateway`</mark>&#x20;
* The now public subnets with the load balancer resources are reachable from the internet but they are still able to communicate with the other subnets in the VPC

#### Simple infrastructure for a basic secure app:

* Create subnet that is connected to a Internet gateway and has something like Nginx deployed to it
* Create another subnet where you would add the webapps
* Create another subnet where you would add the databases
* Note that all the deployed resources communicate with each other&#x20;

#### So how would traffic go?

* Our internet gateway allows HTTPS connections on port 443 to server `10.0.1.10` which hosts Nginx

Nginx Server --> Forward traffic to webapp --> webapp connects to database, also processes the request and returns data to Nginx --> Nginx servers the result to the end user
