== Public IPs ==
You can assign AWS automatically assigns a public IP to one oyur VMs from its pool of your VMsaddresses. These are dynamic. Since Every time you don't own any: shut down your only option here is to use an '''Elastic IP'''. These are owned by Amazon, VM and Amazon turn it back on: it will let you use them for freeget a new public IP.
Interestingly they're free when you use them, but cost money if you don't use them. That's because there's a limited pool of public IPv4 addresses, and once you request one of these addresses: noone else can use it. So you better use it, or pay for it. Since our VMs are going to be shut down most of the time: this is one of the costs that will come out of your 100$ credit. Also note Note if you look inside a VM: the public IP isn't actually configured as the IP on that interface. The IP is assigned to your VPC, and incoming connections to it are port-forwarded to the VM which you assigned the IP to. This is very different from what you saw in your previous courses.
[[File:AWSIPs.png|800px|border|center]]
You may have configured port forwarding on your router at home at some point to enable some game or service which requires an open port on your public IP address. This is the same idea. On AWS this port forwarding is done via the Internet Gateway.
* Default dynamic public IP== Static IPs == * Default Private IPs don't cost any money, so they are static by default. AWS has a DHCP system where you can reserve a static address from your private network/pool for your VM. If you do: the VM will automatically get that static IPfrom an AWS-configured DHCP server. If you don't: the VM will get an unused IP from the same subnet, and will continue using that dynamically-assigned address even after it reboots. * Reserving You can also assign a static public IP under "to one of your VMs. You could use your own but since you don't own any: your only option here is to use an '''Elastic IP'''. This comes from the same pool of addresses as the dynamic AWS public IPs". Interestingly Elastic IPs are free when you use them, but cost money if you don't use them. That's because there's a limited pool of doing public IPv4 addresses, and once you request one of these addresses: noone else can use it. So you better use it, or pay for keeping it from other users. Since our VMs are going to be shut down most of the time: this is one of the costs thatwill come out of your 100$ credit.
* VPC dashboard:
** https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html