Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 5: Amazon EC2 (Elastic Compute Cloud)

AWS Cloud

5.5 Elastic IP (static public IP)

1
AllocateGet a public IPv4 from AWS into your account
2
AssociateAttach it to your EC2 instance (or ENI)
3
UseIP stays the same after stop/start; put it in DNS
4
DisassociateUnlink it; it still sits in your account (still billed)
5
ReleaseGive it back to AWS so you stop paying

Why a normal public IP changes

Priya in Pune runs a small shop site on one EC2 server. She stops the server at night to save money. In the morning the site URL is dead. Friends in Berlin still open the old IP. That IP is gone.

A public IPv4 address can be routed on the internet when an appropriate route exists. A service still needs a usable path, policy and listener. When AWS gives your instance a normal (auto-assigned) public IP, that IP belongs to the running instance only for a while.

  • Stop, then start → AWS takes the old public IP back. You usually get a new one.
  • Reboot (restart the OS) → the public IP stays the same.
  • The ordinary primary private IPv4 remains assigned to the same instance across stop/start.

How — see it yourself

  1. In the approved training account open EC2 → Instances → select only the disposable instance you are permitted to stop and start, or use the sample observations below.
  2. Copy the Public IPv4 address (example: 192.0.2.25).
  3. Instance state → Stop instance → wait until stopped → Start instance.
  4. Look at Public IPv4 again. It is often a different number.

Example — before and after stop/start

The console shows the instance association. A remote IPv4 observer reports the path’s observed source, which can differ if a NAT gateway or proxy is used. The IPs shown here are documentation examples.

# On the server, before stop:
curl -4 --max-time 10 https://checkip.amazonaws.com
# Sample output:
# 192.0.2.25

# Stop the instance in the console, then Start it.
# SSH again (new IP!), then:
curl -4 --max-time 10 https://checkip.amazonaws.com
# Sample output:
# 192.0.2.37

The address changed. A DNS A record or bookmark that used 192.0.2.25 now points away from the intended instance.

Full ops story, including swapping servers without changing DNS, is in lesson 14.1 Elastic IP in depth.

What an Elastic IP is

For a design requiring a stable public IPv4 across ordinary stop and start, evaluate an Elastic IP. A stable service name can meet a different requirement.

An Elastic IP (EIP) is a static public IPv4 address that AWS allocates to your account in one Region. It stays yours until you release it. You can move it to a supported target in the same Region and compatible network border group.

  • Elastic IPs are IPv4 only. AWS does not offer Elastic IP for IPv6. EC2 IPv6 uses a separate interface assignment and routing model. Check the actual address lifetime and network path.
  • An EIP lives in one Region (for example ap-south-1). You cannot move the same EIP to another Region.
  • BYOIP (Bring Your Own IP): if you bring your own public IPv4 range to AWS, addresses from that pool do not count toward the normal EIP quota and are not billed as AWS-provided public IPv4. Most beginners can ignore BYOIP.

How — mental model

  1. AWS holds a pool of public IPv4 addresses.
  2. Allocate = “this address is now in my account.”
  3. Associate = “map this address to this instance’s network interface.”
  4. Internet traffic to the EIP hits the Internet Gateway, then your instance’s private IP.

Example — names you will see

  • Allocation ID — like eipalloc-0a1b2c3d4e5f67890 (the EIP itself in your account).
  • Association ID — like eipassoc-0123456789abcdef0 (the link to an instance or ENI).
  • Public IP — like 192.0.2.44 (what browsers and DNS use).

You release with the allocation ID. You disassociate with the association ID. The public IP is the human-facing number.

Allocate and associate (console)

Omar wants a stable public IPv4 for his authorized single-instance shop.example.com exercise. He can choose an EIP for the address requirement. The site remains unavailable while its only instance is stopped.

Two console actions: Allocate Elastic IP address, then Associate Elastic IP address.

How — numbered steps

  1. Open the EC2 console in your Region (example: Mumbai ap-south-1).
  2. Left menu → Network & Security → Elastic IPs.
  3. Click Allocate Elastic IP address.
  4. Public IPv4 address pool: Amazon’s pool of IPv4 addresses (default).
  5. Optional tag: Name = mauli-web-eip (Mauli Dairy lab name).
  6. Click Allocate. Note the new Public IP and Allocation ID.
  7. Select that EIP → Actions → Associate Elastic IP address.
  8. Resource type: Instance → choose the instance → choose its private IP → Associate.
  9. Open the instance page. Public IPv4 address should now show the Elastic IP.

Example — what you should see

  • Elastic IPs list: 192.0.2.44 · Associated instance ID · Allocation ID eipalloc-…
  • Instance summary: Public IPv4 = 192.0.2.44 (same number).

The old auto-assigned public IP is gone. SSH and HTTP must use the new EIP from now on.

Note: when you associate an EIP, AWS releases the instance’s previous auto-assigned public IP. You cannot turn that old auto IP into an EIP.

Same job with AWS CLI

Use the CLI examples only for a verified disposable lab. The addresses and IDs below are illustrative. Confirm the authorized account profile, Region, resource ownership and applicable costs before substituting real values. Same ideas: allocate, associate, describe.

Main commands: allocate-address, associate-address, describe-addresses.

  1. Allocate in the VPC domain (today every EIP is VPC):

Example — allocate

aws ec2 allocate-address --domain vpc
{
  "PublicIp": "192.0.2.44",
  "AllocationId": "eipalloc-0a1b2c3d4e5f67890",
  "Domain": "vpc"
}

192.0.2.44 is now in your account. Nothing is attached yet. You are already being billed for this public IPv4.

  1. Associate it to an instance:

Example — associate

aws ec2 associate-address \
  --instance-id i-0abc123def4567890 \
  --allocation-id eipalloc-0a1b2c3d4e5f67890
{ "AssociationId": "eipassoc-0123456789abcdef0" }

the association now points to the selected resource. An approved request reaches its listener only when route and policy also permit it.

  1. List what you own:

Example — describe

aws ec2 describe-addresses --output table

Review PublicIp, AllocationId, AssociationId and any interface or service details. An empty InstanceId can also appear for service-owned associations. Check the current target and owner before calling the EIP idle.

Disassociate and release

Anita finishes a lab in Hyderabad. If she only terminates the instance and forgets the EIP, the bill keeps growing.

  • Disassociate — unlink the EIP from the instance. The EIP stays in your account.
  • Release — return the address to AWS. Billing for that address stops (once released).

How — console

  1. EC2 → Elastic IPs → select the address.
  2. Actions → Disassociate Elastic IP address → confirm.
  3. Select it again → Actions → Release Elastic IP addresses → Release.

How — CLI

Example — disassociate then release

aws ec2 disassociate-address --association-id eipassoc-0123456789abcdef0
aws ec2 release-address --allocation-id eipalloc-0a1b2c3d4e5f67890

After release, describe-addresses no longer lists that AllocationId. Always disassociate before release if it is still attached.

Recover a released Elastic IP (sometimes)

You released the EIP by mistake. DNS still points to 192.0.2.44. Can you get it back?

AWS can sometimes recover it if the address is still available and the request is within the applicable quota. You recover only with the API/CLI (not the console button). Tags on the old allocation are not restored.

  1. For an approved recovery attempt, pass the exact address originally held by the account. The documentation value shown here cannot be recovered on AWS:

Example — try to recover

aws ec2 allocate-address --domain vpc --address 192.0.2.44

success → you get a new AllocationId for the same public IP. If it fails, inspect the actual eligibility or quota response. If recovery is unavailable, establish and verify the replacement endpoint, DNS and relevant client references.

Official docs: Release and recover an Elastic IP address.

Pricing and quota

Many students still believe “first EIP is free while attached.” That old rule is gone.

What — price

From 1 February 2024, AWS charges $0.005 per hour at its standard rate for supported AWS-provided public IPv4 address usage, including:

  • auto-assigned public IPs on running instances,
  • Elastic IPs that are attached,
  • Elastic IPs that are idle (allocated but not associated).

Rough maths: one address ≈ 0.005 × 24 × 30 ≈ $3.60 per month.

AWS Free Tier and credits depend on when the account was created, its plan and current eligibility. Check the account’s terms before using public IPv4, and account for any costs of other resources separately.

What — quota

Default quota: 5 Elastic IP addresses per Region per account. You can request more in Service Quotas. BYOIP addresses do not count against this quota.

How — stay cheap

  1. Prefer one EIP only when you truly need a fixed address.
  2. After a lab, verify and release only unused allocations the exercise created and permits you to remove.
  3. For many public apps, put an Application Load Balancer (or similar) in front and point DNS at the load balancer — see Chapter 18. For a name on one server, learn DNS in Chapter 9: Domain Names, DNS and Subdomains.

Example — when EIP vs load balancer / DNS

  • Use an EIP — single server, you SSH to a stable IP, or you must remap fast to a standby instance in the same Region.
  • Use a load balancer + DNS — public website with more than one instance, or you want HTTPS and health checks. Point the domain at the load balancer DNS name, not at a raw EIP.
  • DNS alone — if your DNS TTL is short and you accept a short delay when the IP changes, you can update the A record after stop/start. Still painful for beginners; EIP is simpler for one box.

Sources (pricing & EIP basics):

Common mistakes

  1. Release forgotten after terminate — instance is gone; EIP remains and bills you.
  2. Thinking reboot = stop/start — reboot keeps the auto public IP; stop/start does not.
  3. Associating in the wrong Region — EIP in us-east-1 will not attach to an instance in ap-south-1.
  4. Expecting IPv6 “Elastic IP” — there is no EIP for IPv6.
  5. Assuming you can never recover a released IP — an approved allocate-address --address request can succeed only under applicable availability and quota rules (see above and 14.1).
  6. Putting an EIP on every instance “just in case” — prefer load balancer + DNS for fleets.

Checklist before you leave the lab

  • I know stop/start changes auto public IP; reboot does not.
  • I allocated an EIP and associated it to my instance.
  • I verified the known allocation and association and tested an approved service path if the exercise requires it.
  • After the approved test, I removed only the lab-owned association and allocation if the plan called for it.
  • I confirmed the specific lab allocation was released or intentionally retained. Shared and other users’ addresses stayed in place.

Ravindra Bagale's Tip

For an approved fixed-address design, verify the Elastic IP association before publishing its DNS record. When the lab ends, check which resources use the address. Release only the documented lab allocation after checking its instance, interface or service dependencies.

Lab — pin a stable public IP on one EC2

Goal: observe the allocation across a disposable instance’s stop/start. Track all billable resources and clean up the ones the training plan owns.

  1. Use one disposable EC2 instance in the account and Region your class approves. Confirm the type and account eligibility separately. Name your own training instance mauli-web-1 only if the naming plan permits it.
  2. Copy its current auto public IP into a notepad.
  3. Allocate an Elastic IP. Tag Name=mauli-web-eip.
  4. Associate it with mauli-web-1.
  5. From your laptop: ssh -i your.pem ec2-user@THE_EIP (Amazon Linux) or the matching user for your AMI.
  6. Verify the EIP association in the console. If the network permits an optional IPv4 source test, use curl -4 --max-time 10 https://checkip.amazonaws.com from an approved guest. On the direct path you may observe the EIP. A NAT gateway or proxy can change the observed source.
  7. Stop the instance. Start it again. Confirm the Public IPv4 is still the EIP (not a new random IP).
  8. Disassociate and release only the test allocation you created if authorized. Verify that individual allocation was removed. Check remaining lab-owned compute, storage and services separately.

Pass: The address stayed associated across the approved stop and start. The exercise’s allocation was then removed or retained according to the approved plan and verified by allocation ID.

Quick quiz

Five questions. Only what this lesson teaches. Click an answer to check.

Decide which part of a service needs to stay stable

Priya's training shop runs on one EC2 instance. A few people keep a bookmark of its test endpoint. On Friday its ordinary auto-assigned IPv4 is included in a practice DNS record. Priya stops that one disposable server after class. On Monday an approved private check can still find the service data, but the public bookmark points at the old address. The instance still has an identity in the cloud. The auto-assigned public IPv4 association had a different lifetime.

Before allocating a new fixed address, write the actual requirement. A human visitor typically needs a reliable name and a valid certificate. A vendor might specifically require a known source IPv4 for a network allowlist. An administrator might need a stable way to reach a private instance approved by the organization. Those are different goals. A public address can help some designs. It does not create a trusted certificate, a valid private management path or a correct list of permitted users.

An Elastic IP, or EIP, is a static public IPv4 allocation in AWS. An approved resource association places that address in use. AWS retains the allocation in the account while it stays allocated under the service's rules. A direct EC2 setup can preserve the same associated address over ordinary stop and start. The stopped instance cannot serve requests while it is off. Preserving the public number is one operating requirement, and keeping the application on and responsive is another.

Public IPv4 sample values in this lesson come from documentation ranges. They stand in for addresses in a drawing. A learner needs the exact current values from their own approved lab to connect or perform any resource action. Review the lab's placement, identity and cost controls first. Many of the comparisons and the complete ownership exercise can be done without allocating an address.

Keep instance, interface, public address and DNS lifetimes separate

Begin with four rows. The EC2 instance ID identifies the particular resource. The private IPv4 is assigned to an interface from its subnet. The public IPv4 is an association AWS maintains for the internet path. The DNS record connects a name to the intended address or endpoint. One operation can affect some rows while leaving the others unchanged. Naming which row changed tells you what to inspect next.

Operation in the basic EBS-backed exampleOrdinary auto-assigned public IPv4Elastic IP allocation and associationApplication check
Guest rebootNormally stays assigned to the same instance.The planned association normally remains.Wait for the relevant service to start and verify the intended request.
Stop then start the same instanceAn ordinary auto-assigned public IPv4 is released on stop. A new value can be assigned on start.The same planned association can remain. There is no service while compute is stopped.Compare the current address, service status and DNS after the instance starts.
Replace the instanceThe new resource has its own launch and address assignments.A permitted operator can deliberately move an eligible association.Verify the replacement is ready before changing the public path.
Release the Elastic IPIndependent of any new auto-assigned address settings.Your account relinquishes that allocation.Any references to the old public address need a verified transition.

The primary private IPv4 in the ordinary same-instance example survives stop and start. That helps explain why an internal endpoint still works while someone outside keeps using a stale bookmark. Assignment details can differ with interfaces and custom configurations. Review the actual association and route rather than trying to deduce the new value from the old one.

When an EIP is associated with the eligible instance's primary interface in the standard case, its previous ordinary auto-assigned public IPv4 is released. The operator should plan for callers still using that older address. AWS does not turn the old ordinary public IPv4 into a saved Elastic IP for you. An intended stable public identity needs the deliberate allocation and association. A stable application name can also help when you're coordinating a public move, but DNS work belongs to its own transition plan.

Read the allocation ID, association ID and network border group

Allocation means an address exists in the account's inventory. Its allocation ID identifies that saved record. Association means the allocated address is linked to a supported resource or interface and private IPv4. Its association ID refers to the link. A command that releases an allocation and a command that disassociates its current link operate on different objects. Use both fields in a change record so nobody selects an action by the public number alone.

For a direct EC2 path, the associated network interface and its private address matter. A machine can have several attached interfaces or more than one address. The detail page and API can show the interface used. If you expected to associate the address with a specific interface or private IPv4, verify the selected values rather than assuming that any interface on the same instance can serve the intended request. The current application listener and effective subnet route also need to match.

Placement has two important conditions. The allocation belongs to a Region. Its network border group represents the set of locations from which AWS can advertise the address. The associated resource must be in the compatible network border group as well. In a standard case the usual AZs in a Region can share a group, while some AWS edge locations or zone types can have distinct groups. Same Region is a necessary starting check. When a valid resource is still unavailable to select, compare the actual border groups.

For an internet-facing design, do not confuse an AWS-provided public EIP with a private IP or an IPv6 address. EIPs are an IPv4 feature. An ENI can have IPv6 addresses under its separate configuration, and IPv6 reachability depends on its own routes and policy. There is no “IPv6 EIP” requirement for an ordinary dual-stack design. Ask which family customers and vendors use and which identity must remain stable.

An inventory contains account resources from several service types. A public NAT gateway or an eligible load-balancing configuration can have an EIP even if no EC2 instance ID appears on that row. Inspect association and interface or service ownership before labelling any address idle. An address held as a planned reserve may also be intentionally unassociated. Inventory is evidence for an ownership decision. It is not a blanket instruction to release anything without an instance name.

Verify which path actually uses the associated address

In an approved direct public IPv4 design, AWS's internet gateway maps between the resource's associated public IPv4 and the selected private address. When inspecting the guest, it is normal to see the interface's private IPv4 instead of the mapped public number. The cloud record and guest output describe different sides of the path. Do not configure the public value as a local guest address just to make those two screens agree.

A public browser request first needs the intended DNS result or current destination, an internet path under the selected subnet route and association, proper network permission and a listening service. The response must come back through a usable path. A service connecting over HTTPS also needs a valid certificate for its name or supported IP identity. An EIP fixes one association. It cannot provide each of those other conditions by itself.

For a private worker's outbound connection, a public NAT gateway in the selected path can use its own EIP. When the worker reaches a remote external service through that NAT and an internet gateway, the remote side can see the NAT gateway's associated address. The worker does not need its own direct EIP for that purpose. A different private target, intermediary or proxy can produce a different observed source. Check the route to that exact destination rather than describing one value as the source for all traffic.

A command that asks a remote service which IPv4 it saw measures egress for that request. It does not list EC2's public associations, show the guest's interface settings or verify a public inbound connection. If Priya's instance description shows an EIP and an approved source check reports a different address, trace the path and any proxy or gateway used. A difference can be consistent with the design. Choose what you mean to prove before selecting your test.

Write two measures after a planned association. The console or approved CLI should show the expected allocation and target. A permitted application check should return the expected operation from the relevant client. If you only need to demonstrate how an EIP is recorded, the first check can be enough. If you claim the public shop works, its specific public flow needs its own verification.

Choose a stable name, fixed ingress address or fixed egress address

Real requirementCandidate designWhat the stakeholder tests
Customers consistently open a named public service.Stable DNS name to a supported public frontend, such as an Application Load Balancer for an HTTP application.Name resolves, the certificate matches, the selected service returns the intended result.
An authorized single-instance demonstration or client requires one stable public IPv4.One deliberately allocated and associated EIP under the direct access design.Resource association stays correct and the approved address and port reach a working app listener.
A vendor permit list requires specific observed IPv4 sources.Stable egress design with appropriately managed addresses, such as an approved public NAT path.The vendor observes the expected source from the actual request network and zone.
The organization needs a fixed public IP entry across a more complex service.Review the supported frontend models for the address and protocol requirement, such as appropriate Network Load Balancer or AWS Global Accelerator options.Verify the service's exact address behavior, coverage and failover under its own design.

A public Application Load Balancer gives clients a frontend DNS name. AWS Route 53 can use an appropriate alias record for that load balancer. The underlying address values can change. Do not copy a temporarily resolved IP into a permanent record as though it were an assigned EIP. The connected target instances can use private interfaces and change behind the public entry. This makes stable name and app capacity decisions separate.

For direct DNS pointing to one instance, changing an A record after an address changes can restore the intended name for new lookups. Older answers may remain cached until their relevant time-to-live behavior expires. A stable EIP can remove that particular need to change the numeric record during a planned association move. The application still needs certificates, configuration, allowed paths and updated readiness on the new target. A DNS record and a replacement plan solve different problems.

Choose using a sentence such as “The vendor must observe approved IPv4 sources for its outbound inventory check” or “Student browsers should use the same training hostname after a worker is replaced.” The type of stability in that sentence directs the choice. An EIP placed on every instance by default can add allocations and permission work without helping the actual client requirement.

Plan a move without assuming existing sessions will survive

There are two disposable training instances, Blue and Green. A fixed public address currently belongs to Blue. Green is running and should receive the next demonstration. Start with two checks before moving anything. From the approved private path, verify Green has the expected application release and can read the correct training data. Then confirm the explicit allocation and association IDs, intended target interface and private IPv4, group and Region, and allowed application port. An instance may be healthy in the cloud and still fail the expected test operation.

Record the old and new associations in an approved change plan. Define the expected interruption and how to roll back if the new target cannot serve the synthetic page. If an established connection passes through Blue, moving the address can interrupt it. New requests may need to reconnect. An STS session, private administration login or another independence mechanism can help the authorized operator observe a move. Keep application state and rollback choices separate from the IP association. Interpreting a move as “no DNS change” only describes one part of the transition.

During the approved change, use the exact resource IDs and selected methods. Inspect the association once, then test its assigned service from the intended client. If a console submit appears delayed, read the current address and association before repeatedly changing it. An unintended association might disconnect another lab. Avoid moving an address already used by a production dependency. A scripted operation should know whether reassociation is permitted and use the account's approved controls.

An automated change should account for what happens if its submit response is lost. Before retrying, ask the read-only inventory whether the allocation already points to the exact requested interface and private IPv4. If it does, verify the intended service rather than sending a second change. If another owner has changed the address in the meantime, the approved expectation no longer matches. Stop the change and reconcile ownership before continuing. In addition to the resource impact, AWS documents that repeated remapping can have a cost implication. Avoid treating an address association as a harmless operation to loop until a browser responds.

A good rollback record includes the old available target, its attachment values, allowed path and the evidence needed to confirm restored behavior. If the application accepted writes during the change, understand which data system owns them before switching back. Reassigning a public IP does not synchronize data. Follow the organization's scoped change plan. This lesson's paper model can test the ordering and verify ownership without touching any real EC2 resource.

Estimate address charges using allocation time and account terms

A public IPv4 allocation has a separate cost model from the compute using it. AWS publishes rates for in-use and idle AWS-provided public IPv4 addresses. An allocated EIP can incur charges while unassociated. An ordinary auto-assigned IPv4 on a running public resource can also incur charges. Check the pricing conditions, usage and offers for the account, and distinguish an AWS-provided public address from customer-provided address space under documented exceptions.

Use address-hours before multiplying a price. Two AWS-provided addresses held for 12 hours each give 24 address-hours in a simple worksheet. An address that was active for six hours and unassociated for the remaining six was still held for the full 12 hours. If both states are charged under the applicable model, use the appropriate rates for their respective periods. A cloud console association did not disappear simply because the VM stopped or the resource no longer appeared in a particular instances view.

A 30-day illustration gives 720 address-hours for one allocation held the whole period. Multiply by the current documented rate under the chosen plan. This number excludes data transfer, application infrastructure and any independent NAT or load balancer cost. A test built using an AWS credit or free plan can have different economics depending on account date, eligibility and remaining credits. Do not treat a historical 12-month allowance as universal. Use current account usage and the applicable program terms.

Set a limit for your classroom plan using the real owner and expected duration. If a second address is required for comparing Blue and Green, estimate that allocation as well. Verify whether Green actually needs its own direct public address to prepare the exercise. Existing private access plus one movable address can be sufficient in this pattern. A useful cost worksheet explains why each allocation exists and when it should be removed or reviewed.

A short billing review can identify ownerless allocations or a lab that has already ended. Feed that list to the account owner with the allocation ID, purpose, potential dependencies and age. Avoid treating every empty association as waste. Private backups or controlled standby can require intentional reserves. When an address is no longer needed, a verified release changes its allocation state. Confirm the relevant inventory and bill as they update under the account's normal schedules.

Confirm ownership and dependencies before a release or recovery request

Disassociating an EIP unlinks it from the current eligible resource. The account can still hold the allocation and can potentially use it again. Releasing an address gives up the allocation. For the usual VPC workflow inspect and remove the association as appropriate before releasing. Many resources that use an address have service-managed lifecycles. Confirm the public endpoint, gateway, load balancer or interface that owns its use before sending any operation.

Consider a paused training shop whose DNS still points at a recently disassociated address. If the lab owner still needs that endpoint, the appropriate next step may be reattaching the agreed resource or updating references during an approved transition. A public address that is not associated to an EC2 instance might still support a NAT gateway or another service. If a production address appears unassociated, verify DNS, partner source allowlists and planned maintenance before deciding that it serves no purpose.

AWS documents limited cases where an account can request recovery of a previously released address using API or CLI, subject to availability and applicable quota. That is a recovery attempt, not a promise. Another account could already have the address, or the request could be ineligible. If recovery is available, check the new allocation record and required tags and associations. Old tags are not restored by that recovery process. Avoid publishing a named endpoint that depends on an address you have relinquished.

If the old address cannot be recovered, review all references through the controlled incident procedure. DNS records, peer or partner allowlists, client bookmarks and approved account access can all need updates. A public IPv4 in a copied configuration is hard for the next owner to discover. Maintaining a proper address register and using a stable service name where applicable reduces the number of places that need edits. If a vendor genuinely relies on a literal IP, record its owner and update path from the beginning.

Quota is another separate check. The EC2 docs describe a default number of Elastic IPs per Region and the option to request a change through AWS processes. The quota actually applied can differ, and some special address pool scenarios are treated differently. Inspect the relevant Regional account quota when planning several addresses. A cleanup exercise uses only the known lab allocation. It does not release other learners' addresses to make the inventory appear empty.

Run an offline ledger for held, attached, moved and released addresses

Use Python 3 or a spreadsheet. This simulation uses the imaginary address 192.0.2.44 and named training targets. It cannot create, move or release an actual AWS allocation. Treat the transitions as a ledger for one owned resource. Before running the code predict the state after each move and which durations count as held address time.

python3 - <<'PY'
address = "192.0.2.44"
intervals = [
    ("allocated, unassociated", 2, None),
    ("associated to Blue", 6, "blue-training"),
    ("associated to Green", 3, "green-training"),
    ("disassociated, retained", 1, None),
]
held = 0
for label, hours, target in intervals:
    held += hours
    print(f"{label}: {address} to {target or 'no target'}, held {held} h")
print(f"released: {address}, prior total {held} address-hours")
PY

You should see held times of 2, 8, 11 and 12 hours. The final release ends the ledger at 12 address-hours. The associated target changes from Blue to Green but the illustrated public value stays the same until release. A DNS record can keep that value throughout the planned move. It must be checked if the address is actually relinquished. If the Green service does not have the correct port or application configuration, the ledger can still look right while its useful request fails.

Now add one column for expected guest and public evidence. In the Blue and Green rows, name what the console should show and what test should prove the application. In both unassociated rows the public value is allocated but no target is linked in the model. That makes it inappropriate as the specific server's live endpoint at those moments. If a learner doubles the hours when the public address moves, check whether they counted the same allocation twice. If they count only associated hours, identify the held periods they omitted.

Extend the exercise with a temporary second address for a separate target. Record a new allocation and only its period. This is how the worksheet distinguishes address-hours of multiple allocations from one continuous allocation used by different resources. No result in this exercise establishes a current price. Use the official current rates and the applicable program for real budget planning. The script creates no local file or cloud resource to clean up.

Inspect one approved existing allocation without changing it

The optional read-only exercise requires permission to inspect an Elastic IP in your training account. In the console choose the approved Region and the exact lab address. Compare its public address and allocation ID with current association details and interface or service placement. If you do not already have an authorized allocation to view, use the sample table or the ledger. An observation exercise does not need to allocate or release an address.

For an approved AWS CLI session, set these placeholders to the authorized profile, Region and existing allocation ID. Use the narrow lookup instead of retrieving every account address when only one belongs to the exercise. This command requests allocation and association fields and does not change any resource.

LAB_PROFILE='REPLACE_WITH_TRAINING_PROFILE'
LAB_REGION='REPLACE_WITH_TRAINING_REGION'
LAB_ALLOC='REPLACE_WITH_LAB_ALLOCATION_ID'

aws ec2 describe-addresses \
  --profile "$LAB_PROFILE" --region "$LAB_REGION" \
  --allocation-ids "$LAB_ALLOC" \
  --query 'Addresses[].{Public:PublicIp,Allocation:AllocationId,Association:AssociationId,Instance:InstanceId,Interface:NetworkInterfaceId,Private:PrivateIpAddress,BorderGroup:NetworkBorderGroup}' \
  --output json

The expected result is one record for the existing visible allocation. The Public field describes the address and Allocation identifies the saved allocation. Association and interface or service details describe use when applicable. An empty instance field alone does not establish that the address is unassociated. Scan the other allowed fields or relevant service inventory and ask the authorized owner. Avoid copying real public addresses or account resource IDs into a shared practice answer.

In the paper case, address A has an allocation ID, an association ID and a known private interface but no instance ID in the record. Address B has an allocation ID and no current association. Address C belongs to a different exercise. For A, identify the actual associated owner before taking any action. For B, determine whether it is retained deliberately. For C, stay within the accepted scope. The exercise succeeds when the learner makes an ownership decision using the relevant fields rather than selecting everything on the screen.

If the CLI returns an authorization or not found result, confirm the current account, Region, intended allocation and permissions. Ask the lab owner to provide the intended read access or use the paper view. After an authorized real release in a separate exercise, a query that no longer returns the original allocation or reports it absent can provide evidence, provided the lookup uses the same correct account and Region. This exercise is read-only and leaves the inspected address unchanged.

Measure a DNS change at more than one observation point

Priya changes her training A record from 192.0.2.25 to 192.0.2.44. A classmate who looks it up from another network sees the new answer immediately. A second student keeps getting the older address for a while. The relevant readers may be using different recursive resolvers or caches. The published record and a particular client response are different observations. Ask which record, resolver and time each student actually saw.

Write a timeline. At 08:45 the training record has a 300-second TTL. A resolver obtains that answer at 08:48. At 08:50 the owner changes the published value. Under a simple valid cache example, the resolver can keep the old answer until around 08:53. A reader with a cache miss after publication may see the new one earlier. Real resolver and application behavior can also affect a transition. A useful check observes both the target value intended by the owner and the answer received by the affected client. Do not assume all clients ask the same resolver.

Consider the version of the change where the A record already names an EIP and the owner moves only its eligible association from Blue to Green. The numeric answer can stay exactly the same. That removes the need for this particular DNS record transition. It does not establish that active connections stayed intact or that the new target listens on the expected port. Observe an actual synthetic request through the public entry after the move. Include the site hostname in the test so the certificate and virtual host logic are checked under the intended behavior.

When reaching an IP directly as a fallback check, follow the lab's protocol and certificate design. An HTTPS request using a raw IP does not necessarily carry the same hostname identity as the normal site URL. A certificate name error at a raw address can be entirely consistent with a healthy named service. Record which URL and hostname the client really used. An explicit service check should verify the resource that answered and the useful action expected from it.

Keep a vendor allowed-source list accurate when the workload moves

Mauli starts with a private app in Zone A and one documented public egress source. A partner approves that source for its test endpoint. Later another worker launches in Zone B. It can read the same internal database and still fail the partner call. In a zonal NAT design, the subnet's routes can point at a different gateway and public source. The vendor policy is a property of the observed outside connection, not a permission inferred from the worker's Name tag or approved IAM role.

Create a source ledger with the approved calling subnets, intended routes, zone and allowed outside source values. Check the actual managed gateway mode, including how addresses are assigned. With an AWS regional public NAT gateway, one gateway ID does not guarantee a single unchanged external IPv4 across all availability zones. Verify the mode and current IP management behavior for the workload's actual placements. Record the approved source expectations with the partner before adding zones or changing addresses. Track who owns the source allowlist update and when it takes effect.

Use a representative approved request to verify each path. The partner cooperation may supply the perceived source, timestamp and application status of its own expected test. Even when the source matches, the app can still fail because the service needs credentials or because the requested operation is invalid. The app owner should verify the business operation independently. A shared static source does not grant the same account access to everyone behind it.

Build one failover row. Suppose Zone A's worker is unavailable and Zone B must pick up requests. Verify that the allowlist covers the intended secondary source, that routing and attached resources are configured and that the partner operation still succeeds. Then plan cleanup at the end of a classroom migration. One allocation may remain required by the other zone, reserved by a customer, or used by a different resource. Ownership and alternate paths must be checked before deciding to release it.

Practice writing the fixed-address request and owned cleanup plan

  1. Compare three requirements from a business team: a stable name for customers, an approved stable source for a vendor, and direct administration of a private worker. Write an intended path and success evidence for each. Show which case specifically needs fixed IPv4 and which can use the intended service or private administration design.

  2. Given an EIP with a current association to Blue and an intended temporary Green replacement, fill in the publication checklist. Include Region and border group, exact association target, storage and database readiness, approved ingress path and a verified client test. State what record you need before restoring Blue under the approved plan.

  3. Review an account table with one idle training EIP, one NAT association and one unassociated address reserved by an owner. Estimate held address-hours and mark which entries require an ownership decision before removal. Use separate rows even when the console shows no instance ID for more than one record.

  4. The address intended for a lab was released and a DNS A record still points to it. Write the checks for a supported recovery attempt and a plan to establish the new intended endpoint if recovery is unavailable. Your plan should preserve certificate and authorization checks in either outcome.

Interview questions and worked answers

How do you identify an allocation separately from its attachment?

The allocation ID identifies the public IPv4 held by the account. The association ID identifies a link to the current resource or interface. Inspect both before changing anything. Disassociation leaves the allocation in the inventory. Release relinquishes the allocation under the applicable rules.

Why might a moved EIP still fail to serve the site?

The new target needs the intended network path, listener, policy, certificate and app dependencies. Address association shows where AWS will map the public address under its design. It does not demonstrate that the new target returns the expected application response.

Does an EIP in the same Region always fit any target there?

It needs a supported resource association and compatible network border group as well. Check the actual placement and applicable service requirements. Special zone placements can use different groups even within the broader regional arrangement.

Can an Elastic IP exist without an associated EC2 instance?

Yes. It can be unassociated and retained, or it can be used by another supported resource. An empty instance ID does not prove the address is idle. Review the association, interface, service and intended owner before any release.

How do you choose between a stable EIP and a stable DNS name?

Write the client's actual requirement. A vendor that requires an observed fixed IPv4 needs the appropriate allocation and egress design. A customer needing a reliable site name may work well with DNS to a managed frontend, while target instances keep private addresses and can change.

Check your understanding of a public IP's identity and lifetime

  1. Which record names the link between an EIP and an interface? A. Association ID. B. The hostname's TLS certificate. C. The EBS volume ID.

    Show answer

    A. The link is the association. The allocation identifies the public IPv4 resource held separately by the account. The certificate and disk are independent resources.

  2. A no-longer-used EIP was disassociated at 09:00 and remained allocated through noon. What should the cost worksheet check? A. Those held hours can still count under applicable charges. B. Disassociation automatically removes the allocation. C. The app process determines the public address rate.

    Show answer

    A. Disassociation unlinks the target but leaves the allocation. Idle public IPv4 can still be billed. Confirm the account's current program and the resource owner before any release.

  3. A private worker reaches a vendor through public NAT. What can determine the vendor's observed public source? A. The NAT gateway's associated public address for that internet path. B. The private worker's subnet network address. C. The application's Name tag.

    Show answer

    A. The public NAT path and internet gateway mapping can present the gateway's associated public address. Confirm the actual route and any intermediaries. The worker does not gain its own EIP merely by using NAT.

  4. After reassigning a stable address, what proves the intended change works for users? A. A console association alone. B. A representative authorized client request returns the expected result at the intended endpoint. C. The old host has been deleted.

    Show answer

    B. Verify the new mapping and test the intended service path, including the correct name or approved address and protocol. A listed association is early evidence. A user-facing check demonstrates useful behavior.

  5. An allocation has no instance ID but has an interface and association ID. What is the next decision? A. Release immediately. B. Inspect which service or resource uses the interface. C. Reassign to any visible instance.

    Show answer

    B. Some AWS services can use an EIP without showing a directly associated EC2 instance ID. Use the relevant ENI and service ownership evidence. Do not remove shared or required resources.

Revision cards

Allocation
An EIP held by an account has an allocation ID and a Regional placement with a network border group.
Association
The link to a supported target has its own identity. Identify the exact interface and private IPv4 when relevant.
Release
Release gives up the allocation. Recovery can be attempted only under documented conditions and may fail.
Observed source
The internet-side server reports which address reached it. NAT, proxies and the actual route can change that result.
Stable name and stable address
Ask which client requirement matters. A managed public frontend name and a fixed public IPv4 have different use cases.
Cleanup inventory
Review association and service ownership. Remove only unused lab-owned allocations that the plan permits you to release.

References