EC2 - Elastic Compute Cloud Flashcards
What is EC2?
A web service that provides resizable compute capacity in the cloud. Reduces time to obtain and boot new servers, allowing you to scale capacity. Scale up/down
EC2 Pricing
- On Demand - Fixed rate by the hour. No commitment
- Reserve - Capacity reservation at a discount. 1-3 year contract
- Spot - Bid on whatever price you want for instance capacity.
- Dedicated Hosts - Physical Ec2 serve dedicated for you. Allows for you to use exsisting software. On demand.
On Demand
Good for flexablity. Short term application that can’t be interupted. Good for in devleopment apps
Reserved
Good for steady predictable usage. Can make upfront payments. More you pay/longer the contract the more you save
- Standard reserve - Offers 75% off on demand instances
- Convertable reserve - 54% off on demand. Able to change instance type
- Scheduled reserve instances - Schedule instances to a time window (School example)
Spot
- Good for flexable start/end time applications
- Good for low compute
- Good for additional capacity
- If spot instance goes down on AWS’s end you wont’ be charged but if you terminate it yourself you will be charged
Creating an EC2 Instance
- Termination Protection is turned off by default
- EBS-backed instance - the defualt action is for the root EBS zoplume to be deleted when the instance is terminated.
- EBS Root volumes of your default AMI’s CAN be encrypted and any other volumes
EC2 Security Groups
Any changes to security groups take effect immediatly
Are stateful - any inbound rules automattically make and outbound rule/outbound traffic allowed
All inbound traffic is blocked by default - you have to allow things
Outbound traffic is allowed
Can have any number of EC2 instances within a security group and visa versa
You can’t block specific IP Addresses
What is EBS (Elastic Block Store)?
Virtual hard disk drive in the Cloud
- General Purpose (SSD) - Most work loads
- Provisioned IOPS (SSD) - Databases
- ThroughputnOptimised HDD - Big data
- Cold HDD -File servers
- Termination Protection is turned off by default
EBS (Elastic Block Store) Volumns and Snapshots
- EBS Volumns will always be in the same area as your EC2 Instance
- Snapshots are copies of EC2 instances - good for moving EC2 instances to new Avaliabilitly Zones(e-virginia-a1) as well as a different region(London) - exsist on S3
- Best practise it to stop the root instance beforehand
- Can create AMI (image)
- Extra volumes created presist
- You can change EBS volume sizes on the fly
AMI Types
EBS Volume:
- Can be stopped
- data presists
- can reboot
- ROOT device (OS) === Amazon EBS Volume created with a snapshot
Instance Store volume (Ephemeral Storage = shit):
- If hosat fails you’ll lose all your data
- Cannot be stopped
- ROOT device (OS) === made from a template stored in Amazon S3
Both
- Root volumes will be deleted on termination, but with EBS you can tell AWS to keep it.
Networking - ENI vs ENA vs EFA
ENI - Elastic Network Interface - virtual wifi(network) card - basic networking/low cost - multiple
EN - Enhanced Networking - single root to provide high-performance networking capabilities to support Instance types. - SR-IOV
Depending on network there are 2 different types
- ENA - Elastic Network adapter support up to 100 Gbps
- VF - 10Gbps - older instances
EFA - Elastic Fabric Adapter - network devices the you can attach to your EC2 instance to accelorate computing(HPC)/machine learning apps
- lower more consistant latency and high throughput
Encrypted ROOT Device Volumes
ROOT volumes are just the volumes that contain the OS - can encrypt during setup
Snapshots of volumes are encrypted automatically
Process to convert an unencrypted to an encrypted:
Snapshot -> Copy w/encrypt option -> create AMI(image) of that copy -> launch encrypted instance
Spot Instances & Spot Fleets
Spot Instances
- Allow you to take advantage of unused EC2 capacity in AWS
- Up to 90% discount
- Can use Spot Block to keep from terminating
- Good for flexible applications
- Big data
- CI/CD
- Web Services
- Media rendering
- HPC(high performance computing)
- Not good for:
- Presistant workloads
- critical jobs
- databases
Spot Fleets
- Collection of Spot Instances/On-demand Instances
*
EC2 Hibernate
Takes the RAM and saves it to your EBS volume
When rebooting, instance loads a lot faster - no need to boot OS again
Good for long-running processes and Services that take a long time to initialize.
Root volume MUST be encrypted
Can’t be hibernated for mor ethan 60 days
CloudWatch
Cloudwatch Performance monitoring service that watches your AWS resources and applications. Different from Cloudtrail which is a user monitoring service for AWS actions in the Management Console + APIs
Cloudwatch
- Monitors every 1min(detailed) or 5mins
- Can create alarms
- Compute
- EC2 Instances
- Autoscaling
- Elastic Load Blanacers
- Route 53
- Storage
- EBS
- Storage Gateways
- Cloudfront
What metrics:
EFS
EFS - Elastic File System - FIle storage for EC2 - Storage capacity is elastic
- Supports the Network File System V4 (NFSv4) protocol
- Only pay for the storage you use
- can scale up/down
- can support concurrant NFS connections
- Data can be stored across multiple AZ’s
- Read after write consistancy
Storage - Windows FSx / Lustre
Windows FSx. VS EFS VS Lustre
Windows FSx.
- SMB Based
- Designed for Windows
EFS
- Linux only
- NFS Based
Lustre
- Good for processing large data sets / high perfomance
EC2 Placement Groups
- Cluster
- A groiuping of instances within a single AZ
- Clusters are close together to combat low latency/high throughput
- need same EC2 instance types
- Spread
- single EC2 instances that are placed on destinct underlaying hardware
- 1 instance per rack with multiple racks
- critical
- multiple AZ
- Partitioned
- Similar to Spread but multiple EC2 instances within a rack but spread out accross multiple racks
- think mutlple EC2 instances
- multiple AZ