EC2 Fundamentals Flashcards
What is EC2?
- Elastic Cloud Compute (EC2) -> Infrastructure as a Service
- Renting of virtual machines
What sizing & configurations options does EC2 offer?
- 💻 Operating System (OS): Linux, Windows, or Mac OS
- 💪🏻 CPU: Compute power & cores
- 🧠 RAM: random-access memory
- 🗄️ Storage Space: network-attached (EBS & EFS); hardware (EC2 Instance Store)
- 🕸️ Network card: speed of the card, Public IP
- 🚨 Security group: firewall rules
- 🥾 EC2 User Data: bootstrap script (configure at first launch)
What is EC2 User Data?
bootstrap script run only once at the instance first start
runs with the root user
What are common boot tasks automated in EC2 User Data?
- installing updates
- installing software
- downloading common files from the internet
…or anything else you want
What optimized EC2 Instance Types does AWS offer?
- General Purpose
- Compute Opmtimized
- Memory Optimized
- Storage Optimized
What is the EC2 instance type naming convention?
i.e. m5.2xlarge
m5.2xlarge
m: instance class
5: generation (AWS improves them over time)
2xlarge: size within the instance class
When is it ideal to use a General Purpose EC2 Instance?
- diversity of workloads (i.e. web servers or code repos)
- resources balanced between: compute, memory, & networking
i.e. t2.micro
When is it ideal to use a Compute Optimized EC2 Instance?
compute-intensive tasks that require high performance processors
Use Cases
- Batch processing workloads
- Media transcoding
- High performance web servers
- High performance computing (HPC)
- Scientific modeling & machine learning
- Dedicated gaming servers
When is it ideal to use a Memory Optimized EC2 Instance?
fast performance for worklaods that process large data sets in memory
Use Cases
- High performance, relational/non-relational databases
- distributed web scale cache stores
- In-memory databases optimized for BI (business intelligence)
- Applications performing real-time processing of big unstructured data
When is it ideal to use a Storage Optimized EC2 Instance?
storage-intensive tasks that require high, sequential read & write acess to large data sets on local storage
Use Cases
- High frequency online transaction proccessing (OLTP) systems
- Relational & NoSQL databases
- Cache for in-memory databases (i.e. Redis)
- Data warehousing applications
- Distributed file systems
What are Security Groups?
- 🚨 network security in AWS; act as a “firewall”
- ↔️ control how traffic is allowed into (inbound) or out of (outbound) of EC2 Instances
- ✅ contain only ALLOW rules
- reference by IP or by security group
What do Security Groups regulate?
- Access to Ports
- Authorised IP ranges (IPv4 & IPv6)
- ➡⏹️ Control of inbound network (from other to instance)
- ⬅⏹️Control of outbound network (from instance to other)
What are the Security Group traffic default settings?
- all inbound traffic is blocked by default
- all outbound traffic is authorised by default
What are some troubleshooting tips for 2 common EC2 connection errors?
Error 1: Timeout - application not accessible
Cause: Security group issue
—
Error 2: Connection refused
Cause: application error OR EC2 not launched
What are some Security Group “good to know” facts?
Security groups…
* can be attached to multiple instances
* Locked down to a region/VPC combo
* lives “outside” the EC2 - if traffic is blocked, EC2 won’t see it
💡 Best Practice: maintain one separate security group for SSH access
What port allows SSH traffic to reach your EC2 instance?
SSH (Secure Shell)
22 = SSH
Protocol Use: Log into a linux instance
What port allows FTP traffic to reach your EC2 instance?
FTP (File Transfer Protocol)
21 = FTP
Protocol Use: upload files into a file share
What port allows HTTP traffic to reach your EC2 instance?
80 = HTTP
Protocol Use: access unsecured websites
What port allows HTTPS traffic to reach your EC2 instance?
443 = HTTPS
Protocol Use: access secured websites
What port allows RDP traffic to reach your EC2 instance?
RDP (Remote Desktop Protocol)
3389 = RDP
Protocol Use: log into a Windows instance
What port allows HTTPS traffic to reach your EC2 instance?
443 = HTTPS
Protocol Use: access secured websites
What is SSH?
SSH (Secure Shell) allows you to connect to and control a remote machine from the command line using key pairs
SSH Options:
* SSH - Mac, Linux, Windows 10>=
* Putty - Windows
* EC2 Instance Connect - Everything!
What EC2 Instances Purchasing Options are available?
- On-Demand: short workload, predictable pricing, pay by second
- Reserved (1 & 3 years): long workloads
- Savings Plans (1 & 3 years): commitment to an amount of usage, long workload
- Spot Instances: short workloads, cheap, less reliable (can lose instances
- Dedicated Hosts: book an entire physical server, control instance placement
- Dedicated Instance: no other customers will share your hardware
- Capacity Reservation: reserve capcity in a specific AZ for any duration
When is EC2 On Demand pricing recommended?
short-term & un-interrupted workloads; can’t predict how app will behave
* $$$ pay as you go
* no long-term commitment
When is EC2 Reserved or Covertible Reserved Pricing recommended?
long-term, steady-state usage applications (i.e. database)
* $$ ~70% discount compared to On-demand
* 1 or 3 year comittment
* Convertible Reserved - flexible to change type, family, etc.
When is Spot EC2 Spot Instances pricing recommended?
non critical workloads that are resilient to failure
* $ ~90% discount compared ton On-demand; MOST cost-efficient instance in AWS!
Use cases:
* Batch jobs
* Data analysis
* Image processing
* Distrubted workloads
* Workloads with a flexible start & end time
⛔️ NOT suiteable for critical jobs or databases
When is EC2 Dedicated Host pricing recommended?
software with **complicated licensing model **or companies with **strong regulatory **or compliance needs
* $$$$ most expensive
* dedicated physical server to with access to lower-level hardware
When is EC2 Capacity Reservation pricing recommended?
short-term, uninterrupted workloads that need to be in a specific AZ
* $$$ On-demand instance capacity in specific AZ for any duration
* Charged On-demand rate where you run instances or not
When is EC2 Savings Plan pricing recommended?
long-term workloads, flexible across certain usage types
* $$ ~70% discount compared to On-demand
* 1 or 3 year commitment
* locked to instance family & region
How do you terminate a Spot Instance?
- Cancel a Spot Request (must be in an Open, Active, or Disabled state)
- Terminate associated Spot Instance
Cancelling a Spot Request does NOT terminate instances
What is a Spot Fleet?
spot fleet = set of Spot Instances + (optional) On-Demand Instances
* try to meet target capacity with price constraints
Spot Fleet Strategies
* lowestPrice - cost opmtimization, short workload
* priceCapcityOptimized (recommended)
✨ TIP: Spot Fleets allow us to automatically request Spot Instances with lowest price