shou2017.com
JP

AWS Certification, My Memo (EC2 Edition)

Sun Jun 14, 2020
Sun Jun 14, 2020
AWS

Recently, I’ve been using AWS a lot at work, so I thought I might as well try to get certified.

At work, I use serverless, so I kind of understand Lambda, but I don’t really get EC2, so here are my notes.

What is EC2?

The official name is Amazon Elastic Compute Cloud.

Elastic means “flexible” or “scalable”.

With EC2, you can run as many instances as you need, when you need them.

What is EBS?

A common question related to EC2 is about EBS. There’s also something called EFS, which is a bit confusing, so it’s good to remember both.

The official name is Amazon Elastic Block Store.

It’s a block storage volume that you attach to EC2 instances.

  • Used as a volume for EC2 instances (the size is reserved and charged as a provisioned resource)
  • Replicated automatically within the availability zone, so even if a failure occurs, data is not lost
  • Volume type can be changed
  • High durability snapshots (using S3, so durability is extremely high)
  • Volume encryption
  • Persistent storage

Volume Types

  • General Purpose SSD: Up to 16,000 IOPS
  • Provisioned IOPS SSD: For cases where you need more than 16,000 IOPS
  • Throughput Optimized HDD: For cases where you don’t need as much performance and want to reduce costs
  • Cold HDD: For even less frequently accessed data

*IOPS means the number of I/O accesses per second that a disk can perform.

Security Group

Traffic to EC2 instances is controlled by security groups.

Operating System

EC2 uses a key pair authentication method by default, which involves a public key and a private key. By using this key pair to log in, you can operate the operating system with administrator privileges.

Common Pricing Options

On-Demand Instances

  • This is the default pricing option when you launch an EC2 instance without any specific settings.

Reserved Instances

  • You can get a discount by committing to a 1-year or 3-year term. The highest discount is for the 3-year, all upfront, standard type. There’s also a convertible type that allows you to change attributes during the term.

Spot Instances

  • These are based on unused EC2 capacity and the price fluctuates like stock trading; higher demand means a higher price, and vice versa.

Dedicated Hosts

  • This option allows you to have a physical host dedicated to your use, which can help meet security, governance, and licensing requirements. Pricing is based on the host, not the instance.

What is ELB?

Another confusing service starting with ‘E’ is ELB, which stands for Elastic Load Balancing.

To mitigate the impact of failures, you can distribute EC2 instances across multiple availability zones and use ELB to route incoming traffic to these instances. This increases the availability of your application.

Since ELB is a managed service with high availability, it itself does not become a single point of failure.

Load Balancer Types

Application Load Balancer

  • Distributes HTTP or HTTPS requests and offers advanced features for web applications.

Network Load Balancer

  • For TCP protocols other than HTTP/HTTPS. It can use static IP addresses.

Health Checks

ELB can automatically perform health checks on the instances registered as targets and will only route requests to healthy instances.

What is Auto Scaling?

With Auto Scaling, you don’t have to predict how many EC2 instances you need. It automatically adjusts the number of instances based on the current demand.

What is EFS?

Amazon Elastic File System is a file storage service that can be shared across multiple EC2 instances. This is also commonly asked in relation to EC2.

EBS

  • Suited for data that changes frequently on EC2 instances.

Instance Store

  • A temporary storage for EC2 instances.

S3

  • A highly available and durable storage option that is accessible over the internet.

EFS

  • Used for sharing data between multiple EC2 instances. Unlike S3, it does not require internet access for data sharing.
See Also