EC2 stands for Elastic Compute Cloud
Secure, resizable compute capacity in the cloud.
EC2 is completely controlled by the end user.
Capacity management made easy
With traditional server provisioning ( before EC2), a company needed to estimate upfront how much capacity it would need, and provision servers accordingly. With EC2, you can shrink and add compute capacity as needed.
Pay only for what you use
You only pay for the capacity that you actually use. This was hence a game changer to the software industry.
Average time to provision servers
Traditional standalone servers would take two to three weeks to provision, where as EC2 instances can get provisioned in minutes.
EC2 pricing options
The four pricing options that EC2 supports are
- On demand
- Reserved
- Spot
- Dedicated
On-demand pricing option
This option has the customer pay for the EC2 instance by the hour or by the minute based on usage.
- Low cost and flexible option. There is also no long term commitment with this option.
- This model works well for spiky or unpredictable workload that cannot be interrupted.
- Testing the water: For cases where an application is being tested, on-demand pricing can be a good option.
Reserved
This option is where the EC2 instance is reserved for an extended period, and accordingly discount is given to the customer — up to 72 % discount per hour.
- Predictable usage: For scenarios where you know upfront that so much usage is anticipated over an extended period of time. In such cases, use the
reserved
pricing so that you can take the benefit of discount for extendended usage. - Specific capacity requirements: You know upfront based on the usage data that you already have that you would need these kind of servers for this period. You can then opt for reserved instances to benefit from the extended usage discounts.
- Pay upfront: When you have sufficient capital with you upfront, and you want to put that capital to good use, then you can used reserved instances.
- Standard Reserved Instances: These would give up to 72 % discount.
- Convertible Reserved Instances: This is where you can upgrade to a bigger instance during the tenure of the reserved capacity. This would give up to 54 % discount.
- Scheduled RIs (Reserved Instances): This is where you know that certain times of the day/ days of the week have more usage than the rest of the time. Accordingly provision scheduled reserved instances.
- Reserved instances are applicable only at region level.
Spot
This option is where the customer uses the unused capacity of EC2 which the customer obtains at a cheap price but these can be called back by AWS at any point. Discount of upto 90 %. Prices fluctuate based on supply and demand. Prices also vary based on region.
- Spot instances cannot be used for websites for the obvious reason that you cannot have your website go down suddenly.
- Spot instances can be used for applications that have flexible start and end times.
Dedicated
This pricing option is where physical machines have been allocated to the customers in a dedicated fashion. This is the most expensive option.
- Compliance — when there is a regulatory requirement that the organization cannot allow multi-tenant virtualization, then dedicated instance has to be used. Government regulations can require that we don’t want to allow other tenants on the same underlying hardware.
- Licensing — For products that do not support multi-tenancy, or cloud deployments, dedicated hosts might be a good option. Oracle licensing is an example.
When you create an EC2 instance from the AWS console, you select the AMI type, you automatically assign a VPC, and you can specify a subnet (one subnet corresponds to one region), and you create a security group where you can specify that you want to allow inbound HTTP, HTTPS, SSH access if you want to use the EC2 instance as a web server. You can also add tags to add metadata about the EC2 instance that you are creating — like name=webserver-one
, and team=payments-team
and the like.
Storage is a virtual disk in the cloud. While creating the EC2 instance, you have the option of specifying what kind of storage/how much of storage you want attached to your EC2 instance.
Security key pair
You would also be prompted to download security key pair that you can use to administer the EC2 machine. If you already have existing security keys, you can select the existing key pair to administer the EC2 instance.
Accessing the EC2 instance
EC2 instance connect can be used to connect to the instance from the AWS console. You can also SSH into the public IP of the EC2 instance by using the security keys that were downloaded.