Skip to main content
  1. ๐Ÿ”ฐPosts/
  2. ๐Ÿ—‚๏ธMy Trainings/
  3. AWS Trainings and Certifications/
  4. ๐Ÿ…AWS Certified Cloud Practitioner/

EC2

๐Ÿ“š Part 4 of 25: "AWS Cloud Practitioner" series.

·873 words·5 mins

What is Amazon EC2 #

An Amazon EC2 instance is a virtual server in the AWS Cloud. When you launch an EC2 instance, the instance type that you specify determines the hardware available to your instance. Each instance type offers a different balance of compute, memory, network, and storage resources.



EC2 sizing and configuration options #

  • Operating System (OS) - Linux, Windows, Mac OS
  • How much compute power & CPU cores
  • How much RAM
  • How much storage space
  • Network card: speed of the card, Public IP address
  • Firewall rules: security group
  • Bootstrap script (configure at first launch): EC2 User Data

Amazon EC2 Instance Types #

More info: EC2 Instance Types, EC2Instances.info

  • General Purpose (M, T) - General
  • Compute Optimized (C) - Compute bound applications that benefit from thigh performance processors
  • Memory Optimized (R, X) - Optimized to deliver fast performance for workloads that process large data sets in memory (i.e. ElastiCache)
  • Accelerated Computing (P, G, Trn, Inf, DL, F, VT1) - Calculations, graphics processing or data pattern matching
  • Storage Optimized (I, Dx, H1) - High, sequential read and write access to very large data sets on local storage. Low-latency, random I/O operations per second (IOPS)
  • HPC Optimized (Hpc) - High Performance Computing - complex simulations and deep learning workloads

Instance type naming conventions #

More info: Amazon EC2 Instance type naming conventions

Example #

More info: Amazon EC2 Instance type naming conventions

SeriesOptions
- C โ€“ Compute optimized

- Hpc โ€“ High performance computing

- I โ€“ Storage optimized

- M โ€“ General purpose

- P โ€“ GPU accelerated

- R โ€“ Memory optimized
- a โ€“ AMD processors

- i โ€“ Intel processors

- b โ€“ Block storage optimization

- d โ€“ Instance store volumes

- e โ€“ Extra storage (for storage optimized instance types), extra memory (for memory optimized instance types), or extra GPU memory (for accelerated computing instance types).

- n โ€“ Network and EBS optimized

- q โ€“ Qualcomm inference accelerators

- z โ€“ High CPU frequency

Launching EC2 instance #

EC2 > Launch Instance

Example user data #

User data is only bootstrap script and only starts once during the machine creation.

#!/bin/bash
# Use this for your user data (script from top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html

Connecting to EC2 from Windows Terminal #

ssh -i .\.ssh\id_rsa_aws25 ec2-user@ec2-3-95-191-175.compute-1.amazonaws.com

EC2 Instances Purchasing options #

  • On-Demand instances - short workload, predictable pricing, pay by second
    • Pay for what used
      • Linux or Windows - billing per second after the first minute
      • All other operating systems - billing per hour
    • Highest cost but no upfront payment
    • No long-term commitment
    • Recommended for short-term and un-interrupted workloads
  • Reserved (1 & 3 years)
    • Up to 72% discount compared to On-demand
    • You reserve a specific instance attributes (Instance Type, Region, Tenancy, OS)
    • Reserved Instances - long workloads
    • Payment options - No upfront, Partial Upfront, All Upfront
    • Scope: Regional or Zonal
    • Recommended for steady-state usage applications (think database)
    • Can be bought and sold in the Reserved Instance Market place
    • Convertible Reserved Instances - long workload with flexible instances
      • Can change the EC2 instance type, instance family, OS, scope and tenancy
      • Up to 66% discount
  • Saving plans (1 & 3 years) - commitment to an amount of usage, long workloads
    • Get discount based on long-term usage
    • Commit to a certain type of usage ($10/hour for 1 or 3 years)
    • Usage beyond EC2 Savings Plans is billed at the On-Demand price
    • Locked to a specific instance family & AWS region
    • Flexible across
      • Instance Size (e.g. m5.xlarge, m5.2xlarge)
      • OS (e.g. Linux, Windows)
      • Tenancy (Host, Dedicated, Default)
  • Spot Instances - short workloads, cheap, can lose instances
    • Up to 90% discount
    • Instances can be “lost” at any point if max price is less than current spot price
    • Recommended for workloads that are resilient to failure
      • Batch jobs
      • Data analysis
      • Image processing
  • Dedicated Hosts - book an entire physical server, control instance placement
    • A physical server with EC2 instance capacity fully dedicated to your use
    • Recommended for for companies with strong compliance requirements OR server-bound software licenses (per-socket, per-core)
    • Purchasing Options:
      • On-demand
      • Reserved
    • Most expensive option
  • Dedicated Instances - no other customers will share your hardware
    • Instances run on a dedicated hardware
    • May share hardware with other instances in the same account
    • No control over instance placement

Dedicated Host vs Dedicated Instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html

  • Capacity Reservations - reserve capacity in a specific AZ for any duration


» Sources « #

Full YouTube Rahul’s AWS Course: https://www.youtube.com/playlist?list=PL7iMyoQPMtAN4xl6oWzafqJebfay7K8KP

» References « #

» Disclaimer « #

This series draws heavily from Stephane Maarek’s Ultimate AWS Certified Cloud Practitioner course on Udemy.

His content was instrumental in helping me pass the certification.

About the instructor
๐ŸŒ Website๐Ÿ“บ YouTube
๐Ÿ’ผ LinkedIn๐• x.com

โ„น๏ธShared for educational purposes only, no rights reserved.