DEV Community

Cover image for Launching EC2 instances within a VPC (along with Wizard)
Jeya Shri
Jeya Shri

Posted on

Launching EC2 instances within a VPC (along with Wizard)

Launching VPC Resources on AWS

In today’s project, I worked on creating and launching EC2 instances inside a custom Amazon VPC. The objective was to understand how instances behave when deployed in public and private subnets and how AWS networking components come together in a real-world setup. This hands-on task helped me move beyond theory and actually visualize VPC architecture through AWS’s resource maps.

Through this project, I learned how EC2 instances can be launched within different subnets of a VPC, how subnet selection directly affects accessibility, and how AWS simplifies VPC creation using its built-in wizard. I also gained a clearer understanding of how route tables, internet gateways, and NAT gateways interact inside a VPC.


Launching an EC2 Instance Inside a VPC

Launching an EC2 instance involves more than just selecting an operating system and instance size. The network configuration plays a major role in deciding how the instance is accessed and secured.

Step 1: Creating the EC2 instance

I began by navigating to the EC2 dashboard and selecting the option to launch a new instance. At this stage, I chose an Amazon Machine Image, which defines the operating system of the instance, and an instance type based on the required compute capacity. These choices form the base configuration of the EC2 instance.

Step 2: Creating a key pair for authentication

The next step was creating a key pair, which is required for secure access to the EC2 instance. I assigned a name to the key pair, selected the key pair type based on the encryption algorithm, and chose the private key file format. In most cases, the .pem format is used, especially for SSH access. This key pair acts as a secure credential for directly accessing and managing the instance.

Step 3: Editing network settings

After configuring the basic instance details, I edited the network settings. Here, I selected the VPC in which the instance should be launched and chose the appropriate subnet, either public or private. I then associated an existing security group or created a new one to control inbound and outbound traffic. Once these settings were reviewed and validated, the EC2 instance was launched successfully.

The overall flow followed was:
Launch Instance → Choose AMI → Select Instance Type → Create Key Pair → Edit Network Settings → Choose VPC and Subnet → Launch Instance.


Creating a VPC Using the “VPC and More” Wizard

Along with launching EC2 instances, I explored a faster and more structured way of creating a VPC using AWS’s “VPC and more” option.

Step 1: Selecting “VPC and more”

Instead of choosing the traditional “VPC only” option, I selected “VPC and more.” This approach automatically creates key networking components and provides a resource map. The resource map visually represents the entire VPC architecture, including availability zones, subnets, route tables, and internet gateways, making the setup easier to understand.

Step 2: Naming and tenancy configuration

I provided a name tag, which AWS used to auto-generate names for related resources such as subnets. I then selected the tenancy type. Default tenancy allows resources to run on shared hardware, while dedicated tenancy provides isolated hardware at a higher cost. For most standard workloads, default tenancy is sufficient and cost-effective.

Step 3: Configuring availability zones and subnets

Next, I selected the number of availability zones and the number of public and private subnets required. AWS automatically distributed the subnets across the chosen availability zones and associated them with the appropriate route tables. Public subnets were connected to the internet gateway, while private subnets remained isolated from direct internet access.

Step 4: Configuring the NAT gateway

Finally, I configured a NAT gateway for the VPC. The NAT gateway allows instances in private subnets to access the internet securely. It manages outbound traffic without exposing private resources to inbound internet connections and eliminates the need for public IP addresses on private instances.


Key Takeaway

This project gave me a practical understanding of how AWS networking components work together as a unified system. Instead of viewing EC2, VPCs, subnets, and gateways as separate services, I was able to see how they integrate to form a secure and scalable cloud architecture. Using the VPC wizard and launching instances in different subnets made the concepts much clearer and easier to retain.

Special thanks to NextWork for providing mw with the platform to learn about this project.

Top comments (0)