what is EC2
EC2 stands for Elastic Compute Cloud. It is a web service provided by Amazon Web Services (AWS) that allows users to rent virtual servers in the cloud.
EC2 instances can be easily scaled up or down based on the user’s needs, providing flexibility and cost efficiency.
These instances can be used to run applications, host websites, process large amounts of data, and perform various other computing tasks.
EC2 offers a wide range of instance types to cater to different workloads, and users have full control over the configuration and management of their instances.
capabilities
- launch virtual servers
- manage storage (EBS, EFS, S3)
- scale up or down based on demand (ASG)
- distribute traffic across multiple instances (ELB)
configure options
- os
- CPU
- memory
- storage
- network
- security (IAM, security groups, key pairs)
- bootstrap scripts (user data)
instance types
- general purpose (t2, m5)
- compute optimized (c5)
- memory optimized (r5)
- storage optimized (i3)
- accelerated computing (p3, g4)
security groups
- act as a virtual firewall for your EC2 instances
- control inbound and outbound traffic
- can be associated with multiple instances
- locked down to a region/VPC combination
- does live outside the EC2 - if traffic is blocked, the EC2 instance won’t see it (time out)
- can reference other security groups
pricing
- on-demand: pay for what you use
- reserved: capacity reservation for 1 or 3 years
- reserved
- convertible reserved instances
good for steady-state usage application(db)
reserve a specific instance attributes (instance type, region, tenancy, os)
you can buy and sell in marketplace
spot: bid for unused capacity
savings plan: commit to a consistent amount of usage for a discount
if beyond pay, converted to on-demand
locked to a specific instance family, aws region
flexible: instance size, os, tenancydedicated hosts: physical server dedicated for your use
dedicated instances: instance running on a dedicated host
capacity reservation: reserve capacity for specific instance type in a specific AZ
placement groups
- cluster: low latency, high throughput
- partition: multiple EC2 instances within a single AZ
- spread: EC2 instances on distinct hardware,
maximum 7