Menu
  • Home
  • About Me
  • Blog
  • Github
  • LinkedIn

Most basic of AWS – Create VPC and EC2 Instance

January 18, 2022

Instead of using Virtual box machine, I am going to use cloud. The most important thing is VPC Which stands for Virtual Private Cloud. Inside of VPC, there’s smaller set of hosting resources that are available in AWS Datacenter which is called Availability Zone (AZ). Each zone in a region has redundant and separate power, networking and connectivity to reduce failing simultaneously. I can create subnet when I use AZ which is a range of IP addresses in your VPC. You can launch AWS resources, such as EC2 instances.

In order for my machine to be useful, this machine needs to be connected to internet. You need to have route and internet gateway. I am going to show the steps how to create VPC and EC2 instance and connect to the internet.

Create VPC

go to VPC > YourVPCs > Create VPC, and give a nice Name tag and choose IP block. This IP block should be private IP addresses according to rfc1918.

I’m going to choose 10.30.0.0/16 (You don’t need to pay for VPC)

Create Subnet

Next step is creating subnet. Go to VPC > Subnets > Create subnet, choose the VPC ID that you just created and Create Subnet

The IPv4 CIDR block needs to be within the block of my VPC network range, so I put 10.30.10.0/24. Click Create subnet if the subnet setting is done.

Create Internet Gateway

Go to VPC > Internet gateways > Create internet gateway and create the IGW.

Attach Internet gateway

Click your internet gateways and Actions, select Attach to your VPC. Make sure the state indicates Attached

Create Route Tables

Go to VPC > Route tables > Create route tables, follow below screenshot to create.

Subnet Associations

Click the Route table and Subnet association, then you will see your subnet is not associated yet. so you will want to edit subnet associations.

Add new Router

So far, new routes has been added to your routing table. This is the routes that connect to VPC. Next step is to add a new route that will connect to internet to the router using internet gateway. Click Edit routes and Add route.

Set the default route (0.0.0.0) that catches all the packet and send them internet gateway that we created earlier. Click save changes.

Create EC2 Instance

Switch to EC2 dashboard, and click launch instance.

Select Ubuntu 20.04

Go to Configure Instance Details, select your VPC and Subnet and enable Auto-assign Public IP.

Click Review and Launch. Select a key pair or Create a new one if you don’t have existing key pair. (I have)

Connect to EC2 Instance

Click your EC2 instance and Connect. Copy the Example command

ez

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts
  • ChinguTalkBot v0.1.0: Setting up AWS Cognito with CDK for User Authentication
  • Phoenix & Elixir: Fix PostgreSQL connection refused
  • Demo: Git Log with Shell script to create a release notes
  • Metasploit
  • CyberSecurity Lab – Online Password Attack

Archives
  • March 2024
  • May 2023
  • April 2023
  • February 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
Categories
  • Amazon Interview (3)
  • Ansible (3)
  • AWS (9)
  • Azure (9)
  • Certification (2)
  • ChinguTalkBot Project (1)
  • cybersecurity (3)
  • Data analytics (6)
  • Demo Videos (6)
  • Docker (5)
  • Git (1)
  • GitLab (1)
  • Golang (3)
  • JavaScript (2)
  • Jenkins (4)
  • PowerShell (1)
  • Python (10)
  • Terraform (11)
  • Uncategorized (9)

©2025 | Powered by WordPress and Superb Themes!