EC2 (Elastic Compute Cloud)

  • Basic Infrastructure-as-a-Service (IaaS) product on AWS
  • AZ resilient: AZ fails, EC2 instance fails
  • customization
    • multiple instance types (sizes) available
    • storage option: on-host storage or Elastic Block Store (EBS)
  • billed per second for compute and storage
  • EC2 instance states
    • running: charged for compute, storage, traffic
    • stopped: instance is not running; charged for storage (and Elastic IP, if one is associated)
    • terminated: EC2 instance and its volume have been deleted (NOT reversible)
  • Amazon Machine Image
    • used to create EC2 instance
    • can be created from an existing EC2 instance
    • contains
      • attached permissions (e.g. public, implicitly allow owner, explicit allow)
      • root volume
      • block device mapping: how volumes are set up within OS
  • connection methods
    • EC2 Instance Connect (in-browser)
    • Session Manager (fullscreen in-browser): requires special configuration (e.g., instance IAM profile that grants access to SSM)
    • RDP (Windows)
    • SSH (Linux or Windows)
      • generate private key beforehand and download (only available during key creation on AWS)
      • Windows: SSH key get administrator password RDP

Create Key Pair

  • Network & Security Key Pairs Create key pair
  • Choose ED25519 unless instance doesn’t support it

Create instance

  • EC2 Instances Launch an instance
  • Choose AMI (e.g. Amazon Linux)
  • Choose VPC, subnet (no pref is OK)
  • public IP is free
  • security group: akin to mini-firewall, have to create one if none exists, default settings is fine
  • wait until status checks pass

Delete instance

  • Terminate instance
  • The attached EBS volume should be automatically deleted
  • Delete security group (wait until instance finishes terminating)