Connecting instances to the network

Once we have decided on the compute capacities of the instance, we need to select the network to connect the instance to. Instances are connected to the network by selecting the VPC and an appropriate subnet. We have taken a look at how to create a VPC in Chapter 4, Networking with Virtual Private Cloud. The selection of the VPC and subnet will determine the following:

  • The private IP addressing of the instance
  • The internet availability and public IP address of the instance
  • The availability zone in which the instance will be started

An instance network connection details will be determined upon creation of the instance. A MAC address will be assigned to the primary network interface of the instance and the DHCP service within the VPC subnet will assign an IP address to the instance from its pool of IP addresses. 

If we require more control over the networking configuration, we can use an additional Elastic Network Interface (ENI) to the EC2 instance. An additional ENI can be created and attached to an instance when the following conditions are satisfied:

  • We need to attach an instance to multiple subnets
  • We require an interface independent of instances life cycle
  • We require a fixed MAC address due to licensing purposes
  • We want to attach a specific Elastic IP to a specific private IP

For example, we have a specific instance that has some kind of software on it that is licensed to the MAC address of that instance. We wouldn't want to use the primary MAC because if the instance fails and we want to restore it from a snapshot or backup to a new instance, the metadata will not be maintained. This is when we can opt to use an ENI as the ENI can survive the instance failure and can be re-attached to the restored instance. The same applies to any kind of instance where we want to maintain a static relationship between an Elastic IP and an internal IP address, for example, a custom routing, NAT, or firewall instance within our environment.   

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.35.255