AWS Compute
Servers, instances and EC2!
EC2 (Elastic Compute Cloud) allows you to rent and manage virtual servers in the cloud. You have elastic compute power, which can grow and shrink based on the demand. You also have virtual servers in the cloud.
Servers handle your requests and give you a response. Servers are the actual physical servers running in the data center. An EC2 instance is a virtual server running on the physical server. Instances are not serverless because they exist on servers.
You can provision EC2 at the click of a button
You can use a preconfigured template Amazon Machine Image (AMI) to launch instance
You can deploy your applications directly to the EC2 instances
You receive 750 compute hours per month on the Free Tier plan
When to use EC2
Deploy a database
Deploy a web application: Deploy to multiple AZs to make application highly available
Ways to access instances:
AWS Management Console
Secure Shell (SSH) to establish a secure connection from your local laptop
EC2 Instance Connect (EIC) where you can use IAM (Identity and Access Management) policies to control SSh access to your instances, removing need to manage SSH keys
AWS Systems Manager (Session Manager): Browser-based interactive shell
Most common way to connect to Linux EC2 instances is via a Secure Shell (SSH).
Generate a key pair (private and public key) that proves your identity
Connect via SSH (client uses private key and instance uses public key)
Pricing options for EC2 instance
On-demand: Fixed price where you are billed down to the second. No contract, pay for what you use. Needed for unpredictable workloads that can't be interrupted, and workloads will not run longer than a year. You can also reserve capacity using on-demand capacity reservations
Spot: Take advantage of unused EC2 capacity only when it is available. Use it when you are not concerned about start or stop time and workload can be interrupted, and you want low compute prices. You can save up to 90% off On-Demand prices. It is the cheapest option.
Reserved Instances (RI): Commit to a specific instance type in a particular region for 1 or 3 years. Use it when you have steady state usage and can commit for a longer period of time, and can pay upfront to get lower cost overall. You are required to sign a contract, there are prayment plans available, and it provides convertible type (for additional flexibility in terms of configuration) at a discount.
Dedicated Hosts: A physical server fully dedicated to running your instances, when you want to bring your own licenses or have regulatory or corporate compliance requirements. Server is not shared with other customers (no multi-tenancy). A Dedicated Host is a dedicated physical server, while a Dedicated Instance runs on the host.
Savings Plan: Commit to compute usage (measured per hour) for 1 or 3 years. Use it when you want to lower your bill across multiple compute services and want flexibility to change configuration. Capacity is not reserved.
EC2 instance features:
Load balancing: Elastic Load Balancer that automatically distributes incoming application traffic across multiple EC2 instances. Can be of multiple types - (Classic, application, gateway, network, etc.)
Auto-scaling: Adds or replaces EC2 instances automatically across AZs based on need and changing demand. It reduces impact of system failures and improves availability of your applications.
Types of scaling:
Vertical Scaling: Upgrading your EC2 instance by adding more power (CPU, RAM) to an existing server
Horizontal Scaling: Scaling out, or adding or removing servers
Last updated