Skip to content

EC2 Networking

ENI

  • Have a MAC address
    • Have a primary IPV4 address. DNS name is of format ip-<ip address>-ec2.internal
  • Zero or more secondary IPs
  • Zero or 1 public IPV4 address. This is dynamic address which changes if you start and stop an instance, DNS name is of format ec2-<public ip address>-compute-1.amazonaws.com. Inside VPC this dns resolves to private address, outside vpc it resolves to public address.
  • 1 elastic IP address per private IPV4 address. An elastic ip once assigned to primary ENI, removes any public IPV4 address present. If you remove the elastic IP, a new public IP address is assigned.
  • Elastic IP address are public IPV4 addresses per private IP address
  • Zero or 1 IPV6 address
  • Security grousp
  • Source or Destination check. Needs to be disabled if instance has to work as NAT instance
  • For licensing purposes attach license to secondary ENI and its MAC address. This way this ENI when attached to a different instance, moves the license seamlessly to new instance.
  • If you need different security groups for different IPs, use multiple ENIs as security groups are attached to ENI and not instance
    • OS never sees IPV4 public address

Placement Groups

  • Cluster
    • Instances launched closest possible
    • AWS tries to place them on same host or same rack
    • Better if instances are of same type and are all launched together
    • Only supported instance types can be used
    • Can't span AZs, can span VPC peers but at significant performance penalty
  • Spread
    • As much isolation as possible for resilience and uptime
    • Can be placed in different AZs, on different racks
    • Limit of 7 instances per AZ
  • Partition
    • More than 7 instances per AZ but still need to be spread out
    • Instances divided partitions ..7 max per AZ
    • Each partition has its own rack
    • Any number of instances can be launched in a partition
    • Useful for very large scale infra

Enhanced Networking

  • Uses SR - IOV - NIC is virtualization aware

EBS Optimized

  • Historically same network was shared for data and EBS
  • EBS optimized makes dedicated network capacity available for EBS