EC2 Flashcards
EC2 and AZs relationship?
- Instances are associated with a single AZ. If that AZ fails your instance also would likely fail.
- You cannot connect resources in one AZ to an EC2 instance located in another AZ (storage, network etc)
EC2 instances - is stopping/starting same as re-starting?
No, it is not. If a instance is stopped/started it could move to another host within the same AZ (not that it matters to the app ultimately).
Categories of EC2 instances?
- General Purpose - diverse workloads, use this most of the times
- Compute optimized - latest high performance CPUs for scientific needs
- Memory optimized - large in memory datasets
- Accelerated Computing - advanced and niche requirements (FPGA etc)
- Storage optimized - large amounts of superfast local storage, massive IOPS (data warehousing, elastic search etc)
What are instance stores?
- Instance stores are block storage device which are local and not over the network
- connected to one ec2 instance on one ec2 host
- highest performance in aws
- attach only at launch time (unlike ebs)
- if instance moves from one host to another data on instance store is lost
When would you use EBS vs Instance Store?
- Highly availability and reliability of storage
- separate from EC2, persists separately
- Region resilient backups
- upto 64k ios and 1000Mib/s per volume
- upto 80k iops and 2375 MB/s per instance
When would you use instance stores?
- Value - included in the cost
- Performance: > 80k ops & 2375 MB/s
- Temp storage volumes
- stateless services (webservers, etc)
Elastic vs non-elastic Public IPs
If an instance is given a EIP it loses its non-EIP address
Exam Powerup
- Secondary ENI + MAC address = Licensing
- Diffferent Security Groups = multiple ENIs
- Primary ENI is allocated to an instance by default
- OS will never see the public IP address
- IPV4 Public IPs are Dynamic - Stop & Start = IP will Change
AMIs Exam Power up!
AMI are unique to a region. Same AMI would have different id in a different region.
- AMI Baking - taking a custom EC2 configured instance and baking it into an AMI
- AMI cannot be edited - launch it, configure it and bake a new AMI
- AMIs can be copied between regions
- Permissions - default = only your account
- Billed for capacity used by Snapshots
Billing model of EC2?
On-Demand - hourly rate, billed in seconds, for new or uncertain application requirements, short-term, spiky workloads, unpredictable workloads which cannot have any disruption
- Spot Pricing - cheapest, 90% off on-demand price, you can specify a max price you pay, if spot price goes above your max price the instance terminates, for apps that have flexible start/end times, apps should tolerate failure
- Reserved Instances - upto 75% off in return for a commitment 1 or 3 years, Reserverd in region or AZ, scheduled reservations
- Dedicated Hosts
Vertical Scaling
Vertical - resizing of instance, requires downtime/reboot, typically during outage windows, disruption, larger instances are \$\$$, works for all apps: no modifications required
Horizontal Scaling
Add more instances,
multiple running copies of your app running on smaller compute instances,
load balancer is required - between your servers and customers
Sessions are required for continuity of user experience - off host sessions
Explain ECS
- Elastic Cluster Service
- EC2 and Fargate
- Container Definitions define container location
- Task definitions encompass one or more Container Definitions and make up your “application” eg: database tier container, app tier container
- Task role is the way to assign an IAM role to a task so it can assume temp credentials to interact with AWS
- You create an ECS cluster and deploy tasks into that cluster
Whats an ECS Service defnition?
- A template of how many Tasks we want to deploy and how to scale them
- you can deploy a load balancer to distribute load across multiple copies of the same task
ECS Cluster modes
- EC2 Mode: Cluster of EC2 instances deployed across AZs in a VPC with container engines running in them, you manage them via the standard EC2 tooling available, you pay for them the moment they are instantiated, not a “serverless” solution so you need to size them according to your needs
- Fargate mode - no EC2 instances to manage, your images are deployed to a shared Fargate cluster, cluster is in your VPC/AZs, each task is injected into your VPC via ENIs, you can access the instances via these ENIs, only pay for containers for the resources they consume