Physical Infrastructure and Virtual Machines in AWS
- AWS AZ(Availability Zone) will have Datacenter’s and Datacenter’s will have racks.
- Each rack will have physical servers (Which are custom built for AWS). Within each physical server there will be hypervisor used to create virtual machines which amazon calls as ec2 instances
- AWS popularly uses two hypervisors
- For every machine (physical/virtual) we will have some os in it. In virtual machines os is selected by something called as VM images. Amazon calls this as AMI (Amazon Machine Image)
- Amazon allows you to choose different sizes of ec2 instances they call it as instance types. For free tier instance type t2.micro is free for 750 hours/month calculated as unit of hours.
- AWS also gives different purchasing options as instance purchasing options
- When creating an ec2 instance, we get to select
- instance type
- user data (script to run when the machine is created)
- security group
- key pair.
Lets create a windows ec2 instance
- Follow the screenshots
- Amazon uses key based authentication, Amazon will have public key and you will be able download private key which you have to use for authentication. This private key can be generated only at the time of creation of key pair.
- Windows machines cannot understand keypairs like linux/unix machines, so while loggin in aws will give an option to generate password from keypair. If you create linux machine you can use key pair directly.
- Now lets login by opening the rdp file and entering the credentials
- Now lets install webserver and access by using http://<publicip-ec2windowsinstance>
Lets create a linux ec2 instance
- Watch Here
- Then we will connect to linux using ssh client (Git Bash)
- For installing necessary software in your laptop Watch here
- To install apache server & access by using http://<publicip-ec2linuxinstance>
sudo apt-get update sudo apt-get install apache2 -y
ec2 instance states
- Running => AWS has allocated hardware & you will be paying for ec2 instance as long as machine is in running state
- Stopped => AWS has deallocated hardware for your ec2 instance but not your storage. You will not be paying for ec2 instance but still billing will continue for disk
- Terminated => Remove the ec2 instance