EC2 - IP Addresses Flashcards
What are the two main types of IP addresses used in AWS EC2 instances?
Public IP: Allows communication with the internet. It is globally unique and can change when an EC2 instance is stopped and started.
Private IP: Used within a private network. It is unique within the VPC but can be duplicated across different VPCs.
What is the difference between IPv4 and IPv6?
IPv4: The most common version, formatted as four sets of numbers (e.g., 192.168.1.1). It allows for 3.7 billion unique addresses.
IPv6: A newer version with long hexadecimal strings (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). It is designed to solve the limitations of IPv4 and is often used for IoT devices.
What is a Public IP and what is its primary use case in AWS?
A Public IP allows communication with the internet. When you assign a Public IP to an EC2 instance, the instance can be accessed globally. The IP must be unique across the internet.
What is a Private IP and when is it used in AWS?
A Private IP is used for communication within a private network, such as an AWS VPC. It is unique only within the VPC and can be the same in different VPCs. Instances with Private IPs communicate using NAT devices or VPN to reach the internet.
What is the main difference between Private and Public IPs?
Public IP: Accessible over the internet and must be unique globally.
Private IP: Accessible only within a private network (VPC), and can be reused in different private networks (e.g., different VPCs).
What happens to the Public IP when an EC2 instance is stopped and restarted?
The Public IP assigned to the EC2 instance is released when the instance is stopped and can change when restarted. The Private IP remains the same across stops and starts.
How do instances with Private IPs communicate with the internet in AWS?
Instances with Private IPs can access the internet through a NAT Gateway or NAT instance. These devices proxy the request and return traffic to the instances in the private network.
What is an Elastic IP (EIP) in AWS and when is it used?
An Elastic IP is a static, public IPv4 address that you can own. Unlike regular Public IPs, Elastic IPs do not change when an EC2 instance is stopped or restarted. They are used when you need a fixed public IP that doesn’t change.
What are the limitations of using Elastic IPs?
You can only have five Elastic IPs by default per AWS account.
Elastic IPs are costly if they are not associated with a running instance (i.e., if they are unused, you will incur charges).
Elastic IPs should be used sparingly as they are considered poor architectural practice. A better approach is to use DNS or a Load Balancer instead.