ec2实例类型
refer: https://aws.amazon.com/cn/ec2/instance-types/
General_Purpose | 通用 | 通用实例提供计算、内存和联网资源三方面的平衡,可用于各种不同的工作负载。这些实例非常适合于以相同比例使用这些资源的应用程序,如 Web 服务器和代码存储库。 | |
Compute_Optimized | 计算优化型 | 计算优化型实例非常适用于从高性能处理器获取的受计算限制的应用程序。属于此系列的实例非常适用于批处理工作负载、媒体转码、高性能 Web 服务器、高性能计算 (HPC)、科学建模、专用游戏服务器和广告服务器引擎、机器学习推理和其他计算密集型应用程序。 | |
Memory_Optimized | 内存优化型 |
| 内存优化型实例旨在提高可处理内存中大型数据集的工作负载的性能。 |
Accelerated_Computing | 加速计算 | 加速计算实例使用硬件加速器或协同处理器来执行浮点数计算、图形处理或数据模式匹配等功能,比使用在 CPU 上运行的软件更高效。 | |
Storage_Optimized | 存储优化型 |
| 存储优化型实例旨在用于需要对本地存储上的大型数据集进行高速连续读写访问的工作负载。它们经过了优化,每秒可以向应用程序交付数以万计的低延迟、随机 I/O 操作 (IOPS)。 |
命名约定
实例类型名称由实例系列、世代和大小组成。它们还可以表示其他功能,例如:
- a – AMD 处理器
- g – AWS Graviton 处理器
- i – 英特尔处理器
- d – 实例存储卷
- n – 网络优化
- b – 数据块存储优化
- e – 额外的存储或内存
- z – 高频率
m5.2xlarge
- m: 实例系列 instance class
- 5: 世代 generation (AWS improves them over time)
- 2xlarge: 大小 size within the instance class
Introduction to Security Groups
- Security groups only contain allow rules
- Security groups rules can reference by IP or by security group
Security Groups Good to know
- Can be attached to 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
- It's good to maintain one separate security group for SSH access
- If your application is not accessible (time out), then it's a security group issue
- If your application gives a "connection refused" error, then it's an application error or it's not launched
- All inbound traffic is blocked
- All outbound traffic is authorised
Classic Ports to know
- 22 = SSH (Secure Shell) - log into a Linux instance
- 21 = FTP (File Transfer Protocol) – upload files into a file share
- 22 = SFTP (Secure File Transfer Protocol) – upload files using SSH
- 80 = HTTP – access unsecured websites
- 443 = HTTPS – access secured websites
- 3389 = RDP (Remote Desktop Protocol) – log into a Windows instance
EC2 Instances Purchasing Options
- On-Demand Instances: short workload,predictable pricing, pay by second
- ·Pay for what you use:
- Linux or Windows-billing per second after the first minute
- All other operating systems-billing per hour
- Has the highest cost but no upfront payment
- No long-term commitment
- ·Recommended for short-term and un-interrupted workloads, where you can't predict how the application will behave
- Reserved: (l & 3years) 预定且可以预付
- Reserved Instances: long workloads
- Convertible Reserved Instances: long workloads with flexible instances
- Scheduled Reserved Instances: example – every Thursday between 3 and 6 pm
- Savings Plans(I & 3 years)-commitment to an amount of usage, long workload
- Spot Instances: short workloads, cheap, can lose instances (less reliable)
- Useful for workloads that are resilient to failure: Batch jobs, Data analysis, Image processing, Any distributed workloads, Workloads with a flexible start and end time
- 如果主动终止一个竞价实例,需要为当前这个完整小时付费
- 如果因为价格上涨,AWS终止了你的竞价实例,那么这个小时的费用会被免除
- Dedicated Hosts: book an entire physical server, control instance placement
- Dedicated Hosts can help you address compliance requirements and reduce costs by allowing you to use your existing server-bound software licenses
- Dedicated Instances: no other customers will share your hardware
- May share hardware with other instances in same account
- No control over instance placement (can move hardware after Stop / Start)
- Capacity Reservations-reserve capacity in a specific AZ for any duration