AWS 074: Elastic IP and network interfaces
The problem
A team uses Elastic IP and network interfaces as a label or Console setting without proving the identity, scope, behavior, failure boundary, cost, or operational result. The configuration appears complete but the real requirement remains untested.
Final outcome
The learner will inspect, explain, test, and document Elastic IP and network interfaces. The submission must connect the Console and CLI view to the same AWS control, state what the evidence proves, diagnose one likely failure, and make a requirement-based architecture decision.
Learning outcomes
You will be able to:
- explain an eni is a virtual network card;
- explain the primary eni has lifecycle limits;
- explain an elastic ip is static public ipv4;
- explain public ipv4 addresses are billable;
- explain private addresses belong to the eni;
- distinguish successful configuration from successful workload behavior;
- preserve redacted evidence and complete the stated cleanup or retention decision.
Mental model
requirement
-> identity and permission
-> account, Region, and resource scope
-> configuration or request
-> observable state
-> workload result
-> failure evidence
-> cleanup or controlled retention
Never begin with a create button or a copied command. Start with the result that must be proven and the boundary that must remain protected.
Core facts
| Concept | What it means in practice |
|---|---|
| An ENI is a virtual network card | An elastic network interface belongs to one subnet and Availability Zone and can carry primary and secondary private addresses, security groups, MAC address, source/destination check, and other attributes. |
| The primary ENI has lifecycle limits | The primary network interface is created with an EC2 instance and cannot be detached. Secondary interfaces can be attached or moved within supported same-AZ conditions. |
| An Elastic IP is static public IPv4 | It is allocated to an account in a Region and associated with a network interface or supported resource. Reassociation can move the public address during recovery. |
| Public IPv4 addresses are billable | AWS charges for public IPv4 addresses, including in-use addresses, under current pricing. Architecture should use them deliberately and check the current pricing page. |
| Private addresses belong to the ENI | Moving a secondary ENI can preserve its private addresses and security groups. Its subnet and Availability Zone do not change. |
| Source/destination checking is normally enabled | EC2 expects an instance to source or receive its own traffic. Disable the check for supported routing appliances such as a self-managed NAT instance. |
How to reason about it
Separate instance lifecycle from network identity. An ENI can hold stable private addresses and security groups, while an Elastic IP supplies a stable public IPv4 mapping. Managed load balancers, DNS failover, and Auto Scaling are often better recovery mechanisms than manually moving interfaces.
Use the following decision table as a starting point, then change the answer when the scenario changes.
| Requirement | Preferred direction | Why |
|---|---|---|
| One public IPv4 must move during appliance recovery | Reassociate an Elastic IP | The public address can follow the replacement supported target. |
| A self-managed appliance forwards packets | Secondary ENIs and disabled source/destination check | Ordinary EC2 checking would reject transit traffic. |
| Application tier scales horizontally | Load balancer and DNS rather than fixed Elastic IP per instance | Decouple clients from individual instance network identity. |
| Need two network segments on one appliance | Multiple ENIs in the same AZ | Each interface can use its subnet and security-group controls. |
Prerequisites, permissions, Region, and cost
Run this lesson as the approved non-root course identity. Begin with aws sts get-caller-identity, confirm the private account record, and set the fixed project Region before any regional query. IAM resources are global within an account, while STS endpoints and the services reached by an identity can be regional.
Use only the read or change actions required for this lesson. An AccessDenied result is evidence to analyse, not permission to switch to root or attach AdministratorAccess. Record the action, resource, principal type, request context, and smallest justified correction.
The listed cost tier is T0 - no resource creation. Free Tier eligibility and credits are account-specific. Before a mutating lab, identify every resource that can charge, estimate its duration, start a timer, and write the reverse cleanup order. A budget reports cost after billing data arrives and is not a real-time stop control.
AWS Management Console method
- Open EC2 Network Interfaces and inspect the interface subnet, Availability Zone, addresses, security groups, attachment, and source/destination check.
- Open Elastic IP addresses and inspect the current association and network-interface mapping.
- Before moving an interface or address, confirm same-AZ restrictions and whether a load balancer or DNS design is safer.
For every step record the service page, selected account and Region, exact object, visible state, and why that state matters. A Console label or green status is not enough unless it is tied to the final workload outcome.
AWS CLI or API evidence
Inspect interface ownership, addresses, groups, and source/destination checking.
aws ec2 describe-network-interfaces --network-interface-ids eni-0123456789abcdef0 --query 'NetworkInterfaces[0].{AZ:AvailabilityZone,Subnet:SubnetId,Private:PrivateIpAddresses,Groups:Groups,Check:SourceDestCheck,Attachment:Attachment}'
Confirm whether the interface is primary or secondary before planning detachment. Its AZ restricts which instances can attach it.
Before running the command, replace every placeholder, explain each option, and decide whether the operation is read-only or mutating. Capture the exit code immediately. Redact account IDs, ARNs, public addresses, request identifiers, and personal data before sharing.
The CLI and Console are clients of AWS APIs. Matching state across them increases confidence, but neither substitutes for data-plane or application verification.
Practical work
Inspect the stopped nw-p04-web-1 after AWS 073. Create p04-interface-map.md with primary ENI, subnet, AZ, private IPv4, current public-IPv4 field, the previously recorded temporary public IPv4, security groups, attachment index, source/destination check, and lifecycle ownership. Explain why the automatically assigned public IPv4 was released at stop while the private IPv4 and primary ENI remain. Compare a secondary ENI and Elastic IP recovery pattern with load balancer and DNS alternatives. Do not start the instance or allocate an Elastic IP in this lesson.
The evidence package must include:
- non-root principal type, account verified privately, and Region;
- exact intended and observed state;
- one Console observation and the matching CLI or API result;
- one successful result and one denied, failed, or counterexample result;
- what each result does not prove;
- cost state and elapsed lab time;
- cleanup evidence or a named retained-state owner and next lesson.
Verification standard
Use three levels of proof:
- Control plane: the object or policy exists with the intended configuration.
- Data plane or behavior: the request, packet, session, storage path, or application does what the requirement states.
- Operations: monitoring, failure diagnosis, cost, ownership, and cleanup are known.
A control-plane response can precede final readiness. Use waiters or state polling where supported, then test the actual behavior. If a request times out, do not assume it failed. Inspect state and use documented idempotency before retrying a mutation.
Troubleshooting method
| Symptom | Evidence first | Smallest safe response |
|---|---|---|
| command cannot authenticate | credential source, expiry, caller preflight | restore approved temporary login |
| access is denied | action, resource, principal, all policy layers | correct only the missing or conflicting control |
| object appears missing | account, Region, filters, pagination, permission | align scope before creating anything |
| configured state exists but behavior fails | route, identity, dependency, logs, service state | test the next boundary in the path |
| cleanup is blocked | dependency inventory and owning service | remove dependants in reviewed reverse order |
Keep the original symptom and timestamp. State one hypothesis, make one reversible change, repeat the original test, and record rollback. Never open a management port to the world, expose credentials, disable TLS verification, format an unknown disk, or add broad permissions as a generic fix.
Architecture and certification decisions
Professional-level questions provide competing valid features. Identify the requirement that decides between them: human or workload identity, same-account or cross-account access, regional or zonal scope, stateful or stateless filtering, durable or ephemeral data, latency, RTO/RPO, cost, or operational ownership.
Explain why the selected option fits and why each plausible alternative fails one stated requirement. Do not rely on feature memorization or reproduce protected certification questions.
Knowledge check
- Can a secondary ENI move to an instance in another AZ?
Expected direction: No. The ENI is bound to one subnet and AZ.
- Does an Elastic IP appear inside the guest operating system?
Expected direction: Normally no. The guest sees the private address and the internet gateway performs the public mapping.
- Why disable source/destination checking on a NAT instance?
Expected direction: The instance forwards packets whose source or destination is another host.
- Are unused public IPv4 addresses the only charged public IPv4 addresses?
Expected direction: No. AWS current pricing also charges for public IPv4 addresses in use.
Cost, cleanup, and retained state
Retain only the state explicitly required by the next P04 lesson and record it in the private resource ledger.
Cleanup evidence includes the final state query, not only a successful delete response. Search related resources, other Regions used by the lab, retained storage, public IPv4 addresses, logging destinations, and service-managed dependencies. Schedule a later billing review because cost data can lag.
Completion gate
Pass when the practical artifact explains the real problem, matches Console and CLI evidence, answers every knowledge check, diagnoses one failure without broadening access, records cost, and proves cleanup or approved retention. The learner must defend one decision orally and name the requirement that would change it.