EC2 Flashcards
(26 cards)
What is EC2?
EC2 = Elastic Compute Cloud = Infrastructure as a Service (IaaS)
EC2 - virtual machines
EBS - storing data on virtual drives
ELB - Distributing load across machines
ASG - Scaling the services using an auto scaling group
EC2 sizing and config options?
OS: Windows, Linux or Mac OS
CPU: power & cores
Memory (RAM)
Storage
Network attached (EBS & EFS)
hardware (EC2 Instance Store)
Network card: speed, PIP
FW rules: security group
Bootstrap script (configure at first launch): EC2 User Data
What is EC2 bootstrapping?
Runs only once first time instance starts
Automate a one time boot tasks:
Installing updates
Installing software
Downloading common files from the internet
Anything you can think of….
EC2 User Data Script (UDS) runs with root user (sudo)
What happens to the public and private IP when you stop and start the EC2 instance?
Public IP will most likely be different, but private IP never changes.
What are the EC2 instance types?
General purpose - balance CPU, RAM, networking
Compute Optimized - compute-intensive tasks
Memory Optimized - Fast performance for workloads with large data sets in memory
Storage Optimized - storage-intensive tasks requiring high, sequential read/write
What are the EC2 Instances Purchasing Options?
• On-Demand Instances - short workload, predictable pricing, pay by second
• Reserved (| & 3 years)
• Reserved Instances - long workloads
• Convertible Reserved Instances - long workloads with flexible instances
• Savings Plans (1 & 3 years) -commitment to an amount of usage, long workload
• Spot Instances - short workloads, cheap, can lose instances (less reliable)
• Dedicated Hosts - book an entire physical server, control instance placement
• Dedicated Instances - no other customers will share your hardware
no other customers will share your hardware.
© Stephane Maarek
Odemy
What is EC2 on demand?
- Pay for what you use
- Highest cost, but no upfront payment
- No long-term commitment
- Recommended for short-term uninterrupted workloads
Resort: coming and staying in resort whenenver we like, we pay the full price
What are EC2 reserved instance?
- Reserve specific instance attribute
Instance type, Region, Tenancy, OS - Reservation Period - 1 year or 3 years
- Payment options: No… partial… all.. upfront
- Recommended: stead-sate usage (i.e. database)
- Can buy and sell in Reserved Instance Marketplace
- Convertible Reserved Instance
Can change instance type, family, OS, scope and tenancy
Resort: like planning ahead and if we plan to stay for along time, we may get a good discount
What are EC2 Spot Instances?
- Can get up to 90% discounts
- Instance that you can “lose” at any point if max price < current spot price
- The MOST cost-efficient instances
- Worklodas that are resilient to failure (batch, data analysis, image processing, any distributed workloads, workloads with flexibe start and end time)
- NOT SUITABLE FOR CRITICAL JOBS OR DATABASES
What are EC2 Dedicated hosts?
- Physical server with EC2 instance fully dedicated to your use with access to the lower level hardware
- Allows address compliance requirements and can use your existing server bound licenses
- Purchasing Options: On-demand (Pay per second) and Reserved (1 or 3 years)
- Useful for software that have complicated licensing model (BYOL)
- For companies with strong rgulatory or compliance needs
Resort: We book the entire building of the resort
What are EC2 Dedicated Instances?
- Instances run on hardware that’s dedicated to you
- May share hardware with other instances in same account
- No control over instance deployment (can move hardware after stop/start)
What are EC2 Capacity Reservations?
- Reserve On-Demand instances capacity in a specific AZ for any duration
- You always have access to EC2 capacity when you need it
- No time commitment (create/cancel anytime), no billing discounts
- Combine with Regional Reserved Instances and Savings Plans to benefit from billing discounts
- Your’e charged On-Demand rate whether you run instances or not
- Suitable for short-term, uninterrupted workloads that need to be in specific AZ
Resort: you book a room for a period with full price even if you don’t stay in it
EC2 Spot Instance Requests?
- Current spot price < max spot price
- If max > current, can lose instace, 2 min grace period
- Spot Block (1-6 hours) no interruption
- One time vs. persistent spot request
- Can only can cancel a Spot Instance request that are open, active or disabled
- Cancelling Spot Request does not terminate instances
- 1st cancel Spot Request, then terminate Spot instances
What are Spot Fleets?
- Spot Fleet = set of Spot Instances + (optional) On-Demand Instances
- Spot Fleet will try to meet the target capacity with price contraints – Pool types: instance type, OS, AZ, etc.
- Strategies to allocate Spot Instances: lowestPrice, diversified, capacityOptimized, priceCapacityOptimized (recommended)
What is an Elastic IP?
- Public IPv4 that you own and fixed for your instance
- Can only attached to once instance at a time
- Can only have 5 elastic IPs in account (can request increase)
- Avoid them, just random IP and
- regiser DNS to it instead
What are Placement Groups?
- Control the EC2 Instance placement strategy
- 3 groups: cluster, spread, partition
EC2 Hibernate to know?
- Doesn’t support all instance families
- There is a max instance RAM size
- Not supported for bare metal instances
- Works for many OS
- Root volume must be EBS encrypted
- Available for On-Demand, Reserved, and Spot Instances
- Instance cannot be hibernated for more than 60 days
What’s EBS Volume?
- Elastic Block Store is a network drive you can attach
- Persists data even after their termination
- Mounted 1 instance at a time
- bound to specific 1 AZ
- Free tier: 30 GB of free EBS storage of general purpose (SSD) or Magnetic per month
EBS - Delete on termination
- By default, the root EBS volume is deleted (attribute enabled)
- By default, any other attached EBS volsume is not deleted (attibute disabled)
How does EBS Snapshots work?
- make back up of EBS volume at a point in time
- Not necessary to detach volume, but recommended
- can copy snapshots across AZ or Regions
EBS Snapshot Features
- EBS snapshot archive - 75% cheaper
- Takes 24 to 72 hours for restoring archive
- Recycle bin for EBS Snapshots - retention set 1 day - 1 year
- Fast Snapshot Restore (FSR) - force full initiaization of snapshot to have no latency on first use
EC2 Instance Store
- High performance hardware disk storage
- Better I/O performance
- EC2 instances lose their storage if stopped
- Good for buffer/cache/scratch data/temp content
- Risk of data loss if hardware fails
- backups and replication are your responsibility
AMI Overview
- AMI = Amazon Machine Image
- AMI are custmization of EC2 instance
- AMI are built for specific region (can be copied across regions
- You can launch an EC2 instance from: Public AMIM, Own AMI, AWS marketplace AMI