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

Chapter 14: EC2 Operations — Elastic IP, AMI, Snapshots and Vertical Scaling

AWS Cloud

14.1 Elastic IP in depth

Stable public IPv4

An automatically assigned public IPv4 address usually changes after EC2 stop/start. If a DNS record listed the previous value, check the record and active service endpoint. An Elastic IP is a separate static IPv4 allocation you can retain and associate with an eligible resource.

For a public EC2 path, the Internet gateway maps the public IPv4 to the associated private IPv4 on the network interface. The target must be eligible in the same Region and network border group. Routing and security rules determine reachability.

Point Auto-assigned public IP Elastic IP
Survives stop/start Generally changes on stop/start Yes
Owned by Assigned temporarily from Amazon’s public pool Your AWS account
Move to another instance Not possible Reassociate to an eligible resource in the same border group
Default limit — 5 per region per account (a service quota; you can request more)
Charges Public IPv4 is charged hourly Public IPv4 is charged hourly — whether attached or idle

Public IPv4 addresses cost money

Amazon-provided public IPv4 addresses are billed under applicable AWS pricing. Both used and idle Elastic IP allocations can incur address-hours. Check Amazon VPC pricing and confirm the allocation has no outstanding consumers before release.

Allocate and associate (console)

Come on, now let's allocate an Elastic IP for our web server and attach it. Three steps: allocate, associate and verify.

Step 1. In the correct AWS Region, select Elastic IPs in EC2. Choose an allocation from the intended public IPv4 pool and the managed resource’s network border group.

Step 2. Associate the allocation with the intended resource and private IPv4. Specify the network interface when the instance has several. Check any reassociation option against the change plan.

Step 3. Re-read the new mapping, then use a separate outside request to confirm the intended hostname, TLS certificate and application response.

The old public IP is gone

Associating an Elastic IP to an instance or its primary interface can release its previous auto-assigned public IPv4 back to Amazon’s pool. Prepare another administrative path for the handoff. A later disassociation cannot restore that old automatically assigned address.

Server replacement with the same DNS record

When the existing DNS A record already points to the retained Elastic IP, a planned reassociation can keep that record unchanged. In this documentation-only example, 198.51.100.27 moves from the old web interface to the prepared replacement.

  1. Prepare the replacement and test its expected hostname, certificate, data and application release through an authorized test path.
  2. Record the exact old mapping and plan what happens to existing connections before moving the address.
  3. Verify the new AWS mapping and a fresh customer-style request. Retain the previous target for the agreed rollback window.

Disassociate and release

  • Disassociate: select the EIP → Actions → Disassociate Elastic IP address. The EIP stays in your account (still charged).
  • Release: After checking the named allocation and its consumers, use the documented EC2 release procedure. Recovery after release is conditional on availability and quota. It does not restore prior tags.

AWS CLI equivalents (optional)

The expanded lesson below separates read-only address discovery, an association guarded against replacing an existing mapping, and a deliberate reassociation. Check the caller, scope, interface and original target before any cloud change.

Ravindra Bagale's Tip

If the site relies on a stable IPv4, publish the verified allocation in DNS and check the site path. During lab cleanup, identify the exact owned allocation and confirm its consumers and rollback needs before release.

Lab

खालील offline lab मध्ये allocation, association, target interface आणि public site response वेगळे तपासा. योग्य mapping असून data चुकीचा येत असेल तर handoff स्वीकारायचा का ते ठरवा.

Got it? An Elastic IP belongs to the account, not the instance – so even if you change the server, the address stays the same. Now let's move on to AMIs – a photocopy of the server.

Keep one customer-facing address while replacing a web server

A shop has one public web server. A DNS record for its website points to the server's current public IPv4 address. During maintenance the operator stops the EC2 instance, then starts it again. The operator sees that SSH to the old address fails even though the instance is running. The website's record is still published, but it may now direct visitors to the wrong destination. Before changing the website, ask which part of the setup promised that address would stay the same.

An automatically assigned EC2 public IPv4 address is a public address selected for the instance under applicable launch settings. It usually changes when an instance that used one is stopped and then started. A reboot is a different lifecycle action and does not have the same public address effect. An Elastic IP address is a separately allocated, static public IPv4 address. It can remain allocated to your AWS account while you change the supported resource association. The address belongs to your account's allocation for this purpose and does not have to disappear when an individual instance is stopped. Its static value is useful only while you keep the allocation and a correct routing design.

Consider a small standalone site that intentionally needs a stable public address for a customer's allowlist. If the operator replaces its server, they can prepare the destination at a separate endpoint, then reassociate the existing address to the new network interface. DNS can keep pointing to the same address if its existing record actually contains the Elastic IP. Open connections and the old app's memory do not travel with the association. Users may need to reconnect, and the replacement must already be able to answer for the same hostname and serve the expected state. Keeping the number stable addresses one part of the change.

The alternative may be to use an appropriate load balancer, a managed public endpoint or a name-based discovery mechanism, depending on availability and protocol requirements. Think about the type of stability your customer needs. If they need one durable web name reachable through several healthy targets, a particular IP bound to a single active instance may not supply that service design. A stable address can be suitable for a controlled handoff or an address-based integration. It does not itself look for healthy instances or route requests among several running copies of your site.

The exercise uses documentation-only addresses, fabricated identifiers and a local report. It is not a cloud account mutation. You will review evidence for an approved old and new target, predict what AWS would need to change, and judge whether sample post-change evidence is strong enough. When practising on a separately approved cloud lab, replacing an address association changes traffic. Plan each mutation and its rollback deliberately and avoid mixing it with unrelated DNS or data changes.

Read address value, allocation, association and target as separate facts

A Region is a distinct AWS geographic area with its own resource scope. A network border group determines the group of zones from which AWS advertises a public address. Many standard Availability Zones in a Region use the main regional group. Some Local Zones and Wavelength Zones use other groups. An Elastic IP is allocated in a Region for a given network border group. An eligible interface has to be in the same group. Being in the same Region is required and can still be insufficient. Record both facts when preparing a replacement, especially when a different zone family is involved.

The address value is the dotted decimal number that a client can connect to and that a DNS A record may contain. An allocation ID identifies the allocated address resource in EC2's control plane. The control plane is the set of AWS management operations that create and describe resources. An association ID refers to the current mapping of that allocation to a resource. When you change the mapping, re-read the current association ID rather than using the old one later. The ENI is the elastic network interface on the receiving side. It owns private IPv4 addresses an EC2 instance can use. The chosen private address within that interface is part of the destination.

ItemExample evidenceWhich question it answers
IPv4 value198.51.100.27 in this documentation-only sampleWhich address does the customer use or resolve?
Allocation IDThe same eipalloc-... before, during and after reassociationWhich address resource did we keep?
Current association IDThe observed eipassoc-... tied to one mappingWhich mapping currently exists?
Destination interface and private IPv4Replacement eni-..., private address 10.42.8.24Which exact interface/address pair receives it?
ScopeExpected account, Region and border groupWhich allowed operation and destination are actually eligible?

With an instance that has one interface and a simple layout, you can often choose the instance directly and use its primary interface. With more than one interface, the documented API association requires the specific network interface ID. When you specify a private address, ensure that address is assigned to the intended interface. Omitting it selects the primary address in the CLI path. A different choice can map public traffic to the wrong network interface or to a private address the application does not expect. The operating system should listen on its relevant private address or according to its own documented binding policy. An address displayed on the public side of the AWS console is not automatically assigned as a literal interface address inside Linux.

At a VPC Internet gateway, the public IPv4 mapping lets public traffic reach the associated private IPv4 address and supports the corresponding source translation for return traffic. A mapping alone does not make a subnet reachable from the Internet. For a public application path, verify the proper route to an attached Internet gateway, an eligible public address, permitted network access and the application's listener. A security group controls traffic for associated resources. A network ACL applies at the subnet boundary. The guest operating system may also have rules or firewall settings. Each layer can reject or misroute traffic independently.

For example, the command asking a remote service “what address made this outgoing request?” does not verify that a visitor can enter the website. An egress NAT gateway, HTTP proxy or different interface route can change the address observed by that remote service. Test the inbound customer path from a suitable outside location. Connect with the real website hostname so the server selects the correct virtual host and its TLS certificate can be verified. DNS resolution, a successful connection, and a correct application response are three distinct observations. Write down each one instead of assuming the first proves the others.

Manage the address lifecycle without losing the rollback path

Allocation reserves the address resource. Association attaches its mapping to an eligible target. Disassociation ends the current mapping but retains the allocation for the account. Release returns the address allocation. The distinction matters in a rollback. If the new server is unhealthy and you retained the Elastic IP, you may change its association back to the prior supported target. If you released the address, reuse is no longer assured. A request to reallocate a previously released address is subject to availability and quota, and tags do not automatically return. A release is not an ordinary reversible step in a cutover.

On a host that already has an automatically assigned public IPv4, associating an Elastic IP to the instance or its primary device can release that earlier public address back to Amazon's pool. The old automatically assigned value cannot be preserved by converting it into this Elastic IP. Before moving the mapping, prepare another appropriate access path to the old or new instance. Otherwise an administrator currently connected through the address being changed can lose their session. Do not assume a later disassociation will restore the earlier address. The effective auto-assignment behavior depends on the documented configuration and lifecycle conditions.

If a destination already has a different Elastic IP bound at the same desired mapping, plan how that allocation will be handled. An association can displace the previous Elastic IP while leaving the prior allocation in the account. This can change which clients reach the instance and leave a chargeable record in inventory. Record the exact initial mapping, verify the intended target and account, and inspect both allocations after the change. Avoid reasoning only from a screenshot of an instance that has several addresses or interfaces.

AWS charges for Amazon-provided public IPv4 addresses, including allocated Elastic IPs whether in use or idle, with applicable published pricing and account-specific terms. Check the pricing page and your inventory when estimating a lab budget. For a simple estimate, multiply the billed address-hours by the applicable rate. Two equal-rate allocations held for four hours each give eight address-hours, even if one sits unused for those four hours. An idle address may still be intentionally reserved for a rollback, another approved activity or a controlled integration. Use resource ownership, DNS and dependency records before deciding whether an unassociated allocation can be released.

Work through an address handoff without changing DNS

Suppose the warehouse inventory site uses inventory.example and a single published IPv4 answer in this exercise. Operations has an old server named inventory-a and a prepared candidate named inventory-b. Both use appropriate network interfaces in an eligible network border group. The old HTTP application reports release “blue” and the new application reports release “green.” Both should report the known permitted example item with eight cartons. The customer has no reason to see the underlying private target. The acceptance result is a useful HTTPS response at the same hostname and address, from the intended release, with the expected data.

Start with the baseline. Confirm the account, Region, allocation ID and actual public IPv4. Record the current interface, its private IP, and observed association ID. Find the DNS record and check the data the client actually receives. Check whether IPv6 records, another A record, a CDN, or a load balancer also serve the site. The lesson assumes a simple direct single-A deployment. If other paths exist, moving an IPv4 address may change only one of them. The team should choose a verification plan for each intended traffic path instead of declaring every user moved by observing just one connection.

Prepare the candidate under an authorized test path before giving it the live address. That path can be private. Check the candidate's application runtime, dependencies, version marker and a known read or approved test operation. Verify that it is configured for the real site hostname and its valid certificate. If the data changed during a maintenance window, design how it will remain consistent on both sides of the handoff. An Elastic IP reassociation does not migrate data. It also does not synchronize application sessions or pending writes. Give each important kind of state a separate migration or shared-service plan.

Choose one documented way to transition the mapping. In an approved move, identify the exact old and new destinations and stop or drain affected traffic as appropriate before the change. AWS recommends closing existing active connections for a remap to avoid unexpected behavior. Existing connections were established with the previous server and can fail or need to be re-established. Even if the next connection reaches the replacement quickly, do not promise a zero-interruption result without application and connection evidence. The practice's term “same DNS record” refers to one unchanged address in DNS, not continuous successful requests during the transition.

Once a move is requested, read the address record again. The correct allocation should still show the expected public IPv4 and now list the new interface and private IP. An API success or returned association ID indicates configuration work was accepted. Next, verify the intended public hostname from an external observer, with normal certificate checks. Confirm the connected IP, expected HTTP status and the marker for the intended release. Assert the example business value too. If only a default landing page returns with 200, the traffic might reach a web server whose site configuration still points to the wrong application. A useful status and expected content are different checks.

Keep the old target available for the agreed rollback window when safe and within the budget. Decide whether it should remain running or be stopped based on expected recovery time and the data migration plan. A stopped server can take time to resume and become ready, so communicate what restoring it would require. If the business check fails, verify the old target before restoring its association. Keep the allocation. Revert the mapping using an approved operation and re-read it, then make a fresh external request and confirm the old marker plus current expected data. Rollback is verified through customer behavior rather than inferred from a completed association request.

Match each console or CLI operation to its effect

Start in the correct Region's EC2 console. The Elastic IPs list under Network and Security shows address allocations. On a new disposable lab you can allocate from Amazon's pool in the destination's network border group. Tag the address with a recognizable owner or exercise name. Look at the address and allocation ID once it appears. At this point it is an allocated resource with no association, so it has not changed where any existing host listens. It may already contribute public address-hours to the lab's costs.

To attach a new allocation, select it and open the association action. Choose the intended instance or network interface and private IPv4. Look at any reassociation option before submitting. If this address should be unused, choose an operation that cannot unexpectedly replace an existing mapping. If the change is explicitly a move, use the approved reassociation option and immediately record the newly observed target. If there is more than one interface, check the exact interface and its assigned private address instead of trusting a similar instance name.

The CLI helps you capture machine-readable facts. These read-only examples use shell variables that an authorized operator sets to the intended profile, Region, and resource IDs. The sts command returns the caller identity behind the selected profile. The EC2 descriptions show the actual address mapping and the target's assigned private addresses. They make useful input for a discussion or change record, but you should keep real infrastructure identifiers within your team's normal handling rules. The offline exercise below needs none of these commands or an AWS login.

aws --profile "$lab_profile" sts get-caller-identity --no-cli-pager
aws --profile "$lab_profile" --region "$lab_region" ec2 describe-addresses \
  --allocation-ids "$allocation_id" --output json --no-cli-pager
aws --profile "$lab_profile" --region "$lab_region" ec2 describe-network-interfaces \
  --network-interface-ids "$prepared_eni" --output json --no-cli-pager
aws --profile "$lab_profile" --region "$lab_region" ec2 describe-availability-zones \
  --zone-names "$prepared_zone" --output json --no-cli-pager

Compare the selected account, Region, zone, network border group, network interface, and private address with the approved plan. If an association record shows a different interface than expected, find the current ownership before retrying. The CLI's --dry-run option on applicable EC2 operations checks whether you have permissions for the call and returns a designated response instead of doing the work. It is useful for authorization checks. Permission does not prove that the target has the right data, that traffic will reach it, or that a cutover will meet its service objectives.

The following commands are separately labeled examples for an approved cloud lab, because the association operation changes an AWS resource. Use the first example only for a checked unassociated allocation. The second is an approved change from the current working target to a known replacement. Never execute both automatically as part of a setup script. The current AWS CLI permits reassociation by default, so explicit --no-allow-reassociation matters when you intend to fail if an address is already attached elsewhere. Repeated real association calls can have cost or operational effects. Inspect the recorded target before retrying an operation after an ambiguous response.

# First association, with a guard against replacing another target
aws --profile "$lab_profile" --region "$lab_region" ec2 associate-address \
  --allocation-id "$allocation_id" --network-interface-id "$prepared_eni" \
  --private-ip-address "$prepared_private_ip" --no-allow-reassociation

# Different operation, for an explicitly approved handoff
aws --profile "$lab_profile" --region "$lab_region" ec2 associate-address \
  --allocation-id "$allocation_id" --network-interface-id "$replacement_eni" \
  --private-ip-address "$replacement_private_ip" --allow-reassociation

If someone sees the old private IP after the operation, compare it with the current observed association instead of using a DNS edit as a first reaction. DNS continues to give the requested public address in this case. If the control plane shows the replacement but the user-facing HTTPS request times out, inspect routing, network policies, the guest listener and application readiness. If it connects and receives a certificate error, see whether that candidate answers the expected site hostname with the correct certificate. Keeping TLS verification intact is part of proving the swap didn't degrade the customer connection.

Lab: accept or reject a cutover using saved observations

Use Bash and Python 3 in an ordinary terminal. The lab makes no AWS calls, reads no credentials, and uses a temporary directory for its sample records. All public address and hostname values are reserved for documentation. The Addresses lists resemble selected fields from a real describe-addresses response. The destination and request evidence are separate, normalized teaching observations, not fields AWS inserts in that response. In a real change someone must obtain and verify each observation at the proper place. A Boolean in this sample is a placeholder for actual evidence, not proof that a real security group or certificate is configured correctly.

Step 1. Prepare the expected allocation, targets and checks

set -eu
command -v python3 >/dev/null
umask 077
eip_lab=$(mktemp -d /tmp/rb-eip-plan.XXXXXX)
cleanup_eip_plan() {
  case "$eip_lab" in
    /tmp/rb-eip-plan.??????) rm -rf -- "$eip_lab" ;;
  esac
}
trap cleanup_eip_plan EXIT
cat > "$eip_lab/observations.json" <<'JSON'
{
  "account": "111122223333",
  "region": "us-west-2",
  "host": "inventory.example",
  "address": "198.51.100.27",
  "allocation": "eipalloc-00000000000000027",
  "border_group": "us-west-2",
  "expected_count": 8,
  "old": {
    "id": "eni-00000000000000011",
    "private_ipv4": "10.42.3.15",
    "border_group": "us-west-2",
    "release": "blue"
  },
  "new": {
    "id": "eni-00000000000000024",
    "private_ipv4": "10.42.8.24",
    "border_group": "us-west-2",
    "release": "green"
  },
  "candidate_preparation": {
    "expected_private_ip_on_interface": true,
    "route_and_listener_reviewed": true,
    "tls_and_known_data_verified": true
  },
  "baseline": {
    "Addresses": [
      {
        "PublicIp": "198.51.100.27",
        "AllocationId": "eipalloc-00000000000000027",
        "AssociationId": "eipassoc-00000000000000011",
        "NetworkBorderGroup": "us-west-2",
        "NetworkInterfaceId": "eni-00000000000000011",
        "PrivateIpAddress": "10.42.3.15"
      }
    ]
  },
  "changed": {
    "Addresses": [
      {
        "PublicIp": "198.51.100.27",
        "AllocationId": "eipalloc-00000000000000027",
        "AssociationId": "eipassoc-00000000000000024",
        "NetworkBorderGroup": "us-west-2",
        "NetworkInterfaceId": "eni-00000000000000024",
        "PrivateIpAddress": "10.42.8.24"
      }
    ]
  },
  "restored": {
    "Addresses": [
      {
        "PublicIp": "198.51.100.27",
        "AllocationId": "eipalloc-00000000000000027",
        "AssociationId": "eipassoc-00000000000000035",
        "NetworkBorderGroup": "us-west-2",
        "NetworkInterfaceId": "eni-00000000000000011",
        "PrivateIpAddress": "10.42.3.15"
      }
    ]
  },
  "external": {
    "hostname": "inventory.example",
    "answer": ["198.51.100.27"],
    "connected_ip": "198.51.100.27",
    "tls_verified": true,
    "http_status": 200,
    "release": "green",
    "stock": 8
  }
}
JSON

Read the three address records before running the file checker. The allocated address and its identity are the same in all three. The target changes from the old interface and private IP to the candidate pair, and eventually returns to the old pair. The final association ID is the one from the final observed mapping. Notice that the data class has one observation for DNS and another for the IP the client reached. A DNS result tells you the expected address. The connection evidence says whether the tested client actually used it.

Step 2. Distinguish a ready plan, a correct mapping and a working site

cat > "$eip_lab/judge.py" <<'PY'
from copy import deepcopy
from pathlib import Path
import json
import sys

plan = json.loads(Path(sys.argv[1]).read_text())

def require(condition, message):
    if not condition:
        raise ValueError(message)

def address_record(observations):
    rows = [row for row in observations["Addresses"] if row["AllocationId"] == plan["allocation"]]
    require(len(rows) == 1, "expected exactly one matching allocation")
    row = rows[0]
    require(row["PublicIp"] == plan["address"], "public address value changed")
    require(row["NetworkBorderGroup"] == plan["border_group"], "wrong allocation border group")
    return row

def check_mapping(observations, target):
    row = address_record(observations)
    require(row.get("AssociationId"), "no current association")
    require(
        (row.get("NetworkInterfaceId"), row.get("PrivateIpAddress")) ==
        (target["id"], target["private_ipv4"]),
        "unexpected destination interface or private address",
    )

def check_candidate(account, region, target, preparation):
    require((account, region) == (plan["account"], plan["region"]), "unexpected AWS scope")
    require(target["border_group"] == plan["border_group"], "candidate border group mismatch")
    for key in ("expected_private_ip_on_interface", "route_and_listener_reviewed",
                "tls_and_known_data_verified"):
        require(preparation.get(key) is True, "missing preparation: " + key)

def check_external(evidence, target):
    require(evidence["hostname"] == plan["host"], "wrong hostname tested")
    require(evidence["answer"] == [plan["address"]], "unexpected DNS answer")
    require(evidence["connected_ip"] == plan["address"], "wrong public destination")
    require(evidence["tls_verified"] is True, "TLS was not verified")
    require(evidence["http_status"] == 200, "health route failed")
    require(evidence["release"] == target["release"], "unexpected application release")
    require(type(evidence["stock"]) is int and evidence["stock"] == plan["expected_count"],
            "known inventory result differs")

def expect_rejection(check, reason):
    try:
        check()
    except ValueError as error:
        require(str(error) == reason, f"wrong rejection: {error}")
        print("Rejected:", error)
    else:
        raise AssertionError("unexpected acceptance")

check_mapping(plan["baseline"], plan["old"])
check_candidate(plan["account"], plan["region"], plan["new"], plan["candidate_preparation"])
print("Baseline and prepared candidate agree with this plan.")
wrong_group = {**plan["new"], "border_group": "us-west-2-lax-1"}
expect_rejection(
    lambda: check_candidate(plan["account"], plan["region"], wrong_group,
                            plan["candidate_preparation"]),
    "candidate border group mismatch",
)
wrong_private_ip = deepcopy(plan["changed"])
wrong_private_ip["Addresses"][0]["PrivateIpAddress"] = "10.42.8.25"
expect_rejection(
    lambda: check_mapping(wrong_private_ip, plan["new"]),
    "unexpected destination interface or private address",
)

check_mapping(plan["changed"], plan["new"])
print("Management observation shows the new interface and private IP.")
bad_business = {**plan["external"], "stock": 0}
expect_rejection(
    lambda: check_external(bad_business, plan["new"]),
    "known inventory result differs",
)
check_external(plan["external"], plan["new"])
print("New release and known record pass the external check.")
check_mapping(plan["restored"], plan["old"])
check_external({**plan["external"], "release": "blue"}, plan["old"])
print("Restore case returns the old release with the same address and known data.")
PY
python3 "$eip_lab/judge.py" "$eip_lab/observations.json"

Look for three rejected examples and a passing cutover and restore. A candidate in a different border group fails while the Region still matches. A captured mapping to the correct interface but wrong private IP fails. A green release with a validated connection and HTTP 200 still fails if the product count is unexpected. The passing case requires all three types of evidence. That is why a progress line about the control plane is printed separately from the final usability check.

Changing a value here changes a saved example only. Try changing the test address or the past association ID in your copied JSON and predict which checks are supposed to pass. For instance the checker validates which mapping was seen, but it does not infer real site readiness from an association ID. The explicit expected IPv4 and interface checks are stronger for that purpose. To practise an unexpected account, call the candidate check with a different sample account and confirm the error message names the scope rather than the network group. Keep your actual environment reports separate from teaching records.

Step 3. Remove the sample files

cleanup_eip_plan
trap - EXIT
test ! -e "$eip_lab"
printf 'Local Elastic IP rehearsal files removed.\n'

This ends the local exercise. No public address, association or target was changed by running it. A separately provisioned AWS lab may still contain billable resources. Its owner should identify exactly which allocation and test instance were created for that run, verify they have no consumers, and remove them through the appropriate approved cloud steps. Do not use this scratch cleanup or a broad inventory search to decide which addresses in a shared account can be released.

Record the change as an operational sequence another engineer can recover

Write the start of the runbook as a very short description of the address dependency. For example, “Warehouse scanner clients use one IPv4 allowlist for this hostname. The current mapping terminates on the blue inventory server. Keep the allocation throughout the rehearsal.” That tells the reviewer which source of stability matters. A public hostname under a load balancer, a third-party egress allowlist and a direct site on one instance may require different solutions. A record that just says “move the IP” omits the reason to keep the address and how to tell its move succeeded.

For preparation, record the intended account and Region, allocation ID, exact old association, old and new target pairs, and their network border groups. Add how authorized operations staff will reach both servers while the public path is moving. An SSH session attached to the EIP or to the candidate's replaced auto-assigned address can disconnect. Use a separately prepared access path appropriate to the environment. Also state the planned data method, such as connecting both deployments to one trusted store or deliberately freezing writes while an approved migration completes. Reassociating the public address changes where new connections go. It does not settle which server owns an in-progress write.

For the monitored window, choose a simple scenario with known values. Suppose the inventory should show eight cartons and the new release should identify itself as green. The release marker proves which candidate handled the request. The value tests one important business path. Together they detect a move to the intended network interface whose app still reads the wrong database. Small tests cannot prove every workflow. Add checks for critical customer actions, especially those that interact with login, files or ongoing sessions. When you need a reversible test, prefer a named read probe or approved fixture operation over writing arbitrary production data.

Decide when to stop and who may choose rollback. If the changed mapping is confirmed and external verification still fails after the planned period, record the failure and restore the old target while the previous instance and data path remain usable. If rollback would switch to a stale or incompatible store, follow the preplanned data recovery decision. The operator should not discover that problem after moving the address. Avoid a repeated loop of blind remaps, because that makes the observed destination and service behavior harder to interpret.

Finally, record what the rollback actually returned: same expected allocation, current association to the old target, validated HTTPS, old release marker and correct known inventory. If the new application persisted accepted writes during its short active window, verify how those writes remain available after restoration. Keeping the EIP value and recovering the customer's data are distinct acceptance conditions. That distinction will recur when you study an AMI capture or restore a storage snapshot.

Diagnose an unchanged address that still serves the wrong result

Imagine the allocation now points to inventory-b, but the customer says the inventory site is unavailable. Ask for the exact hostname and request type. A browser may use IPv6 when it has an AAAA record, connect through a corporate proxy, or see a cached page from a separate edge service. Trace the specific client path before concluding that reassociation failed. For a direct IPv4 service, compare the observed DNS answer and connection destination with the address record. Look at the request's actual primary address and the family selected by the client. A network address in a ticket is not a record of how the browser really connected.

Use several precise checks. A DNS lookup from the intended external network answers what address the requested name provides. An HTTPS request proves it can open a connection to a service under that name when the certificate verifies. A response body with the expected release and stock value proves that the intended site and data path responded. A separate smoke test can access the candidate address while preserving the hostname, provided the test path is approved and actually reachable from your test location. This is useful when a candidate must be checked before DNS or an existing address association changes.

curl --silent --show-error --max-time 10 \
  --resolve "$site_name:443:$candidate_test_ipv4" \
  --output candidate-response.json \
  --write-out 'HTTP %{http_code} via %{remote_ip}\n' \
  "https://$site_name/inventory-check"

The test override supplies an address for this particular curl invocation. The URL still contains the real hostname and TLS is still checked normally. Running this command successively against approved old and candidate test endpoints can show which release responds. It does not test public DNS because it overrides resolution for the request. Run a separate ordinary hostname request to check the public client path. If your connection goes through a proxy, understand that path before interpreting the remote address field. Check the output body against its expected representation and status. A transferred HTTP error body does not automatically cause curl to fail without an applicable option or explicit status check.

Observed failureWhat to verify nextA reasonable next decision
Management view points at an unexpected ENIAllocation ID, caller context, current interface and private addressesStop the handoff and resolve resource ownership or use the approved mapping correction
Correct mapping, connection times outActual IPv4 path, subnet route and Internet gateway, permitted traffic and guest listenerDiagnose network or service reachability. Restore previous service if the agreed limit is reached
Connection opens, certificate validation failsHostname used by the client and candidate's certificate and selected host configurationCorrect and retest the candidate or return to a verified previous endpoint
HTTPS 200 with a default page or wrong dataApplication release marker, active virtual host and intended storeTreat business acceptance as failed despite successful HTTP
One test succeeds, other clients report errorsAddress family, DNS answers, cached objects and each intended client pathSeparate path-specific observations and avoid a second blind reassociation

Here is a worked troubleshooting result. The IPv4 address answer is unchanged. A real connection reaches that address with the correct certificate. The stock body says zero and the candidate marker says green. Those facts make a wrong DNS answer or a default unrelated certificate less likely for that test. They also show the customer hasn't received the expected record. Look for the candidate's backend connection, data migration status or caching behavior. The change leader can decide whether to pause traffic, repair data under the plan, or roll back. Don't report “EIP worked” as the resolution of a business-data failure. State the mapping and the app validation as separate results.

A second result is a connection refusal immediately on the intended IP. That may indicate a process isn't listening or that a reachable intermediary actively refused the connection. A timeout is a different observation and can have multiple causes. Read the current app and operating system evidence, add an authorized network-path check, and choose a test that narrows the problem. If the management mapping is correct but a listener never started, reassociating again usually changes little. Confirm the new host has its approved configuration and how it was started. Capture this diagnostic context before removing the old server.

Make address retention and cleanup explicit

Suppose the replacement serves the correct stock for the agreed observation window. The old server can be retired under the team's plan. Start by checking which data, settings or logs the team may still need to recover the app. Stopping the old server can save its compute charge but may leave volumes, snapshots or other allocated resources. Terminating it changes the recovery choices and might remove volumes depending on their settings. The EIP used by the working website must remain mapped. Retiring an instance and releasing a public address are decisions about different resources.

Consider an extra address that was used only to test inventory-b. Before release, verify the allocation ID and ownership tag, check for dependencies such as DNS records, service publication or firewall allowlists, and confirm it is outside the rollback plan. Check the current association view because a test allocation may already have been repurposed. End any permitted association only as required by the cleanup plan. Once the account returns that address, another allocation can receive it. An accidentally released value can break integrations that still use it. Treat reclaiming it as conditional rather than an automatic recovery procedure. For current steps and rules, follow the EC2 release guide.

Sometimes a dashboard flags “unassociated” addresses to help identify possible waste. The flag is an inventory finding. An owner may have deliberately kept one while planning a shift or testing a recovery. Make the decision using lifecycle and dependency context. AWS publishes usage and pricing categories for public IPv4; check current terms for your address origin, account and region rather than assuming every address situation is billed identically. Keep the scope limited to the named practice resources you created. In a shared account, report other idle addresses to their owners without modifying them.

If you need a stable public endpoint and automated failover at the same time, work backward from the service objective. For an address-only downstream allowlist you might choose a documented design with stable addresses and multiple covered entry paths. For a web application that needs several healthy targets, a load balancing architecture with health checks can direct requests across working instances. Different load balancer types and other services expose different endpoints and static-address capabilities. Read their actual supported integration documentation. A single instance association can be part of a runbook; it is one mechanism among several.

At the end, someone else should be able to read your record and determine whether the intended allocation was kept, which private target currently receives it, and which data proof covered the visitor's route. Include the actual external observation window, relevant existing configuration notes, and the cleanup resources you verified. If the operation was a practice replay, label the observations fabricated. Your report should distinguish work done in an authorized live environment from a local check of your reasoning.

Review the reasoning using these examples

Interview questions

When is an Elastic IP helpful during replacement?

It helps when the same static IPv4 address must continue to represent an eligible AWS resource in the same scope. Keep the allocation and move its association deliberately. Prepare the replacement's app, network, certificate and data separately. Document the correct external target and evaluate any interrupted connections during the handoff.

Why can the same Region be insufficient for two candidate interfaces?

The allocation and target must also use the same network border group. A Local Zone can belong to a different group from the main regional zone group. Compare the exact observed group names before planning a move. If the groups differ, plan a supported network or endpoint design rather than assuming a mapping can cross them.

How would you test a replacement without making a DNS change?

Use an authorized candidate test endpoint while preserving the expected hostname and TLS verification. Verify the release and an expected record. After the address move, compare the management record and the normal external hostname path. A pre-cutover test override alone cannot prove what production DNS resolves.

When can you release a retired Elastic IP?

Confirm it is the specific unused allocation, its associations have been handled under the authorized procedure, and known DNS, allowlist and rollback dependencies are removed. Release returns it to AWS. Keeping an idle allocation may continue to cost money, while recovering a released value depends on future availability and quota.

Quick quiz

Which value identifies the current mapping when you want to document a disassociation?

The observed association ID. The allocation ID identifies the address resource. After a move, read the fresh association ID instead of assuming an earlier mapping still exists.

The new mapping is correct and HTTPS returns 200, but the business data differs. Is the cutover accepted?

The data check failed. The management result and successful connection cover only parts of acceptance. Diagnose the candidate store or approved rollback before claiming the customer path is healthy.

Does a running server's outgoing IP check prove that inbound website requests work?

Use an independent inbound request. The outgoing test measures what the remote receiver saw for one path. A website needs functional incoming routing, allowed traffic, a listener and the expected app response under the real hostname.

Practice tasks

  1. Alter the sample candidate evidence so the network group is correct but its private-IP review is missing. State which observation you would collect to approve the destination.
  2. Write a short runbook for restoring the old target after the candidate returns the wrong release. Include the retained allocation ID, target pair, fresh association lookup, the unchanged DNS requirement and a fresh app check.
  3. Draw two diagrams for the documented example. Show the same published address leading to different private targets before and after the change, and the three independent acceptance checks.

Keep the allocation

The public IPv4 remains stable while the allocation survives. Change the association to an eligible target.

Target both interface and private IP

Match the Region and border group, then confirm the exact destination pair.

Prove the public path

Check DNS, actual connection, validated TLS, release marker and known data.

Clean up by owner and dependency

Disassociation keeps the allocation. Release requires checking its consumers and planned use.

Official references