Operating System (linux, MAC, Windows, Ubuntu), CPU (Processing Power), Hard Drive (Local Storage), Network Card (Internet Access), Firewall (Security), RAM (Random Access Memory)
EC2 provides scalable computing capacity in the AWS cloud. Using EC2 eliminates our need to invest in hardware up-front, so we can develop and deploy applications faster. We can use EC2 to launch as many or as few virtual servers as we need, configure security and networking and manage storage. EC2 enables us to scale up or down to handle changes in requirements or spikes in data and system usage, reducing our need to forecast traffic.
On Demand: On-demand purchasing allows us to choose any instance type we like and provision/terminate it at any time (on-demand).
Reserved: Reserved purchasing allows us to purchase an instance for a set time period of one or three years.
Spot: Spot pricing is a way for us to bid on an instance type, and then only pay for and use that instance when the spot price is equal to or below our bid price.
Additional Benefits
Primary Use Cases
An AMI provides the information required to launch an instance, which is virtual server in the cloud. We specify an AMI when we launch an instance, and we can launch as many instances from AMI as we need. We can also launch instances from as many different AMIs as we need.
When we launch an instance, the instance type that we specify determines the hardware of the host computer used for our instance. Each instance type offers different compute, memory and storage capabilities and are grouped in instance families based on these capabilities. Select an instance type based on the requirements of the application or software that we plan to run on our instance.
An SG acts as a virtual firewall that controls the traffic for one or more instances. When we launch an instance, we associate one or more security groups with the instance. We add rules to each security group that allow traffic to or from its associated instances. we can modify the rules for a security group at any time; the new rules are automatically applied to all instances that are associated with the security group. When we decide whether to allow traffic to reach an instance, we evaluate all the rules from all the security groups that are associated with the instance.
In services, search EC2 and Click EC2. Next page, in Create Instance, Click Launch Instance.
Step 1: Choose an Amazon Machine Image (AMI)
Select a machine image as per your requirements. We are selecting Amazon Linux AMI 2018.03.0 (HVM) machine for this instance.
Step 2: Choose an Instance Type
Select an instance as per your requirements. We are selecting t2 micro for this instance.
Step 3: Configure Instance Details
We will be selecting Number of Instances = 1
Keeping default values for Network, Subnet, Auto-assign Public IP, Capacity Reservation, Shutdown behavior, and Tenancy.
For IAM role, right click and open Create new IAM role in a new browser tab.
In the IAM Role tab, Click Create role.
Next page, select EC2 and click Next: Permissions
Next page, in Filter policies search bar, type ssm and select AmazonEC2RoleforSSM. SSM stands for Simple Systems Manager which will be the role for our login to EC2. Click Next: Tags.
Next page is optional so we will click Next: Review.
Next page, we will input Role name: EC2Role and Click Create role. We will close this Create Role tab now and go back to EC2 instance tab.
On EC2 instance - Step 3 page, hit refresh symbol for IAM role. Now in the drop down of IAM role, we can see our newly created role. Select that role. Click Next: Add Storage
Step 4: Add Storage
We will stick with default settings for storage and click Review and Launch.
Note: We have skipped Step 5: Add Tags and Step 6: Configure Security Group.
Step 7: Review Instance Launch
Click Launch
A pop will be asking to Select an existing key pair or create a new key pair.
Since we have created SSM role in step 3 above, we do not need a key pair. Select Proceed without a key pair in the drop down. Click Launch Instances.
Next Page, Click View Instances.
Next Page, When instance state shows green light, our instance is Up and running.
In order to terminate or stop our instance, we can click Actions-->Instance State-->stop or terminate. This is recommended when we are not using our instance.
Next we will explore our newly created instance.
Next: Auto Scaling Groups