Services > VPC > Launch VPC Wizard > Single public subnet.
Provide IPv4 CIDR block for the entire VPC. All resources within that VPC will assume IP addresses in the specified range.
Provide IPv4 CIDR block for the public subnet. If VPC has 1 subnet the CIDR block value of VPC could be used here, but if the VPC needs to be divided into say 2 subnets then the CIDR values shoould reflect that. For example /25 will provide subnet A will 10.0.0.0 - 10.0.0.127 range and subnet B with 10.0.0.128 - 10.0.0.255
After VPC is created, it is not public yet. It doesnt know how to connect to the internet. So modify its route table to connect it to IGW (internet gateway).
Open VPC route table and Add a new route with destination 0.0.0.0/0 and Target to igw-guid. This is the default IGW provided by AWS.
Create subnet B in another AZ this time with CIDR 10.0.1.0/24 to avoid clash between ethe 2 subnets
Create EC2 instance
Launch EC2 wizard and select desired AMI
Network = VPC create above + subnet = a or b
Autoassign public IP = disable for now
Add Name Tag
Create new security group, if one doesnt exit already.
Open SSH port from source anywhere (in future we can whitelist only certain IPs)
Open Custom TCP for application exposed port number to anywhere, so it is publically accessible.
Create keypair and store it locally securely.
Create and assign an Elastic IP (public ip address), so that we can SSH into the box. Elastic IPs are indepdent of the ec2 instances they are associated with. If the ec2 instance dies, elastic ip can be resued
Once elastic IP is created, run app on port 3000 and use Public ip with port 3000 to view in a browser