NW4-Launching VPC Resources
NW4-Launching VPC Resources
DIFFICULTY
Mildly Spicy
TIME
60 min
COST
$0
AWS SERVICES
Amazon VPC
Amazon EC2
What you've learnt from your first three networking projects of this series!
Now we're going to level up by launching resources into our VPC - you'll also learn some handy EC2
concepts along the way!
3. ⚡️Use the Amazon VPC's wizard to create VPCs at a lightning fast pace.
Today's game plan.
Want a complete demo of how to do this project, from start to finish? Check out our 🎬 walkthrough
with Natasha 🎬
How much support and guidance do you want? There are two ✌️equally awesome ways you can
complete your project.
#1 - Low Touch
#2 - High Touch
Welcome to the high-touch guidance version of this project. We'll guide you through this project
step-by-step.
Let's go!
📣 Delete all your resources by the end of the day, even if you don't finish the entire project.
If you're EVER stuck - ask the NextWork community. Students like you are already asking questions
about this project.
✍️Step #0
Fill out all the tasks in this project to get your own documentation automatically generated for you
(wooohoooo)!
1. Documentation is PERFECT for adding to your resume or LinkedIn to showcase your hands-
on experience.
2. You'll delete your AWS resources by the end of this project, so you need documentation
as proof of your work and learnings!
3. 💪 Writing documention is a highly valued skill that gets better with practise - start building
your documentation muscle now!
Your answers go directly into your documentation, so spend some time writing these out carefully if
you want your final document to look its best.
🔥 Hot tip
You can't edit your responses or screenshots once you submit them.
Double check your screenshots and proofread your work before clicking Done at the end of each task
box!
☁️Step 1
We're repeating our steps from the first three networking projects to set up our VPC, subnet,
internet gateway, route table, security group, network ACLs and private resources too.
What a list, you're going to crush it!
Create a VPC
Off we go! Your VPC is the foundation of this project and represents your corner of the AWS Cloud.
VPC
Make sure you're on the Region that's closest to you. Use the dropdown on the top right
hand corner to switch Regions.
Name tag:
NextWork VPC
IPv4 CIDR:
10.0.0.0/16
Create Subnets
Nice! We've created our VPC, so it's time for the next step...creating a public subnet. Subnets are
subdivisions within your VPC where you can launch AWS resources, think of them as
suburbs/neighborhoods within your city.
VPC ID:
NextWork VPC
Subnet name:
Public 1
10.0.0.0/16
10.0.0.0/24
Choose Save.
Time to connect our VPC to the internet! Let's create an internet gateway.
Name tag:
NextWork IG
Select your newly created internet gateway and choose Actions, then Attach to VPC.
Select NextWork VPC.
Even though you've created an internet gateway and attached it to your VPC, you still have to tell the
resource in your public subnet how to get to the internet.
You'll have to set up route tables to direct traffic from your resource to your internet gateway!
Check out the Routes tab for both, and note that they have different routes.
This route table has a single route that allows traffic within the 10.0.0.0/16 CIDR block to
flow within the network.
There is no route with an internet gateway as the target! This means there is no route for
traffic to leave your VPC.
Select the checkbox next to your NextWork VPC's default route table - this is the route table
with a single route to 10.0.0.0/16.
Select the pencil icon in the Name column of your route table.
Destination:
0.0.0.0/0
💡 Why is the destination 0.0.0.0/0?
0.0.0.0/0 means all IPv4 addresses! When you set 0.0.0.0/0 as the destination in a route table, you
are creating a default route that sends any traffic that doesn't match more specific routes on your
route table.
Step 1: A
real conversation between internet-bound traffic and your route table.
Under the Explicit subnet associations tab, choose Edit subnet associations
Select Public 1.
Ayyy nice! Your subnet is now public because it is connected to the Internet via the internet gateway!
A security group controls which traffic can enter or leave a resource based on its IP address,
protocols and port numbers. Security groups don't attach to a VPC or a subnet, they attach to a
specific resource within that VPC/subnet.
Step 1: Let's create a security group.
Note that we won't be creating the diagram's EC2 instance in this step, but we're adding it to this
diagram to illustrate a security group's scope!
Description:
Examples of inbound data: Visitors to your website hosted on an EC2 instance in a public
subnet, your website receives form submissions.
Examples of outbound data: Your server requests data from another service, sends out an
email notification.
Type:
HTTP
Source:
Anywhere-IPv4
Nice, that's your traffic flow (route table) and basic security (security groups) sorted for your VPC!
To level up your VPC's security, let's add a network ACL i.e. network access control list. Think of
Network ACLs as community guards stationed at every entry and exit point of your subnet, checking
each data packet against a table of ACL rules before allowing them through.
Choose the network ACLs that's associated with your Public 1 subnet, and rename it to
💡 What do the rules under the Inbound and Outbound rules tabs mean?
Just like security groups, network ACLs use inbound and outbound rules to decide which data packets
are allowed to enter or leave subnets:
Rule 100 Inbound allows all inbound traffic into the public subnet.
Rule 100 Outbound allows all traffic out of the public subnet.
The second line in each ruleset shows an asterisk (*) that acts as a catch-all rule in case traffic
does not match any of the earlier rules. In our case, since Rule 100 already allows all traffic,
the asterisk rule won't actually come into play.
This means default network ACLs allow all inbound and outbound traffic, unless customized.
For the subnet's Availability Zone, use the second AZ on the dropdown (not the first!)
10.0.1.0/24
Success!
To tidy up your subnets' naming conventions, let's retitle your Public 1 subnet to
Like your public subnet, a private subnet also needs to be associated with a route table.
Nice! With your private route table set up, let's make sure it can only direct traffic to another
internal resource (instead of the public internet).
Check the Routes tab - does it only have one default Route with a local target?
Step 1: Check the routes tab.
Select Edit subnet associations under the Explicit subnet associations tab.
To tidy up your Route tables' naming conventions, let's also retitle NextWork route table to
The default network ACL associated with your private subnet allows all traffic, which exposes your
private subnet to unrestricted access from the internet or other untrusted networks.
Let's set up a new network ACL that restricts traffic and protects your private subnet!
Step 1: Let's create a new network ACL.
Observe the Inbound rules and Outbound rules tabs for your private network ACL.
To tidy up your Network ACLs' naming conventions, let's also rename NextWork Network
ACL to
Now let's dive into what's next for your network - it's time to see your VPC in action. 🤿
💻 Step #2
Let's kick things off by launching an EC2 instance in your public subnet.
Find a way for you to access your EC2 instance (so many cool learnings here!)
Put your EC2 instance in you VPC (let's get your VPC to WORK 👏)
EC2
in the search bar at the top of screen.
Since your first EC2 instance will be launched in the public subnet, let's name it
NextWork Public Server
For the Amazon Machine Image, select Amazon Linux 2023 AMI.
Free tier eligible AMIs are those that qualify for the AWS Free Tier, so you won't get charged for
using it.
So, while the AMI decides what operating system your server runs, the instance type determines
how fast and powerful it performs.
For the Key pair (login) panel, select Create new key pair.
How key pairs work is that they consist of two cryptographic keys: one private and one public. The
public key is installed on the virtual machine, and the private key remains with the user. When you
attempt to connect, the machine uses the public key to create an encrypted challenge that can only
be decrypted with the private key. Key pairs make sure that access to your EC2 instances is secure
and authenticated.
The AWS Management Console gives you a user-friendly interface to set up and manage AWS
resources (we love it), but it doesn't typically provide direct access to the operating systems of your
EC2 instances. For operations that require direct OS-level access, like installing software, editing
configuration files, or running scripts, you'd use your key pair to connect directly. This method of
access is essential for deeper administrative tasks or specific kinds of troubleshooting that can't be
performed through the console.
In this project, we're learning to directly access your public server. You'll need this to run connectivity
tests on your server's terminal in the next project of this series.
Keep the Key pair type as RSA, and the Private key file format as .pem
Step 2: Your key pair settings.
We use RSA (Rivest-Shamir-Adleman), which is one of the most common cryptographic algorithms
used due to its strength and security. RSA is widely supported and trusted for creating digital
signatures and encrypting data.
The .pem format, which stands for Privacy Enhanced Mail, started off as a way to secure emails but
has since become the go-to format for managing cryptographic keys because it is supported by many
different types of servers e.g. EC2 instances!
Select Create key pair.
💡 Woah something started downloading straight away! What was that file? Do I need to keep it?
The file that started downloading is the private key (.pem) i.e. your half of the new key pair! It's
usually very important to save it securely. Losing this file means losing the ability to securely access
your instances, and it cannot be downloaded again from AWS. But, for this project we're using a
simpler technique to access your EC2 instance that doesn't need this .pem key, so it's safe to delete
and you can always generate a new key pair for your next project.
At the Network settings panel, select Edit at the right hand corner.
For the Firewall (security groups), we've already created the security group for your public
subnet's resources. Choose Select existing security group.
Select the checkbox next to your instance, and a Details panel pops up!
Notice how your public server has a Public IPv4 address, a subnet it's associated with, an
Availability zone it's launched in, and a VPC ID that links it with NextWork VPC too.
The Availability Zone is the specific area within your AWS Region that your instance is
hosted.
The VPC ID identifies that within the AWS Region you're using, the Public Server belongs in
your NextWork VPC.
The NextWork Public Subnet determines the range of IP addresses within NextWork VPC
that can be assigned to your EC2 instance. Because this subnet has a route to an internet
gateway, your VPC has opened up communication between all resources in the subnet and
the internet.
The Public IPv4 address is the external IP address assigned to your EC2 instance. This
address is globally unique, so no other server has the same public IPv4 address on the
internet! Having a public IPv4 address means your instance can communicate with the
internet and be accessible from outside your private AWS network.
Step 2: Your Public Server's Networking details.
Take a screenshot 📸
1/5
Return to later
🤐 Step #3
Set up a way for your EC2 instances to speak to each other (huuuuge!)
Step 3: Let's launch a private server.
Name:
From a security point of view, anyone with that key can access all the instances it's connected to -
making it even more important to keep your private key safe.
At the Network settings panel, select Edit at the right hand corner.
Firewall (security groups): we said we'd use an alternative way to set up security groups for
your private subnet's resources, and here we are!
Select Create security group.
Notice the default Inbound Security Groups, the Type is set to ssh.
💡 What is SSH?
Remember how we created a new key pair to get direct access to our EC2 instance? SSH, or Secure
Shell, is the protocol we use for this secure access to a remote machine. When you connect to the
instance, SSH verifies you possess the correct private key corresponding to the public key on the
server, ensuring only authorized users can access the instance.
In terms of network communication, SSH is also as a type of network traffic. Once SSH has
established a secure connection between you and the EC2 instance, all data transmitted (including
your commands and the responses from the instance) is encrypted. This encryption makes SSH an
ideal method for securely exchanging confidential data e.g. login credentials!
More and more organizations try to reduce the use of SSH and prefer infrastructure as code (IaC) and
automated deployments to reduce the need for direct access (and minimize human error and
security risks), but SSH access is still essential for many administrative, testing, and troubleshooting
scenarios. For example, developers today use SSH to troubleshoot a live issue, perform manual
updates, or configure system settings that are not easily automated.
This popup says "Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. We
recommend setting security group rules to allow access from known IP addresses only."
AWS is concerned that the default security rule, i.e. with the source being
0.0.0.0/0
0.0.0.0/0
for our public subnet, but the private subnet is a different story!
In the Source drop down, scroll down and select NextWork Public Security Group.
💡What does it mean to select NextWork Public Security Group instead of Anywhere as our source?
Choosing the NextWork Public Security Group as the source means only resources that are part of
the NextWork Public Security Group can communicate with your instance. This restricts access to a
much smaller group of trusted resources, rather than allowing potentially any IP address on the
internet (
0.0.0.0/0
Take a screenshot 📸
1/4
Return to later
Congratulations!! That was a massive effort in getting your private and public subnets warmed up
with an EC2 instance in each.
⚡️Step #4
We'll come back to your VPC setup in the next project, and in the meantime... are you ready to level
up your VPC creation skills?
In this step, you're going to:
Try a new way to create your entire VPC setup (it's a time saver 🥳)
We previously stuck to creating a VPC only, but this time select VPC and more.
Woah! A visual flow diagram pops up that shows us other VPC resources. This is called a VPC
resource map!
Fun fact: The VPC resource map is a pretty new feature that just launched in Feb 2023!
Now with this handy VPC resource map, you get to see that selecting the VPC and
more option will also help you create VPC resources in the exact same page. No more
jumping between pages in your VPC console!
Scroll to view the entire VPC resource map, and take note of the resources listed.
3. How many route tables are being created in your VPC? Why?
There are 3 route tables being created - 1 for both public subnets to share, and 1 for
each private subnet.
There is an internet gateway being created - you can spot it under the fourth
panel, Network connections!
Our resource map looks straightforward since we have a nice and simple VPC architecture, but
imagine how useful this tool would be for complex VPC setups with many subnets!
Source: AWS Blog 'Visualize Your VPC Resources from Amazon VPC Creation Experience'
Take a screenshot 📸
Return to later
Scroll back to the left hand side of the screen to see the VPC's set up.
nextwork
If you type in
nextwork
, all your resources will have that in their name tags, making it super easy to track and manage
everything linked to your VPC. You'll see this in action soon!
10.0.0.0/16
💡 Doesn't my NextWork VPC already have that CIDR block, how could they share the same CIDR
block?
Actually, you can have multiple VPCs with the same IPv4 CIDR block in the same AWS region and
account. AWS VPCs are isolated from each other by default, so there won't be any IP conflicts unless
you explicitly connect them using VPC peering (which you'll learn more about later in this networking
project series).
Bottom line, it's possible for your new VPC to share the same CIDR block as an existing one, but this
set up will mean your overlapping VPCs can't talk to each other directly. That's why it'd be best
practise to have completely unique CIDR blocks for each VPC in your account!
💡 How is it that subnets can't have overlapping CIDR blocks, but VPCs can?
Great question! VPCs are isolated networks within AWS, meaning they don’t interact with each other
unless you explicitly set up connectivity between them.
On the other hand, subnets within a VPC are part of the same network and can directly communicate
with each other. Overlapping CIDR blocks within a VPC would create IP address conflicts, making it
impossible to route traffic correctly. So, subnets need unique CIDR blocks to ensure smooth internal
networking.
For IPv6 CIDR block, we'll leave in the default option of No IPv6 CIDR block.
Fun fact: IPv4 has about 4.3 billion possible addresses, while IPv6 has around 340 undecillion
addresses – that's a number with 36 zeros!
Default: Your instances share hardware with other AWS customers. This is the standard
option and is cost-effective because you’re sharing resources.
Dedicated: Your instances run on hardware that's dedicated to you only. For example,
imagine a healthcare company that needs to ensure the highest level of security for patient
data. They might choose dedicated tenancy to make sure their servers are completely
isolated from other customers, helping them meet compliance standards and keep sensitive
information secure. Dedicated does come at a higher cost!
For Number of Availability Zones (AZs), we'll leave the default value of 2 for now and come
back to this soon.
Expand the Customize AZs toggle. Ooo you can even configure which two Availability Zones
you'd like to set up for this VPC!
Step 4: Expand the Customize AZs toggle.
Next, notice that Number of public subnets only gives you two options - 0 or 2.
This setup is called redundancy (having backups in different places) and high availability (making
sure your resources are always accessible). Just one public subnet wouldn’t offer this kind of
reliability, so AWS doesn't let you create just one!
After all, this VPC set up page’s aim is to get you up and running quickly without overwhelming you
with options.
Similar to this, Number of private subnets only gives you three options - 0, 2 or 4.
💡 How is it that we can create up to 4 private subnets, but only 2 private subnets?
AWS's best practice advice is at work again! Having more private subnets can help with organizing
your resources and isolating them for security purposes, whereas public subnets are limited to
ensure manageable exposure to the internet.
Try selecting the option for 4 private subnets, and watch your resource map update itself!
Step 4: Your resource map updates to show 6 total subnets and 5 route tables.
You can see this in action if you hover over the public route table in your resource map!
For private subnets, each one often has its own route table to control and customize traffic routing
more precisely. This allows for different routing rules and security controls for each private subnet.
Step 4: Hover over the public route table in your resource map.
Take a screenshot 📸
Take a screenshot of your VPC set up page, make sure to include the resource map.
Return to later
✋ PAUSE - what do you think will happen if you change the number of Availability Zones
from 2 to 1?
Make your prediction on how this resource map will look differently...
Scroll back to the Availability Zone field, and change the selection from 2 to 1!
Step 4: Your resource map now only shows 3 total subnets and 3 route tables.
Change the Number of private subnets from 2 to 1. Now we have just two subnets total -
one public and one private subnet!
10.0.0.0/24
10.0.1.0/24
: Provides 16,777,216 IP addresses (usually for very large networks, not subnets).
/16
/24
/32
The /20 size offers a balance between too few and too many IP addresses, making it useful
for most network setups without overwhelming you with an excessive number of IPs.
Next, for the NAT gateways ($) option, make sure you've selected None. As the dollar sign
suggests, NAT gateways cost money!
Step 4: Make sure you select None for NAT gateways!
💡 What are NAT gateways, how are they different from internet gateways?
NAT gateways let instances in private subnets access the internet for updates and patches, while
blocking inbound traffic.
For example, your private server in your private subnet might need to download security updates. By
using a NAT gateway, the server can access these updates securely while remaining protected from
external threats!
On the other hand, internet gateways let instances in public subnets communicate with the internet
both ways i.e. both inbound and outbound traffic.
💡 Why would I use a NAT gateway? Couldn't I just set up an internet gateway with no public
inbound traffic but allow outbound traffic?
Great question! Instances in public subnets using an internet gateway still need public IP
addresses to communicate with the internet.
Assigning public IP addresses to your instances makes them accessible from the internet, increasing
the attack surface. Even with strict security group rules, there's always a risk of misconfiguration or
vulnerabilities being exploited.Private subnets are meant to keep your instances isolated from the
public internet, so using public IP addresses for instances in private subnets would not be ideal.
That's where NAT gateways come in! Instances in private subnets using a NAT gateway do not need
public IP addresses. The NAT gateway handles a translation to a public IP, keeping your instances'
private IPs hidden.
But, VPC endpoints let you connect your VPC privately to AWS services without using the public
internet. This means your data stays within the AWS network, which can improve security and
reduce data transfer costs.
There are many types of VPC endpoints, and the S3 Gateway endpoint is the most common and
useful one - many applications need to access S3 for storing or retrieving data after all! The
endpoints for other AWS services can be added later, but this setup tool simplifies the initial setup by
focusing on S3.
💡 Why does traffic to some services like S3 go out to the public internet by default?
Not all AWS resources are automatically placed inside your VPC! While your compute resources (like
EC2 instances) reside within your VPC, S3 buckets and some other AWS services exist outside your
VPC because they're designed to be highly available and accessible from anywhere.
That's why VPC endpoints, like the S3 Gateway endpoint, exist to create a private connection
between your VPC and S3. Having a VPC endpoint means your instances can now access services like
S3 directly without routing through the public internet, which makes sure your data stays within the
AWS network for security.
That's your teaser on VPC endpoints, we will get into them in detail we learn about VPC peering later
in this series! 👀
When you enable DNS resolution, AWS takes care of translating these hostnames to their
corresponding IP addresses so that network requests can find the correct instance. This is particularly
useful in environments where IP addresses might change - hostnames can stay consistent, so
references to your resource would still point to the right thing.
Super satisfying to see this loading bar of your VPC and its resources getting created!
Step 4: Your VPC workflow updates faaassst
Note how name tag auto-generation, which you enabled in the set up page, is at work now -
all of your VPC's resources have
nextwork
Oooo, now you get to see how your public subnet is connected to a public route table and
your internet gateway.
Woohoo! There's a resource map for VPCs we create from scratch too.
Start your response with 'I used an alternative way to set up an Amazon VPC! This time, I'...
Autosaved
1/5
Return to later
If you'd like, take 30 seconds to visit the pages for each of your VPC's resources - you'll notice
that all of these have been created for ya!
Subnets
Internet gateway
Route tables
Network ACLs
How goooood and efficient - handy for the next time we're setting up our VPC 😎
Nice work!
You've just completed today's project and set up your very own VPC with private and public
resources.
All DONE WOOOOOOOOOOOOOOOOO!!! 🙌 High fives all round.
Autosaved
1/4
Return to later
Step #6
✋ STOP
Before diving into the steps for deleting your resources, why not challenge yourself to delete
everything in this project on your own?
Keeping track of your resources, and deleting them at the end, is absolutely a skill that will help you
reduce waste in your account.
🛑 STEPS BELOW:
Select Terminate.
Step 6: Delete your EC2 instances.
If you get stopped from deleting your VPC because network interfaces are still attached to
your VPC - delete all the attached network interfaces first!
Type
delete
Select Delete.
Refresh your the page before checking if the resource you created today is still in your account. They
should be automatically deleted with your VPC, but it's always a good idea to check anyway:
1. Subnets
2. Route tables
3. Internet gateways
4. Network ACLs
5. Security groups
Now it's time to share and let people know just what an amazing job you've done.
Select the
at the bottom of the post - it's blocking you from uploading documentation!
Then you select this page icon, which helps you Add a document.
Voilà! Upload your document and give it a nice title that relates to your project.
Share your PDF in the NextWork community. Completing a project is literally one of the
biggest achievements and milestones that everyone celebrates. Show us your amazing work.
👀
OMG
DONE!!!!! 🥳
Your amazing work today!
💻 Launch a public EC2 instance You launched an EC2 instance in your public subnet, set up
the appropriate AMI and instance type, and configured key pairs for secure access.
🤐 Launch a private EC2 instance You launched an EC2 instance in your private subnet,
created a security group within the same flow, and used the same key pair for access.
⚡️Launch your VPC setup in minutes: You explored a new way to create VPCs and used the
VPC's resource map to visualize how different components like subnets and route tables are
connected.
It's wild that all these learnings are packed in one project. Great work and we'll see you in the next
one!
To commemorate this very special occasion, we've created a one-of-a-kind trophy just for you.
🚀 p.s. Does it say "Still tasks to complete!" at the bottom of the screen? This means you still have
screenshots left to upload, or questions left to answer!