EC2 101
EC2 Options
- on demand (by seconds/hours), fixed rates
- reserved, 1 or 3 years term
- spot, users can bid whatever price you want for instance capacity
- dedicated hosts (able to use existing server bond software license to save money)
- https://aws.amazon.com/ec2/pricing/
On Demand
- application with short term, spiky or unpredicable workloads
- app tested on EC2
- perfect for users who want low-cost and flexibility without any up-front payment or unpredictable workloads
Reserverd Instances (RI)
- apps with steady states or predictable usafe (like web server)
- appws required reserved capacity
standardup to 75% discountconvertibleup to 54% discountschedules RIs(every friday, every December)spot instances
- apps with flexile start and end times
- apps that are only feasible可行 at very low compute prices
- users with urgent need for large amount of additional computing capacity
1 | if it is terminated by AWS, you will not charged by partial hours, but if you do, the whole hours will be charged |
Dedicated Hosts
- for regularoty requirements that may not support multi-tenant virtualization
- licensing which does not support multi-tenancy or cloud deployment
- can be purchased on demand or reserved (up to 70%)
Types
not require memorary
AWS make fake one for exam. you can memrary in
Fight Dr Mc PX
EBS
- in a spercific AZ
- storage volumes attached to your EC2, when attached, you can create file system on it, run a db or as a block
EBS Types
SSD
- GP2 /General Purpose SSD
- balance price and performance
- ratios of 3 IOPS per GB with up to 10,000 IOPS and the ability to boost 3000 IOPS for extended periods of time for volumes at 3334 Gib and above
- IO1 / Provisioned IOPS SSD
- for I/O intensive apps, large relational db/NoSQL db
- use it if you need more than 10,000 IOPS
Magnetic
- ST1 / Throughput Optimized HDD
- big data
- data warehouse
- log processing
- cannot be a boot volumen
- SC1 Cold HDD
- lowest cost for IA workload
- file server
- cannot be a boot volumen
Standard / Magnetic
- lowest cost per gb of all EBS which is bootable
- ideal for workloads that data is IA and apps want low cost
EC2 Instance
- one subnet one AZ
- default monitoring is every 5 minutes, 1 minute cloudwatch detailed is charged
- security group is a firewall
A security group is a set of firewall rules that control the traffic for your instance. - default user is
ec2-user
Security Group
- any update of security group, it work immediately
- security groups is stateful, when you add an inbound rule, out bound rule will work too (vpc network rules are not, they are stateless, add one inbound, u have to add one outbound too)
- you cannot block IP, not like vpc network ACL
- All port default is block, add it as a rule to allow, all outbound is allowed defaultly
- an instance can have many security groups, a group can have many too
- you cannot deny rules
EBS Elastic Block Store
- standard we cannot modify volume
- ec2 instance and EBS volume are in the same AZ
- Use snapshot to transfer to another AZ
- create snapshot -> copy to another region to move by region