EC2 Fundamentals Flashcards
(21 cards)
What is EC2?
It is an AWS Service = Elastic Compute Cloud = IaaS
EC2 structure
It consists in the capability of:
Renting VM (EC2)
Storing data on Virtual drives (EBS)
Distributing load accros machines (ELB)
Scaling the services using auto-scaling group (ASG)
EC2 sizing and configuration options
OS: Linux, Win or MacOS
CPU: compute power and cores
RAM: random-access memory
Storage space:
EBS or/and EFS
EC2 sizing and configuration options
OS: Linux, Win or MacOS
CPU: compute power and cores
RAM: random-access memory
Storage space:
- Network attached: EBS or/and EFS
- Hardware: EC2 Instance Store
Network card: speed, public IP
Firewall rule: security rules
Bootstrap script
EC2 User Data what is?
It is possible to bootstrap instances using an EC2 User Data script
Bootstrapping what is?
Bootstrapping means launching commands when a machine starts. This script is only run once when the instance first start
EC2 User Data usage
It can be used for:
Installing updates
Installing software
Downloading common files from the Internet
Anything that you will need at first start
EC2 Instance Types
There are following instance types available in AWS:
General Purpose
Compute Optimised
Memory Optimised
Accelerated Computing
Storage Optimised
Instance Features
Measuring Instance Performance
AWS EC2 instance naming convention
m5.2xlarge
m: instance class
5: generation
2xlarge: represent size of the instance class
EC2 Instance Type - General Purpose
Great for a diversity of workloads such as web server or code repository
Has balance between:
- Compute
- Memory
- Networking
EC2 Instance Types - Compute Optimised
Great for compute-intensive tasks that require high performance processors:
- Batch processing workloads
- Media transcoding
- High performance computing (HPC)
- Gaming servers
- High performance web server
- Machine Learning
EC2 Instance Types - Memory Optimised
Fast performance for workloads that process large data sets in memory:
- High performance, relation/non-relation databases
- Distributed web scale cache stores
- In-memory db optimised for BI
- Applications performing real-time processing of big unstructured data
EC2 Instance Types - Storage Optimised
Great for storage-intensive tasks that required high, sequential R/W access to large data sets on local storage:
- Relational and NoSQL DB
- Cache for in-memory DB (Redis)
- Data Warehousing app
- Distributed file systems
Security Groups what is?
It is fundamental of network security in AWS
It control how traffic is allowed into or out of our EC2 instances
Security groups only contain ALLOW rules
Security group rules can reference by IP or by another security group
Security groups deep dive
SG acting as a firewall on EC2 instances
They regulate:
- Access to Port
- Authorised IP ranges IPv4 and IPv6
- Control of inbound network (from other to the instance)
- Control of outbound network (from the instance to other)
SG Good to know
Can be attached to multiple instances
Locked down to region/VPC (it means if you change the region for you instances, or move to new VPC, then you need to create a new SG for EC2
SG live outside the EC2, if traffic is blocked, EC2 instance will not see it
- Separate SG for SSH access
EC2 default traffic rule
All inbound traffic to EC2 instance is BLOCKED by default
All outbound traffic to EC2 instance is AUTHORISED by default
EC2 Instances Purchasing Options
On-Demand Instances - short workload, predictable pricing
Reserved (1 or 3 y)
- Reserved Instances - long workloads
- Convertible Reserved Instances - long workload with flexible instances
Savings Plans (1 or 3 y) - commitment to an amount of usage, long workload
Spot Instances - short workloads, cheap, can lose instances
Dedicated Hosts - book an entire physical server
Dedicated Instances - no other customers will share your hardware
Capacity Reservations - reserve capacity in a specific AZ for any duration
EC2 Spot Instances
Can get a discount of up to 90% compared to On-demand price
Define MAX SPOT PRICE and get the instance while CURRENT SPOT PRICE < MAX
Elastic IPs
- When you stop and then start an EC2 instance, it can change its public IP
- If you need to have a fixed public IP for your instance, you need an Elastic IP
- An Elastic IP is a public IPv4 IP you own as long as you don’t delete it
- You can attach it to one instance at a time
- You can only have 5 Elastic IP in your account (you can ask AWS to increase that)
Tips about Elastic IP
Try to avoid using Elastic IP
- They often reflect poor architectural decisions
- Instead, use a random public IP and register a DNS name to it
- Using a Load Balancer better architecture solution, and don’t use a Public IP