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

Chapter 15: Amazon VPC — Subnets, Route Tables, NACL, NAT Gateway and Bastion Host

AWS Cloud

15.2 How to create a custom VPC and choose its CIDR block

Now let's build our own society. First question: how big is the society? That is, how many IP addresses will we need – this is the CIDR. So the very first job – choose the IP range. Make this decision once and think it through, because the primary CIDR of a VPC cannot be changed later.

A CIDR block such as 10.0.0.0/16 describes a range of IP addresses. An IPv4 address has 32 bits. The number after the slash tells how many of those bits are fixed (the network part). The remaining bits are free for hosts:

  • /16 → 16 bits fixed, 32 − 16 = 16 bits free → 2^16 = 65,536 addresses.
  • 10.0.0.0/16 therefore runs from 10.0.0.0 to 10.0.255.255.
  • Count it like on the board: 10.0.0.255 + 1 = 10.0.1.0, and so on up to 10.0.255.255.
CIDR Free host bits Total addresses Typical use
/16 16 65,536 A whole VPC (the largest AWS allows)
/20 12 4,096 Default subnets in the default VPC
/24 8 256 A normal custom subnet
/26 6 64 A small subnet
/28 4 16 The smallest VPC or subnet AWS allows

Formula: addresses = 2^(32 − prefix). A bigger number after the slash means a smaller network.

Which ranges should I use?

The RFC 1918 private-use ranges are common choices for an internal VPC IPv4 plan. Confirm availability with the network owner.

Private range CIDR Addresses
10.0.0.0 – 10.255.255.255 10.0.0.0/8 16.7 million
172.16.0.0 – 172.31.255.255 172.16.0.0/12 1 million
192.168.0.0 – 192.168.255.255 192.168.0.0/16 65,536

A standard IPv4 block for an AWS VPC is sized from /16 through /28. Select a suitably sized, canonical range inside your approved pool and check the actual addresses of connected VPCs, offices and clients. The initial default CIDR is a common overlap to review. You cannot remove the primary IPv4 CIDR. Additional blocks are subject to AWS association restrictions and quotas.

Create the VPC in the console

  1. Open VPC → Your VPCs → Create VPC.
  2. Resources to create: choose VPC only. (VPC and more builds subnets, route tables, an internet gateway and optional NAT gateways in one go. It is great later; in this chapter we build each piece by hand to understand it.)
  3. Name tag: society-vpc.
  4. IPv4 CIDR block: IPv4 CIDR manual input → 10.0.0.0/16.
  5. IPv6 CIDR block: No IPv6 CIDR block. Tenancy: Default.
  6. Click Create VPC.
  7. Select the new VPC → Actions → Edit VPC settings → review Enable DNS hostnames and Enable DNS resolution. Save settings required by your approved project. Hostname assignment depends on the applicable settings and addressing.

For an approved command-line build, use the AWS CLI create-vpc reference. Select the intended account and Region and verify the approved address allocation. Use the VPC ID returned by that creation and wait until it is available before issuing dependent commands.

A new VPC automatically gets a main route table (with only the local route), a default network ACL (allows all) and a default security group. It has no subnets and no internet gateway yet.

Ravindra Bagale's Tip

Draw the planned subnets first. Size each for the interfaces the workload needs at peak and reserve approved growth space. Choose a VPC CIDR that contains those ranges without collisions. You cannot remove the primary IPv4 block later.

Lab

Start with the offline worksheet below. If you also have permission for a cloud exercise, use VPC only in the designated sandbox with the approved CIDR. Check the main route table and default network ACL recorded for the new VPC. Follow the owned sandbox cleanup procedure afterwards.

Put the address decision before the Create button

The training centre is moving its course registration system into a custom Virtual Private Cloud. The website will face visitors, the application will process bookings, and the database will retain them. The owners want those components in two Availability Zones. The finance department also has a network that the new application may need to contact next year. Choosing an address range now affects future connections, growth, and how easily the team can operate the three parts. Start with a small written plan before filling in the console.

Write the requirements in the team's own words. The project needs space for web entry, application capacity and database placement in both zones. It needs some spare addresses while replacing an old release, because the running release and the candidate can overlap in time. Reserve expansion for endpoints or another app without treating those additions as already deployed. Collect the ranges of networks the app may need to connect to later. A private network can be unused in this account and still conflict with a separate office or company VPC.

An address block represents the set of addresses that can be allocated under a plan. It is like a block of assigned room numbers for several buildings. Think of a subnet as a contiguous slice of those numbers reserved for a particular placement. The analogy only describes allocation. Networking still relies on the actual addresses, prefix rules and resource configuration. VPC creation allocates the network scope. It does not create an application listener or grant network access based on the choice of numbers.

In this lesson we use a fictional centre and invented existing allocations. You can work through the reasoning and run the worksheet with Python and no AWS credentials. The decision belongs to the owner of the real address plan. You should never take a range from a worked example as evidence that it is available in your organization. When you are authorised to create a sandbox VPC, use the selected account, Region and approved range for that environment.

Read the slash as a count of fixed bits

IPv4 writes an address as four numbers separated by dots. Each number stands for eight bits, so the address has 32 bits in all. A CIDR prefix such as /24 says that the first 24 bits identify the address range. The remaining eight bits vary within that range. There are two possibilities for each varying bit, so eight varying bits allow 256 addresses. That calculation counts all positions in the range. Services may reserve some of those positions or need extra capacity for a managed resource.

For 10.76.10.0/24, the first three numbers stay the same. The last number goes from zero through 255. An address of 10.76.10.40 is in the range and 10.76.11.40 is outside it. The subnet plan does not reserve extra addresses by incrementing a number outside those boundaries. In a larger range such as 10.76.0.0/16, the first two numbers stay the same. The last two together represent the 65,536 addresses from the start to 10.76.255.255.

The next step is understanding sizes that do not end neatly on a dot. A /22 fixes 22 bits, leaving ten variable bits. It holds 1,024 addresses. Since each block with a fixed third number provides 256, this prefix spans four adjacent values of the third number. The starting number has to be aligned to a multiple of four. 10.76.8.0/22 therefore covers third numbers 8, 9, 10 and 11 in their entirety. You can divide it into four /24 ranges. The number after the slash has grown by two, which means two more fixed bits and four times as many equal child ranges.

Now try an intentionally messy proposal, 10.76.10.12/22. The input includes an address inside a slash-22 range rather than the start of that range. If an application canonicalizes it, its first address is 10.76.8.0 and its last is 10.76.11.255. AWS documents canonicalization of the supplied IPv4 block when creating a VPC through an API or command line. The planning worksheet rejects noncanonical notation early so the person reviewing it must confirm the intended range before any creation. Otherwise the shortened form can hide your actual overlap with an important subnet.

Practice starting from a destination and deciding what range contains it. If an IP is written as 10.76.11.207, check the boundaries of the slash-22 example. It belongs there despite having a different third number from the starting address. If an IP is 10.76.12.1, it is beyond the last address. Reading the address as a sortable number with a range works for all valid prefix lengths. Comparing only the first two dotted fields could be too broad, and comparing all four fields would never find a different address in the same range.

One simple way to remember the direction is to ask what would happen if you fixed one more bit. You get half as many possible addresses in that one block. Moving from slash 24 to slash 25 cuts 256 possible positions to 128. Moving in the other direction doubles them. This gives a fast way to check your own spreadsheet. If you ask for a slash 24 and the worksheet displays thousands of addresses for it, recheck the formula before using the rest of the plan.

Choose a block from the organisation's approved pool

IPv4 private-use space is defined by RFC 1918. The three blocks are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are common sources of internal address space. This does not make any one range available for your team. An organisation may already have allocated part of one block to an on-premises site, another project, a Kubernetes environment or a connected service. Separate networks can reuse private addresses only while their routing and connection requirements allow that. Write the intended reachability alongside the range.

Look beyond an account's current VPC list. It usually shows only the resources visible in the selected context. Other accounts, a different Region and the company VPN do not all appear as VPC entries there. A network owner or address register can tell you which allocations might collide. Some customised designs use a managed pool through Amazon VPC IP Address Manager, or IPAM. It can track address planning and allocation across supported accounts and locations. In that workflow you use the allocation rules of the relevant pool instead of claiming the first empty block you happen to see.

Consider a proposal of 10.76.0.0/20. It covers third numbers zero through fifteen. The finance department already uses 10.76.5.0/24. These two blocks overlap even though their displayed starts are different. If the centre puts a local resource at an address the finance network also uses, a private client cannot distinguish the destinations by typing the same address. Certain connectivity services reject overlapping CIDRs. AWS VPC peering rejects overlapping VPC blocks. A proposal that cannot provide the needed connection is a design issue to fix before launch.

A colleague has a home network of 192.168.1.0/24. The centre should not assume every home network has those numbers or reject the entire larger range merely on that assumption. Evaluate the access design and the actual addressing requirements with its owner. Likewise, the default VPC initially uses 172.31.0.0/16 in a Region. That is a common conflict to check. A default VPC that stays disconnected from the new system raises a different problem from one that must be connected so traffic can reach a shared dependency. Valid syntax does not resolve the decision.

A team can tag the approved range with a project and record its allocation date, region, owner and planned links. The note should say why the block was selected and who verified the connected networks. If the private endpoint plan changes, run the overlap review again for the new route. Time spent on this small record helps another person distinguish a deliberately reserved growth range from a range accidentally left unused. The worksheet should also identify each suggested subnet's exact parent allocation.

Size each placement for peak occupancy during a change

Calculate the smallest useful unit first. The application is planned to run in two zones. The centre may have 20 app interfaces in each zone during ordinary operation, then run 20 new copies alongside 20 earlier ones during a deployment. Imagine up to 10 further IP allocations in each app subnet during expansion and recovery, based on the owner's service plan. A review figure of 50 per app subnet is more informative than writing 40 machines total across two zones. Subnet capacity is local to that subnet. Spare addresses in the other zone are not automatically assigned to an interface in this one.

Ordinary AWS IPv4 subnets reserve five addresses. A slash 27 has 32 total addresses and thus 27 usable under this reservation assumption. It is too small for the app's example requirement. A slash 26 has 64 total positions and 59 after the five reservations. It fits a proposed 50-address peak with a limited margin. A slash 25 has 128 total positions and 123 after reservations. The right choice comes from a record of demand, available space and required margin. Service-specific scale limits or documented subnet sizing requirements can justify choosing more room.

Also consider load balancers, data services, private interface endpoints, and resources that create additional interfaces as they scale. In the worksheet the web entry's 24-address budget and the database's 12-address budget are planning inputs selected for the example. A cloud deployment has to use the actual service documentation. An internet-facing Application Load Balancer, for example, has AWS requirements for selected Availability Zone subnets, including a minimum prefix size of slash 27 and at least eight free addresses per subnet for making scaling possible. A bare arithmetic prediction does not establish current available addresses. In that case read the actual subnet's remaining capacity, even if the size passes the initial test.

For the teaching plan use two web slash-26 subnets, two app slash-26 subnets and two data slash-27 subnets. Their raw sizes add up to 320 positions. Saying the VPC should have precisely 320 addresses makes no sense in CIDR: these blocks have power-of-two sizes and alignment constraints. A slash-23 VPC has 512 positions in one aligned range and can accommodate that arrangement if allocated carefully. A slash-22 gives 1,024 positions. We use it in the centre's worked plan because the team expects to test new endpoint placements and a recovery workflow. A different organization might choose an efficient slash-23 with a documented expansion path.

Check each prefix against current AWS rules. The standard allowed IPv4 block size for a VPC allocation and ordinary IPv4 subnets spans slash 16 through slash 28. Slash 16 is the largest individual IPv4 block in the standard size range. An eligible VPC may have additional associated address blocks, subject to restrictions and quotas. A worksheet should verify those association constraints rather than treating a secondary block as a way to undo every primary decision. Service requirements and organization policy can narrow what is usable even within the broad AWS size limits.

Capacity calculations should answer the date and scenario they cover. If the plan uses two availability zones and a team suddenly decides a third is needed, ask which subnets must be replicated and how traffic and database placement would change. If release strategy changes from in-place replacement to running two complete sets at once, peak occupancy changes. If a new service allocates an interface in each selected subnet, reserve its addresses there. A number on its own is less useful than a number backed by a service configuration and an event that reaches peak usage.

Check the layout for containment, alignment, and overlap

Use a new candidate of 10.76.20.0/22. The third number 20 is aligned to the slash-22 boundary and the range ends at 10.76.23.255. It has no overlap with the sample finance slash-24 under the 5 range or the prior database test area under the 16 range. The first slice for web A is 10.76.20.0/26. A slash 26 leaves six varying bits, so its address span reaches through 63. Web B starts at 10.76.20.64/26 and ends at 127. These are adjacent, disjoint ranges. They are placed in different zones by your later subnet choices, not by their address endings.

The next two slash 26 ranges in that same third number go from 128 through 191 and 192 through 255. Reserve those for application A and B. Start data A at 10.76.21.0/27 and data B at 10.76.21.32/27. The slash-27 addresses are grouped in intervals of 32. Both data ranges are still inside the parent. Record the range that is reserved after the data tier so a future request can use an aligned slice without colliding. The worksheet intentionally leaves the unused space unassigned.

Recheck a deliberate mistake. Someone suggests 10.76.20.160/27 for a small endpoint group. It is a real slash-27 boundary, but the resulting 160–191 range falls inside the larger app A allocation of 128–191. An allocation can be properly aligned and still overlap. In contrast a proposed subnet of 10.76.24.0/26 does not overlap those six subnets, yet it lies outside the selected VPC range. It is unsuitable without a valid parent association. Check both rules even if one appears to pass.

One question can save time in a group review. Ask the person proposing each range to show its first address and last address, including the last included address. A boundary issue is obvious if one subnet's first address falls within another one's span. Then show which zone and role will use it. Address capacity and placement are different checks. If the two app subnets are accidentally proposed in the same AZ, they can have perfectly valid ranges while failing the placement requirement. Put role, zone and capacity on the same line for each part.

Create only the network scope your plan calls for

For a permitted sandbox build, select the correct AWS account, Region and VPC console. The VPC-only workflow is useful for learning because you can inspect its starting network objects one at a time. Open Create VPC, choose VPC only, enter the approved tag and select the source for the IPv4 range. Use an approved IPAM pool if that is how your environment allocates space. For manual entry use your checked canonical CIDR. Decide whether IPv6 is part of the design and choose the tenancy option that fits the exercise. A standard introductory IPv4-only plan can use Default tenancy.

The separate VPC and more workflow creates additional network resources according to your choices. Look at the number of AZs, public and private placement, subnet CIDRs, gateways, endpoints and DNS choices. The useful outcome of the first exercise is understanding what exists after creation. A wizard may save time for a later design. Its defaults still deserve review because unused gateways and endpoints can affect cost and a route table can enable paths you did not intend to build.

When the VPC is available, verify its ID, account context, Region and actual IPv4 range. Use the association state to distinguish a submitted change from an allocated block ready to use. Open the route tables filtered to your VPC and record the main table ID and its local route. Record the new network ACL and default security group, and check the Subnets and Internet Gateways inventories for that VPC. With the VPC-only exercise there should be no new subnet or attached internet gateway. That absence matches the requested starting point. A VPC is ready for the planned subnets; it is not ready to provide the timetable yet.

VPC DNS settings serve different functions. DNS resolution enables use of the Amazon-provided resolver. The DNS hostnames setting affects assignment of suitable public DNS hostnames; together with DNS support, it is also required for some private DNS features such as private hosted zones or private DNS with interface endpoints. It does not assign a public IP address, create an application DNS record, or attach a gateway. Enable the DNS settings required by your approved project. Confirm what name you intend to resolve and from which network, then observe the returned records later when the service exists.

For a team using infrastructure as code, the address worksheet still comes first. Store the reviewed input in that tool's parameters or approved configuration. Compare expected and actual IDs, and review its proposed resource changes before applying. Use the same evidence if creating through the console manually. Discovery by name alone is weaker than confirming the returned ID and ownership. A successfully submitted call is not the same result as seeing an available VPC with the intended associations and no unexpected generated paths.

Run a local planning worksheet before requesting a VPC

You need Python 3 and a terminal. The standard library understands canonical network addresses and can tell whether ranges overlap. The first two candidates in the lab are intentionally wrong. Predict which one overlaps an existing network and which one's typed address is inside the range instead of at its head. The final candidate is the VPC range we used for the six planned subnets. The example verifies ordinary IPv4 reservation arithmetic and checks peak requirements before printing a possible allocation.

python3 - <<'PY'
from ipaddress import IPv4Network
from itertools import combinations

existing = {
    'finance': IPv4Network('10.76.5.0/24'),
    'service-test': IPv4Network('10.76.16.0/23'),
}
proposals = [
    '10.76.0.0/20',
    '10.76.21.1/22',
    '10.76.20.0/22',
]
approved = []
for text in proposals:
    try:
        candidate = IPv4Network(text)
    except ValueError:
        print(f'{text}: use canonical {IPv4Network(text, strict=False)}')
        continue
    conflicts = [name for name, assigned in existing.items()
                 if candidate.overlaps(assigned)]
    if conflicts:
        print(f'{candidate}: overlaps {", ".join(conflicts)}')
    else:
        print(f'{candidate}: no overlap with the sample allocations')
        approved.append(candidate)

assert approved == [IPv4Network('10.76.20.0/22')]
parent, = approved
placements = [
    ('web-a', '10.76.20.0/26', 24),
    ('web-b', '10.76.20.64/26', 24),
    ('app-a', '10.76.20.128/26', 50),
    ('app-b', '10.76.20.192/26', 50),
    ('data-a', '10.76.21.0/27', 12),
    ('data-b', '10.76.21.32/27', 12),
]
networks = {}
for name, text, peak in placements:
    network = IPv4Network(text)
    assert network.subnet_of(parent)
    usable = network.num_addresses - 5
    assert usable >= peak
    print(f'{name}: {network}, {usable} usable, {usable - peak} spare at peak')
    networks[name] = network

assert all(not left.overlaps(right)
           for left, right in combinations(networks.values(), 2))
assert networks['app-a'].overlaps(IPv4Network('10.76.20.160/27'))
assert not IPv4Network('10.76.24.0/26').subnet_of(parent)
used = sum(network.num_addresses for network in networks.values())
assert used == 320
print(f'{parent.num_addresses - used} raw positions are outside the six allocations.')
PY

The first printed rejection is finance overlap. The network objects understand complete ranges, so the code finds the conflict without comparing equal strings. The second output shows the corrected canonical start and stops that proposal. Although normalizing it gives the same candidate as the third example, the first notation is ambiguous to a reader and should be confirmed before use. The third output confirms no overlaps in this supplied list. That evidence does not establish the real organisation's allocations. Bring an approved wider inventory to your own decision.

The web rows show 59 usable addresses each and 35 spare at the stated peak. The app rows also show 59 usable, with 9 spare at the higher demand. The data rows show 27 usable with 15 spare at peak. The last line counts 704 raw positions outside those six ranges. Those positions are not 704 available IPv4 attachments. Some will become reservations when future subnets are created, and their shape matters for the size of a future requested subnet. The verified output simply shows the amount of raw parent space not allocated to the example's existing six slices.

Try reducing an app subnet to an aligned slash 27 while leaving the estimated peak of 50. The assertion should now stop because there are only 27 usable under this exercise's assumption. Predict the answer before typing. Restore the original. Then try adding a nearby allocation to the existing list and compare which parent candidate remains valid. If all proposals are rejected, the later assertion correctly refuses to continue with the preselected value. Do not remove the assertion to make the run pass. Give the plan a genuinely suitable range and then calculate new nested subnets inside it.

The worksheet has no cleanup steps because it stores data in process memory and does not contact AWS or your network. If you used a copy in a local editor, you may keep it as part of your planning notes. If you also performed an authorised VPC-only build, record only the new sandbox VPC ID. Before removing it, check it still has no dependent resources and use the owned sandbox network's delete workflow. New subnets, endpoints or instances created later need dependency-aware cleanup first. Keep the initial site's VPC, default VPC and unrelated resources outside that action.

Explain what happens when the primary range no longer fits

A VPC's primary IPv4 CIDR is not something you can remove and replace in place. Depending on current conditions and quotas, you may be able to associate another suitable block. This makes a new source of address space for new subnets. It does not expand the current subnet's range or move its existing interfaces to new addresses. A team that wants to remove used legacy space may need a planned migration with new placements or a separate VPC under a new plan. Determine who is affected before making assumptions about a safe path.

Check the secondary plan against current associations, allowed range combinations, routes and external dependencies. Some IPv4 block associations are restricted by existing routing and address choices. VPC peering and other connected systems have their own constraints. If a new range is acceptable to the VPC but is not routed from the on-premises network, the workload may still fail its actual job. Update the route and policy design where applicable with the responsible owners, and decide how to test traffic in both directions with the correct source identity and DNS answers.

When you compare the options, state the scope of the change. A new application placement can be created, tested, and given traffic after its dependencies are working. Removing a secondary block is possible only when dependencies and subnets in that block have been removed. This change is different from deleting an entire VPC. A primary renumbering plan can affect data access, internal names, security rules, and existing network integrations. Record the order for testing the new path, switching the application and identifying rollback conditions rather than relying on a click that appears to change a displayed number.

Compare two plans that both fit the first release

A small organization has two approved choices. It can reserve the whole slash 22 for the centre now, or it can allocate the first slash 23 and hold the adjacent slash 23 under a wider plan. Both approaches have room for the six subnets. They differ in which address space is already part of the VPC, who can allocate the balance, and how the next workload gets a network placement. When someone says the small plan has space for 192 more addresses, ask whether the remaining free ranges can fit the requested blocks. Unstructured free positions are not equivalent to an aligned range of the same size.

Work out the smaller allocation on paper. 10.76.20.0/23 spans third numbers 20 and 21. The four slash-26 subnets fill the entire third number 20. The two data subnets use values zero through 63 in the fourth field under 21. The free tail there begins at 10.76.21.64 and ends at 10.76.21.255. There is an aligned slash-26 slot from 64 through 127 and an aligned slash-25 slot from 128 through 255. A new slash 24 needs 256 contiguous aligned positions, so the free tail cannot provide it. Even a plan with enough total unused positions across several disjoint ranges must satisfy the required alignment for the next subnet.

The first request for expansion is a small pair of endpoint subnets. In the smaller initial VPC the first free slash 26 can split into two slash 27 slices starting at 64 and 96. Their roles and exact zones can be recorded now. The remaining slash 25 starting at 128 stays available. Suppose the next request is a new app placement that requires one entire slash 24. The owner then needs a suitable separate associated block, a redesign, or an alternative placement. Reserving space with a name in the spreadsheet helps only if the actual address owner protects that allocation and the VPC can associate it when needed.

With the full slash 22 already allocated, the unused third numbers 22 and 23 are inside the VPC. A future slash 24 can be carved out at either aligned start. This saves an association change but also commits more of the organisation's pool to the centre. The difference would be important if multiple similar training teams will need their own ranges. A reviewer can compare expected expansion with the cost of holding too much organisational address space. Ask for a clear owner and reason for any reservation. The CIDR table then becomes an operating plan rather than a set of large guesses.

Try another prioritization. The centre is sure it needs six initial placements and is unsure whether the new endpoint set is approved. A network owner might allocate the smaller block, mark the adjacent one as a pending reservation with an expiry, and recheck when the project is approved. Another network owner might allocate the larger scope now because the migration team must confirm all intended ranges and future firewall objects in one audit. Both decisions need a written trigger for revisiting the assumptions. Note which service events require additional addresses and what the current peak actually measures. If a decision depends on deploying into another Region, it involves a separate VPC in that Region even when its pool is centrally managed.

Hand off an address plan a reviewer can verify

Imagine a colleague covering the project tomorrow. They should be able to verify the plan without reconstructing every number in your notebook. Give them the proposed VPC range and its exact intended AWS context. Indicate whether the stated range is an approval request or an actual associated resource. Include a list of source inventories and the date they were checked. Mark each candidate subnet's role, intended Availability Zone ID, first and last address, expected maximum use and reserved expansion. A reviewer must be able to match those rows to console fields after creation. Use separate columns for desired and observed values if any resources already exist.

Next separate allocation from access rules. The worksheet assigns addresses to the application and database placements. It does not grant any process access to database port 3306. The network design separately assigns route tables and security controls to the required connections. Avoid assuming that every address in a large VPC range should be allowed to reach the data service. A source rule that describes a whole CIDR has a different scope from a security group reference where supported. Make clear which interfaces and purposes the future rule will cover. An address planner can flag the question even if another owner maintains the application policy.

Watch for confusion about the report of available addresses. The planning figure of 59 usable addresses in a slash 26 is a maximum after the teaching reservation. A console number for a running subnet reflects the currently available addresses after allocations. It can change due to instance replacement and managed resources that create interfaces. An operator investigating a deployment that can no longer launch at peak should compare the remaining count with prior usage and the needed new allocations in that exact subnet. If a deployment creates two new interfaces before removing two earlier ones, it may fail with fewer than two free even though it would return to its previous steady state after success.

Apply that question to a promotion from a training environment. The worksheet shows the project fits with 9 planned spare addresses per app subnet. The actual console shows only 6 free just before the next deployment, and the release plan needs to create 10 more interfaces at once. The decision point is the six actually free positions and the current plan, not the old nine-spare calculation. Review the changed allocations and avoid deleting interfaces on the basis of their names. Determine whether to change release batch size, reserve added capacity through a planned subnet, or update another documented assumption. Verify that the corrective choice also fits the app's availability requirements.

If the review discovers that an address plan was entered incorrectly, check whether it is a typo in the plan or already an allocated resource. For a fresh mistake, correct the written proposal and replay the overlap and capacity checks. For an attached block that has dependants, inspect the actual subnet and resource relationships before designing replacement. The VPC's primary range should be treated as a long-lived design decision. Treat a secondary range as its own allocation with dependencies. The review grows naturally into a change record as soon as people begin to build on the plan.

Discuss address size, allocation, and future changes

Why would you choose a slash 22 instead of a slash 16?

I would choose the approved block that fits estimated peaks and deliberate growth. The centre's six planned slices occupy 320 positions and a slash 22 has 1,024 in total. It fits the example. A slash 16 would make more space available within that one network, but may waste space from a finite organizational pool or collide with other allocated ranges. The right size also depends on reservations and per-service needs in each proposed subnet, and on whether future changes need another zone or several interfaces at once.

Two ranges have different first addresses. How do you decide whether they overlap?

Calculate both final addresses and compare the entire ranges. The first address of the finance slash 24 is different from the proposed slash 20, but all finance addresses fall within that candidate. Check ranges from both VPCs and connected private networks. I would show a direct example of the intersection and keep competing allocations out of the design or agree on a separately engineered connection.

Does VPC creation immediately give you a public EC2 deployment?

VPC only creates the virtual network and its initial objects. The project still needs suitable subnets, resources and explicit connectivity. Create or choose these according to the described paths. A public service will also need the right addressing, policy and a running listener. I would verify the resources returned by AWS and test the intended end-to-end operation once it has been deployed.

Can a secondary CIDR resolve every address shortage?

It can add new space if the requested block follows AWS and organization constraints and the intended network paths can use it. Existing subnets keep their ranges. A tier unable to expand within a small existing subnet may need additional placements and an application rollout rather than an address block change alone. Validate identity, placement, actual capacity and connectivity in the candidate before directing work toward it.

For a practical interview follow-up, describe which team would sign off each stage. The network owner can approve the range and verify conflicts. The application owner can estimate peak address use and verify the real operation. The operator can compare the returned VPC and subnet IDs with the plan. If a diagram and the actual subnets disagree, investigate the change history and current dependencies. A worksheet is a starting design artifact. Record the result of any approved changes alongside it so the next person knows which state was tested.

Practice reading the plan without opening AWS

  1. How many total IPv4 positions are in a slash 26 and what part changes compared to a slash 24?

    Answer and reasoning

    A slash 26 leaves six varying bits, giving 64 positions. It fixes two more bits than a slash 24, giving one quarter of the 256 positions. Subtract the applicable AWS reservations to estimate usable positions.

  2. Does 10.76.22.9 belong inside 10.76.20.0/22?

    Answer and reasoning

    Yes. The slash-22 range spans third numbers 20 through 23, across all fourth-number values. It is inside the VPC allocation but it is not in any of the six sample subnets.

  3. Both application zones have 19 active instances. Each zone needs 19 more during rollout and 10 interfaces for other uses. Does a slash-27 subnet per zone suffice in this exercise?

    Answer and reasoning

    No. Each needs 48 addresses at peak and an ordinary slash 27 has 27 usable positions under the five-address reservation. Size the subnets individually and include service requirements and room for growth.

  4. What should you do if the chosen allocation overlaps the office range and those networks must be connected?

    Answer and reasoning

    Return to the address plan with the network owner. Choose another approved nonoverlapping block or get a specific alternative design reviewed. Using the same strings in two disconnected test environments is not proof that a connection between them will work.

Revision cards for a new address plan

Prefix and usable space

For IPv4, the total size is two raised to the number of unfixed bits. Compare usable addresses after applicable reservations with real peak per subnet.

Three allocation checks

Read the canonical start, verify containment in the intended VPC, and check overlap against all relevant existing ranges.

Creation and connectivity

VPC only creates a network and its initial objects. Workload placement, actual routes, addressing and permission need their own configuration.

Primary and secondary ranges

Review additional block constraints before extending. A secondary allocation supplies room for new subnets without changing existing subnet sizes or replacing the primary block.

Official references