← AWS SAA

EC2

awsec2

EC2

For Monitoring

Memory Utilization
Disk Space Utilization
Disk Swap Utilization
Page Utilization
Log Collection
These metrics are not available by default
By Default, only 20 EC2 instances can be up in a region on-demand

Instance Types

General use

Mac, T and M

Compute Optimized

C

Ram Optimize

R, x, z 

Storage optimized

I,D,H

Security Groups

Region lock
Allow all outbound traffics by default. All inbound traffics is blocked 
Can apply to multiple instances
Security groups can authorize other security groups
For Instance connect, we can apply IAM role on ec2 to control access to the was services via ec2 instance.

Purchase Options

On Demand

Pay per second after first minute.
No upfront payment
Recommend for:
Short-term, uninterrupted workloads, can’t predict how long we gonna need

Reserves

72% cheaper than on demand.
Reserve specific instance attribute (Instance Type,Region, Tenancy, Os)
1 or 3 years reserve. More year more discount
Can buy and sell on marketplace
Convertible Reserve: can change instance type, instance family, Os, Scope and Tenancy
Up to 66% discount

Saving Plan

Discount same as RI
Have to commit usage like 10usd/hour for 3 years
Usage beyond limit is charged as on demand price
Lock to specific region
Can change instance size, tenancy, os

Spot Instance

Discount up to 90% compared to on demand
Can loose the instance if the current price is higher than my max price
Most-cost efficient

Dedicated host

A physical server 
Purchasing options- on demand, reserves(1 or 3 years)
Most expensive option
Useful of software that have complicated licensing model (BYOL)

Dedicated Instances

Instance run on hardware that is dedicated to me
May share with other instances in same account 
Own instance on my own hardware, which will give visibility to lower level hardware

Capacity reservation

Reserve on demand instances, no time commitment no billing discount
Combine with regional reserve instance and saving plan to benefit from billing discount
Charged whether u r using or not
Short term uninterrupted workloads to be in specific AZ

Networking

Ec2 default IP is changing every time restart
Elastic IP for Static IP (only have 5 IPs in account. Can ask aws for more) charging whether u are using or not
Even AWS don’t recommend using elastic ip

Placement Groups

Cluster - speed
Good for networking. Low latency.
Within same AZ. When one goes down, all goes down.

Spread- availability
Multi AZ but only seven instances per AZ.
Partitions - high availability 
Up to 7 partitions per AZ
Span across multiple AZ in same Region
Instances in partitions do not share racks

Elastic Network Interfaces

Primary private IPv4 and one or more secondary IPv4
One public IP and bound to a specific AZ
Can be create independently and attach on fly in case of failover
One elastic IP per private IPv4
Can attach one or more security group
Can attach many ENI to an instance as secondary private IPv4

Hibernation

Preserve RAM state
Move RAM data to EBS when Hibernation

EBS Volumes

They are bound to specific AZ. One EBS can’t attach to multiple EC2
EBS can be deleted on termination of EC2(need to setup but easy)
Snapshot. Can snapshot EBS volume and copy snapshot across AZs or Regions
Snapshot Archive - 75% cheaper, but took 24 to 72 hours to restore
Recycle Bin for Snapshot - store deleted snapshot. Retention up to 1 day to 1 year
Fast Snapshot restore (FSR- more expensive)- force full initialization of snapshot for first use

AMI

AMI is bound to specific region.
We can reuse on other region unless we copy them to new region.
But within a region, we can use it on any AZ.

Instance Storage

EBS

Can attach to multiple instances up to 16 instances(same az)
two types - Single AZ and multiAZ
Various tier gp2, gp2 (general purpose), io1,io2(input output)
Sc1,st1(hdds slow cool hdd, slow throughput)
Only add can be used as base volume to boot os.
Two ebs volume , one for root(for root volume delete on termination is checked by default)

EFS

Can attach to multiple instances too but need interface or smth
Can attach to multipleAZ
Various plans Standard, IA and archive. Also Standard and one zone