Stands for Elastic Compute Cloud. It provides on-demand, scalable computing capacity on AWS. By using EC2, we can launch as many as virtual servers we need without setting up a single server, that's the power of cloud computing.
Some characteristics of EC2:
- The most popular service on AWS
- We rent a virtual machine without setting up any server.
- It stores data on virtual drives (EBS - Elastic Block Store)
- Distributed load across machine (ELB - Elastic Load Balancing)
- Scaling the services using an auto-scaling group (ASG - Auto Scaling Group)
EC2 is the most fundamental service to understand how the cloud works for beginners.
- OS: Linux, win, mac
- CPU, RAM, storage space (network-attached: EBS &EFS), and hardware (EC2 instance store)
- Firewalls: security groups (without setting the security groups properly, we cannot access the ec2 instance from the internet)
- bootstrap script (configured at first launch): ec2 user data, the script is launched when the machine starts (command) and runs only at the first start of the instance. Use it to automate boot tasks: Download common files install software, updates, or any thing...
- It is run with the root user (sudo)
There are some types of EC2 instances, and each instance type serves a different purpose.
- General purpose: ideal for applications that use these resources in equal proportions such as web servers and code repositories. balance between: computememorynetworking
- Compute Optimized: optimized for applications that require high-performance processors (require a strong CPU) to do tasks like batch processing, media transcoding, high-performance web servers, high-performance computing (HPC), machine learning, gaming servers, and compute-intensive applications...
- Memory Optimized: ideal for applications designed to deliver fast-performance workloads that process large data sets in memory: high-performance relational/non-relational databases, distributed cache stores, in-memory databases, real-time processing of big unstructured data applications.
- Accelerated Computing: use hardware accelerators, or co-processors, to perform functions, such as floating point number calculations, graphics processing, or data pattern matching. The hardware acceleration can include GPUs, and FPGAs, designed for these use cases: Generative AI applications, LLMs (Large Language Models), Deep learning training for natural language processing, and computer vision...
- Storage Optimized: great for storage-intensive tasks that require high, sequential read and write access to large data sets on local storage. Use cases: High-frequency online transaction processing (OLTP) system. Relational & NoSQL DB, applications that require higher storage density and very fast access to large data sets (Elasticsearch...)...
- HPC Optimized: ideal for running HPC (high-performance computing) workloads, suitable for applications such as large, complex simulations and deep learning workloads.