AWS Cloud Practitioner ‐ Module 2 - rFronteddu/general_wiki GitHub Wiki

Compute in the cloud means creating virtual machines with a cloud provider to run applications and tasks over the internet

Objectives:

  • Describe how compute resources are provisioned and managed in the cloud.
  • Compare the benefits and challenges of using virtual servers to managing physical servers on premises.
  • Identify the concept of multi-tenancy in Amazon EC2.

EC2 is more flexible, cost-effective, and faster than managing on-premises servers. It offers on-demand compute capacity that can be quickly launched, scaled, and terminated, with costs based on active usage. EC2 allows for faster development and deployment of applications. You can launch as many or as few virtual servers as needed and configure security, networking, and storage. You can scale resources based on usage, such as handling high traffic or compute-heavy tasks.

  • You only pay for running instances.
  • EC2 Instances are virtual machines (VMs), VMs share an underlying physical host machine with other instances (multitenancy)
  • Multitenancy: sharing underlying hardware between virtual machine
  • AWS Manager (Hypervisor): Makes sure instances are isolated and manages resource sharing
  • EC2 instances can scale vertically (Add/remove memory/cpu)

Traditional:

Cloud:

To start an EC2 instance:

  • Launch: select an Amazon Machine Image (AMI), which defines OS and other SW. Chose an instance type determining HW resources such as CPU, memory, network performance.
  • Connect: You can connect an EC2 instance in various ways, you can use SSH (linux) or RDP (windows) or you can use AWS system Mgr.
  • Use: Once connected, you can run commands, install SW, add storage, and perform other tasks

Summary:

  • Benefits of EC2: provides secure, resizable compute capacity in the cloud as EC2 instances. Highly flexible, Cost effective, and quick.
  • Identify the different Amazon EC2 instance types (5): General Purpose, Compute optimized, Memory optimized, Accelerated computing, Storage optimized.
  • Differentiate between the various billing options (5): On-Demand, Saving plans, Reserved, Spot instances, Dedicated host.
  • Benefits of EC2 Auto Scaling.
  • Benefits of ELB (Elastic Load Balancing).
  • Differences between Amazon Simple Notification Service ( SNS) and Amazon Simple Queue Service (SQS).
  • Summarize additional AWS compute options.

EC2 Characteristics

  • Multitenancy: Sharing underlying hardware between virtual machines. The hypervisor managed by AWS is responsible for coordinating (and isolating) this multitenancy.
  • EC2 instances are configurable (what runs on them) and resizable (stats of the virtual machine, can be extended/virtually scaled)
  • Virtual Scaling: On demand making EC2 instances bigger or smaller. You also control network access to EC2 instances.

How EC2 works

  • Launch: Select template with basic configurations for your instance (OS, application server, or applications). Select the instance HW type. Specify network security.
  • Connect: Next, connect to the instance. You can connect to the instance in several ways.
  • Use: Once connected to the instance, you can run commands to install software, add storage, copy and organize files, and more.

EC2 Instance types

EC2 instances are optimized for different tasks.

  • General Purpose: Balanced resources for diverse workloads (application servers | gaming servers | backends | small/medium DBs).
  • Compute optimized: Ideal for compute-bound applications that benefit from high-performance processors (high-performance backends | compute-intensive applications | dedicated gaming servers | optimized large batch processing | many transactions in a single group)
  • Memory optimized: Fast performance for workloads that process large datasets in memory (High performance DB)
  • Accelerated computing: Use hardware accelerators, or coprocessors, to perform some functions more efficiently (floating-point number calculations | graphics processing | data pattern matching).
  • Storage optimized: Designed for workloads that require high, sequential read/write access to large datasets on local storage (data-warehouse | distributed file systems | high-frequency online transaction processing (OLTP)). Designed to deliver tens of thousands of low-latency, random input/output operations per second (IOPS)to applications.

AMI - Amazon Machine Images

AMIs are pre-built VM images that have the basic components for what is needed to start an instance.

AMI include an OS, storage setup, architecture type, permissions for launching, and any extra SW already installed. You can use AMI to launch several EC2 instances that all have the same setup.

AMIs can be used in three ways.

  • you can create your own by building a custom AMI with specific configurations and software tailored to your needs.
  • you can use pre-configured AWS AMIs, which are set up for common operating systems and software.
  • you can purchase AMIs from the AWS Marketplace, where third-party vendors offer specialized software designed for specific use cases.

AMIs provide repeatability through a consistent environment for every new instance. Because configurations are identical and deployments automated, development and testing environments are consistent. This helps when scaling, reduces errors, and streamlines managing large-scale environments.

What are the required configurations when launching an Amazon EC2 instance for a web server?: AMI | Instance type | Storage

What is an AMI?: A pre-configured VM image that contains OS, application server, and applications. This helps to launch EC2 instances quickly with the desired software and settings.

How to provision AWS Resources

  • AWS Management Console (web interface for managing AWS services, offering quick access to services, search functionality, and simplified workflows. * mobile app, you monitor resources, view alarms, and check billing, supporting multiple logged-in identities at once, good to setup test env, view bills, monitoring, and non technical resources)
  • the AWS CLI across Windows, macOS, and Linux. You can automate tasks through scripts, such as launching EC2 instances. (Advanced users and developers who need to automate tasks, script actions, and manage AWS resources efficiently from the command line),
  • and the AWS SDK (providing APIs for various programming languages, good for integrating AWS services into applications using language-specific APIs) to interact with AWS services: In AWS everything is an API call. There are three main ways: using the AWS Management Console, the AWS CLI, or the AWS SDK
  • Describe the customer and AWS responsibilities regarding virtual machines.

The AWS Shared Responsibility Model outlines the division of duties between the customer and AWS. AWS handles the security of the cloud (hardware and infrastructure), whereas the customer is responsible for security in the cloud (applications, data, and access control).

  • Explain the differences between managed and unmanaged services: An unmanaged service like Amazon EC2 requires you to perform all of the necessary security configuration and management tasks. When you deploy an EC2 instance, you are responsible for configuring security, managing the guest OS, applying updates, and setting up firewalls (security groups).

EC2 Pricing

  • Explain the available Amazon EC2 pricing options.

  • Describe when to use each pricing option based on specific use cases.

  • Describe Amazon EC2 Capacity Reservations and Reserved Instance (RI) flexibility.

  • On-Demand (Pay for duration the instance runs-hours, seconds, ..): ideal for short-term, irregular workloads that cannot be interrupted. No upfront costs or minimum contracts apply. Run until stopped, pay only the compute time you use. For developing and testing applications and running applications that have unpredictable usage patterns, not recommended for workloads that last a year or longer because these can experience greater cost savings using Reserved Instances.

  • Saving plans (lower price for committed use over time, 1 year, 3 years): Reduce EC2 costs with term commitment to instance family and Region. Savings of up to 72% compared to On-Demand. Any usage up to the commitment is charged at the discounted Savings rate. Beyond commitment usage is charged at On-Demand rates. Similar savings to Standard Reserved Instances. Good option if you need flexibility over the duration of the commitment term in a chosen Region regardless of AZe, instance size, OS, or tenancy.

    • Unlike Reserved Instances, no need to specify type, size, OS, and tenancy nor to commit to a certain number of EC2 instances over the term.
    • EC2 Instance Savings Plans don't include an EC2 capacity reservation option.
    • Saving plans: good for predictable workload
    • Capacity reservation: good for workloads with strict capacity requirements in a specific AZ. Reservation are charged at On-Demand rate whether used or not.
  • Reserved instances (for predictable use over 1 or 3 yr terms, up to 75% discount compared to On-Demand. Can pay in full, half or no upfront). Must specify instance family and region. When you purchase a RI, AWS automatically applies the discount to other instance sizes within the same family based on the instance size footprint. It also applies the discount across multiple AZ for enhanced resource distribution and fault tolerance.

Convertible Reserved Instances are to run EC2 instances in different AZ or different instance types. You trade in a deeper discount when you require flexibility to run your EC2 instances. At the end of a RI term, you can continue using the EC2 instance without interruption but you are charged On-Demand rates until you terminate the instance or purchase/renew a new RI that matches the instance attributes.

  • Spot instances (discounted but can be reclaimed by AWS, up to 90% off compared to On-Demand): Ideal for workloads with flexible start and end times, or that can withstand interruptions. Launch only when spare AWS capacity is available. Instances may be interrupted with a 2 minutes warning when capacity is no longer available.

  • Dedicated host or instance(for compliance/security/licensing): Dedicated physical servers with EC2 instance capacity not shared with others. You can use your existing per-socket, per-core, or per-VM software licenses to help maintain license compliance. You can purchase On-Demand Dedicated Hosts and Dedicated Hosts Reservations. Of all the Amazon EC2 options that were covered, Dedicated Hosts are the most expensive.

    • The key difference is that Dedicated Instances provide isolation without you choosing which physical server they run on. Dedicated Hosts give you an entire physical server for exclusive use, providing complete control over instance placement and resource allocation.

Scaling

Objectives:

  • Recognize the concepts of scalability and elasticity as they apply to AWS.
  • Describe how AWS can help businesses adjust compute capacity based on varying demands.

Scalability refers to the ability of a system to handle an increased load by adding resources. You can scale up by adding more power to existing machines, or you can scale out by adding more machines. Scalability focuses on long-term capacity planning to make sure that the system can grow and accommodate more users or workloads as needed.

Elasticity is the ability to automatically scale resources up or down in response to real-time demand. A system can then rapidly adjust its resources, scaling out during periods of high demand and scaling in when the demand decreases. Elasticity provides cost efficiency and optimal resource usage at any given moment.

EC2 Auto Scaling adjusts the number of EC2 instances based on changes in application demand, providing better availability. It offers two approaches. Dynamic scaling adjusts in real time to fluctuations in demand. Predictive scaling preemptively schedules the right number of instances based on anticipated demand.

You can create Auto Scaling groups, which are collections of EC2 instances that can scale in or out to meet your application’s needs. An Auto Scaling group is configured with the following three key settings.

  • minimum capacity defines the least number of EC2 instances required to keep the application running It's the number of EC2 instances that launch immediately after you have created the Auto Scaling group.
  • desired capacity is the ideal number of instances needed to handle the current workload, which Auto Scaling aims to maintain. If you do not specify the desired number of EC2 instances in an Auto Scaling group, the desired capacity defaults to your minimum capacity.
  • maximum capacity sets an upper limit on the number of instances that can be launched, preventing over-scaling and controlling costs.

Because EC2 Auto Scaling uses EC2 instances, you pay for only the instances you use, when you use them.

AmazonCloudWatch can be used to obtain metrics about usage.

Dynamic scaling and predictive scaling can be used together.

Directing Traffic with Elastic Load Balancing (ELB)

Objectives:

  • Describe the challenge of traffic distribution and scalability in AWS environments.
  • Recognize the benefits of ELB in AWS: Efficient traffic distribution, automatic scaling (of ELB), simplified management.
  • Explain the relationship between EC2-AS and ELB in managing AWS resources. ELB and Auto Scaling work together. ELB distributes incoming traffic evenly across multiple EC2 instances. It also serves as a single-entry point for traffic into an Auto Scaling group. Auto Scaling automatically adjusts the number of EC2 instances based on demand.

ELB: Elastic Load Balancing: AWS service that automatically distributes incoming application traffic across multiple resources, such as EC2 instances. Elastic because it scales up/down based on traffic.

A load balancer acts as a single point of contact for incoming traffic to your Auto Scaling group, as you add/remove EC2 instances, requests route to the load balancer first and then spread across EC2 instances. The idea is to distribute the workload across multiple instances so that no single instance has to carry the bulk of it.

Routing methods

ELB uses several routing methods: Round Robin, Least Connections, IP Hash (for consistent routing), and Least Response time.

Although ELB and EC2 Auto Scaling are separate services, they work together to help ensure that applications running in EC2 can provide high performance and availability.

Messaging and Queuing

Objectives

  • Describe how SQS (Simple Queue Service) facilitates message queueing.
  • Explain how SNS (Simple Notification Service) uses a pub-sub model to distribute messages.
  • Identify difference between tightly and loosely coupled architectures.
  • Explain benefits of message queues.

A microservices architecture has components loosely coupled, meaning that if one fails, the others continue to function preventing the whole application from failing.

Supporting scalable and reliable cloud communication

Amazon EventBridge, SQS, and SNS support building event-driven and message-based systems.

  • EventBridge: Serverless service to connect different parts of an application using events. With EventBridge you route events from sources to other applications. EventBridge simplifies the process of receiving, filtering, transforming, and delivering events. SQS Simple Queue Service is a message queueing service that can send, store, and receive messages at any scale, ensuring messages are not lost and that other services don't need to be available for processing. In SQS, an app places messages into a queue, and a user or service retrieves the message, processes it, ant then removes it from the queue. SNS Simple Notification Service is a pub/sub service that publishers use to send messages to subscribers through SNS topics.
Link Description
Compute on AWS This resource provides an overview of the different AWS cloud computing services
AWS Compute Blog This blog provides updates, tutorials, and best practices for using AWS compute services, such as Amazon EC2, AWS Lambda, Amazon ECS, and more.
AWS Compute Services This reference provides an in-depth introduction to the compute services available within the AWS Cloud.
Hands-On Tutorials: Compute This resource provides practical, step-by-step tutorials designed to help users gain hands-on experience with AWS compute services. It is ideal for beginners and those new to cloud computing.
Amazon EC2 Amazon EC2 runs virtual servers in the cloud with flexible computing capacity.
Amazon EC2 Instance Types This guide provides detailed information about the different types of EC2 instances, including their specifications, capabilities, and use cases. It helps you choose the right instance type based on your workload needs, such as compute, memory, and storage requirements.
Amazon EC2 Pricing This guide explains the different pricing models for EC2 instances, including On-Demand, Reserved Instances, and Spot Instances, so you can choose the best option based on your usage.
Amazon EC2 Auto Scaling Amazon EC2 Auto Scaling automatically adjusts instance count based on demand for high availability and cost-efficiency.
Elastic Load Balancing Elastic Load Balancing automatically distributes incoming application traffic across multiple EC2 instances for high availability and fault tolerance.
Amazon Simple Notification Service Amazon SNS is a messaging service for sending notifications to users or other applications through SMS, email, or mobile push notifications.
Amazon Simple Queue Service Amazon SQS decouples application components through message queuing, storing and processing messages reliably.