Summary: https://www.udemy.com/course/aws-certified-cloud-practitioner-new/learn/lecture/20260612
Refresher: Intro to EC2
Amazon EC2 (Elastic Compute Cloud) 101
EC2 Instance - Key Concepts
Ref: https://www.udemy.com/course/aws-certified-cloud-practitioner-new/learn/lecture/20055638
- đź”§Â Instance = Virtual Machine (VM) = Virtual Server (VS)
- Hosted inside an EC2 host (physical HW)
- Deployed inside a VPC subnet, in a single AZ
- You have OS-level control
- Configurations
- Operating System (OS): Linux, Windows, MacOS
- Type: general purpose, compute optimized, memory optimized, storage optimized, accelerated computing…
- Size (CPU + RAM)
- Storage: HW-internal (Instance Store) or NW-external (EBS - Elastic Block Store)
- EC2 User Data: bootstrap code script executed when the instance is launched
- âť—Â Never executed again in that instance after launch
- EC2 Instance Role: IAM role → IAM permissions the instance gets (when assuming role) to perform actions in other AWS resources and services
- ENI (Elastic NW Interface): instance IP addresses in the NW
- Security via VPC Security Groups (SGs) = firewalls
Secure Shell (SSH) Protocol
Ref: https://www.udemy.com/course/aws-certified-cloud-practitioner-new/learn/lecture/20055692 and https://www.udemy.com/course/aws-certified-cloud-practitioner-new/learn/lecture/20244642
- đź”§Â Secure protocol to start a Shell CLI terminal in a remote host
- 💡 Shell = a Linux CLI terminal
- SSH runs on TCP port 22
- Can create SSH keys for an EC2 instance
- Allows logging in an EC2 instance and open a Shell CLI inside it → management
- Linux & MacOS machines can natively connect to an EC2 instance via SSH
- Windows machines may need PuTTY if Windows OS < Windows 10
- Instance Connect → Connect to instance via SSH within your browser
- No need to create and download SSH keys
- âť—Â Works out-of-the-box only with Amazon Linux 2
EC2 Purchasing Options
Ref: https://www.udemy.com/course/aws-certified-cloud-practitioner-new/learn/lecture/20055756
- Shared Host (Default): your instances are hosted in the same host/HW as instances from other customers (but instances from different customers are isolated from each other)
- On-Demand instances (Default): predictable pricing (pay-per-second), no discounts, aimed for short and uninterrupted workloads
- Spot instances: launched on extra EC2 capacity, can reach very high discounts (very cheap), aimed for short workloads that can be interrupted (instances will shut down if EC2 spare capacity is gone)
- ‼️ Workloads can be interrupted!! → Not suitable for web servers or DBs!
- Unreliable execution time → a job can take long to complete if EC2 capacity is low
- Reserved instances: commit to run instances for 1 or 3 years, get discounts for your commitment, can choose full/partial/no upfront payment, aimed for long and uninterrupted workloads
- Convertible reserved instances: unlike standard reserved instances, you can change EC2 instance type, family, OS, scope and tenancy with convertible reserved instances
- Capacity reservations: reserve capacity in a specific AZ or region for any duration
- Makes sure that your business will have the allocated capacity, even if EC2 capacity is very low → useful in e.g. Christmas with sales traffic peaks
- âť—Â Does NOT provide discounts on instance fees, it only guarantees available capacity/UX performance for your business
- Types:
- Zonal reservations → in a specific AZ, has high priority
- Regional reservations → in a specific region (AZ can be changed, has lower priority)