AWS EC2 - General Overview

AWS EC2 - General Overview

Amazon Elastic Cloud Computing Basic Overview

Amazon EC2 is considered to be one of the most popular services of AWS. EC2 allows you to launch Virtual Machines (VM) that are powered by XEN or Nitro Hypervisor which improves performance significantly. EC2 is a highly configurable service that makes bare metal available as an Infrastructure as a Service, thereby providing several options in terms of computing resources such as:

  • Amount of CPUs, cores, memory(RAM)
  • Network configuration(speed, public IP address, Elastic IP...)
  • Operating System (OS): Linux, Windows, Mac OS
  • Storage (EBS, EFS, EC2 instance store)
  • Firewall rules (Security groups)
  • Bootstrap Script Configured at first launch (User Data commands are run with sudo rights)

image.png

EC2 Instances Type

Instance types are different combinations of CPU, Memory, Storage, and Networking capacity, which allows the user to choose appropriate resources according to the application’s requirements.

image.png

Example - m5.2xlarge M: Class 5: Generation 2xlarge: Size of instance (CPU, RAM)

General Purpose

  • Balance between compute, memory, and networking
  • Suitable for a diversity of workloads
  • Use case: web servers, code repositories

Compute Optimised

  • Suitable for a compute-intensive task that requires high-performance processors (CPU) ML, scientific modeling
  • Use case: dedicated gaming servers

Memory Optimised

  • Fast performance of workloads that process large datasets in memory
  • Relational and non-relational databases
  • Distributed web-scale cache stores
  • In-memory databases optimized for BI ( Business Intelligence )
  • Application performing real-time processing of big unstructured data.

Storage Optimised

  • Suitable for a storage-intensive task that requires high sequential read/write access to data on local storage
  • High-frequency online transaction processing (OLTP) systems
  • Relational and NoSQL database
  • Cache for in-memory databases (eg Redis)
  • Data warehousing applications
  • Distributed file systems

EC2 Instance Purchasing Options

image.png

On-demand Instance

  • Pay for what you use (Linux, Windows: per second billing, Others OS: per hour billing)
  • No up-front payment (predictable pricing)
  • No long-term commitment
  • Short-term, spiky, and un-interrupted workloads

Reserved Instance

  • 75% discount compared to On-demand (no upfront)
  • Greater upfront payment, more discount
  • Longer term (minimum 1 year), more discount
  • Less flexible (specific instances type), more discount
  • Suitable for long workloads and steady-state usage applications (eg database)

image.png

Convertible Reserved Instance

  • Offer more flexibility with the capacity to change the instance type
  • Up to 54% discount

Scheduled Reserved Instances

  • Commit over 1 to 3 year
  • Launch within the time window a fraction of a day/week/month
  • E.g. every Thursday between 3 pm and 6 pm

Spot Instances

  • A most cost-efficient instance in AWS (discount up to 90%)
  • Can be lost at any point in time if the max price is less than the current spot price
  • Useful for workload resilient to failure
  • Not suitable for critical jobs or database
  • Use case: bach job, data analysis, image-processing, distributed workloads with flexible start and end time

image.png

Dedicated Hosts

  • Whole physical server with EC2 instance capacity fully dedicated to your use
  • Reduce costs by allowing you to use your existing server-bound software licenses
  • Allocated for your account for 3 years of reservation
  • Suitable for companies that have strong regulatory or compliance needs
  • Useful for software that has a complicated licensing model (BYOL- Bring Your Own License)

image.png

Dedicated Instances

  • Soft version of dedicated hosts
  • Instance running on hardware dedicated to you
  • May share hardware with other instances in the same account
  • No control over instance placement
  • No access or control of hardware
  • Per instance billing
  • Can be offered on-demand, reserved (up to 60% savings ), spot(up to 90%)

image.png

Amazon Machine Image(AMI)

AMI represents the state of the machine at the time it was created. Once an EC2 instance is launched, it can be customized by installing software, OS, and additional configuration. A New EC2 instance can be launched from the custom AMI with a faster boot/config time because all software is pre-packaged. AMIs are built for s specific regions and can be provided by AWS, trusted publishers, the community, and AWS Marketplace.

image.png

Amazon EC2 Image Builder

EC2 Image Builder provides a non-stop shop to automate image management processes. Customers can generate an automated pipeline that handles the building process of AMIs and Customers can also generate an automated pipeline with an intuitive wizard in the AWS console to produce compliant Linux and windows server images on AWS and on-premises. when software updates become available, Image Builder automatically produces a new image and distributes it to the stipulated AWS regions after running a test on it.

Automated pipeline process

  • Create a Builder EC2 instance
  • Customise software and add configuration on Instance
  • Generate new AMI
  • Create a Test EC2 instance
  • Run a test suite to check functionality, and security (whether an app is running properly)
  • Distribute the image to selected AWS regions

image.png

Benefits

  • Simplified building, testing, and deployment of VMs and container images
  • Keep image up-to-date with a simple graphical interface and built-in automation
  • Offered at no cost, other than the cost of the underlying AWS resources used
  • Can be run on scheduled (weekly or whenever packages are updated)

Amazon EC2 Best Practices

  • Treat EC2 instances as disposable
  • Design for failure (embrace failure to have better availability)
  • Application should handle the failure of such an instance
  • Throw machines away and replace them according to the desired functionalities.
  • Leverage roles to control permissions of instance
  • Automate deployment as much as possible for more efficiency and security
  • Monitor Instances by using CloudWatch
  • Treat Logs as streams
  • Enable scaling and self-healing

Shared Responsibility Model

AWS

  • Infrastructure (global network security)
  • Replacing faulty hardware
  • Isolation on the physical host
  • Compliance validation

Customer

  • Security group and data security
  • OS patches and update
  • Software and utilities installed on the EC2 instance
  • IAM user access management and IAM role assigned to EC2

Now you have enough understanding of EC2 to appear for AWS Cloud Practitioner Eaxm Happy learning!

Did you find this article valuable?

Support Saquib Zeya by becoming a sponsor. Any amount is appreciated!