[SAA + SAP] 03. EC2
SAA
EC2 instance types
Security Group
SG can refer to another SG.
EC2
- You have more access to hareware
- Whole hardware for your EC2
- Still share hardware with other instances
- To start a spot instance, you need to issue a Spot Request.
- Spot request contains the information
- Max price
- Num of Instances
- Specification
- Type: One-time | presistent
- Time range
- As long as current spot price < Max price, instances keep running
- Otherwise, will stop or terminate instance in 2 mins grace period
- Or using Spot block strategy
- If one-time type, will terimated instances in the end.
- Must firsts cacnel the Spot Request first, then terminate the instances, otherwise, for persisten type, it will "stop" -> "start" -> "according to spot request" -> "lanuch instances" again.
- You cannot cancel "failed" or "closed" instances
- Launch spot instances and on-demand instances to meet target capacity.
- Start/stop EC2, public IP will change, use Elastic IP to avoid this problem
- Recommended to use a random Public IP and register a DNS name to it.
- Or use a Load Balancer are ofter a better choice.
EC2 Placement Group
- Sometime you want to control over the EC2 insstnaces placement strategy (to achieve low-latency or aviliability)
- That strategy can be defined using placement groups
- You can move an instance into or out of a placement Group
- You first need to stop the instance
- You then need to use CLI (modify-instance-placement)
- You can then start your instance
- Note: Choose instance type that has Enhanced Netowrking (because they have faster networking capbility)
- Put all EC2 in the same Rack
- To get Low latency network
- For big data job
- Spread: accross AZ, limited 7 instance per AZ
- For reduce risk of simultaneous failure
- For Critical application
- Partition: Each partition pan access multi AZ in same region
- Up to 100 instances
- For Kafka, HDFS...
- Can attach to EC2 instances for failover
- Bound to a specific availability zone
- preserve the state in EBS
- reduce bootstrap time compare to stop instances
EC2 Nitro
- Underlying Platform for the next generation of EC2 instances
- New virtualization technology
- Allow for better performance:
- Better networking options (enhanced networking HPC, IPv6)
- Higher Speed EBS (Nitro is necessary fro 64,000 EBS IOPS - max 32,000 on non-Nitro)
- Better underlying security
If you want High Speed EBS, you have to use EC2 Nitro instance.
vCPU
- Core has Thread inside
- You can reduce some vCPU to reduce some costs
SAP
- Host affnity for Dedicated host, when the instance reboot, it will stay on the same host; won't jump to another hardward
- R for RAM
- C for Compute
- M for Web, Medium
- I for I/O
- G for GPU machine learning
- Status check for EC2 VM and system
- RAM is not included in EC2 metrics, need to use Custom metrics
- Focus on capacity, can mix the instance types