STCLOUD_mod6_compute FULL MAYBE
Module 6 Section 1: Compute Services Overview
i came late to this class, he was already talking about CT Templates under Amazon Compute Services
Amazon Compute Services
- there are many services to support different user needs
note: managed vs unmanaged
- managed (parts are managed by the cloud provider)
- unmanaged (everything is managed by you)
bolded - covered in the module
- Amazon EC2 - VMs
- Amazon EC2 Autoscaling
- Amazon Elastic Container Registry (Amazon ECR) - Container Templates, repository of many different kinds of containers, fully managed service that takes care of different kinds of containers
- Amazon Elastic Container Service (Amazon ECS) - Containers, fully managed orchestration service, helps run and manage containerized applications
- VMware Cloud on AWS
- AWS Elastic Beanstalk - Orchestration
- AWS Lambda - Serverless compute (just run your code)
- Amazon Elastic Kubernetes Services (Amazon EKS) - Open source Container Product, Fargate is a product from AWS, EKS lets you use the open source service already
- Amazon Lightsail - Web app
- AWS Batch
- AWS Fargate - managed containers, serverless compute engine for containers, we just manage the container itself nalang
- AWS Outposts - on premises
- AWS Serverless Application Repository
There are so many services offered for your use case as a customer of AWS/cloud
Categorizing Compute Services
- services are "options" for you to choose from with each one having its pros and cons
- depending on the skillset level and use-case
- VMs
- Serverless
- Containers
- Orchestration
Services | Key concepts | Characteristics | Ease of Use |
---|---|---|---|
Amazon EC2 - VMs are hardware virtualization |
- infrastructure as a service (IaaS) - instance-based - virtual machines for control and flexibility - VMs can do almost everything |
provision virtual machines that you can manage as you choose | a familiar concept to many professionals |
AWS Lambda - example: if you wanna backup your server every month - on-demand function calls |
- serverless computing (run code or scripts without managing a server) - function-based - low-cost - select what language you like and then input your code or script |
- write and deploy code that runs on a schedule or that can be triggered by events - use when possible (architect for the cloud) |
a relatively new concept for many IT staff members, but easy to use after you learn how |
Amazon ECS, EKS, Fargate, ECR - containers are OS virtualization; containers are for apps |
- container-based computing (lightweight and fast) - instance-based |
spin up and run jobs more quickly | AWS Fargate reduces administrative overhead but you can use options that give you more control |
Amazon Elastic Beanstalk - orchestration - ex. if you're a developer who doesn't know how to handle operations or deployment or infrastructure side but you want a website that will automatically load balance various machines and a DB |
- Platform as a Service (PaaS) - for web applications (orchestration and ease in deployment) - setup the things you like and then everything else will be handled automatically |
- focus on your code (building your application) - can easily tie into other services (databases, domain name system, etc.) |
fast and easy to get started |
Choosing the Optimal Compute Service
- there are many services to choose from, so choose the option that best fits your needs
- the optimal compute service or services that you will use will depend on your use case
- some aspects to consider:
- what is your application design?
- what are your usage patterns?
- which configuration settings will you want to manage?
- selecting the wrong compute solution for an architecture can lead to lower performance efficiency
- a good starting place - understand the available compute options
if you're happy using cloud → you use more
Module 6 Section 2: Amazon EC2 (VMs)
11:03
Amazon Elastic Compute Cloud (Amazon EC2)
- VMs are the closest to traditional services
- Example uses:
- application server, web server, database server
- game server, mail server, media server, catalog server, file server
- computing server, proxy server
Amazon Elastic Compute Cloud (Amazon EC2) Overview
- VMs have full control, but also have more responsibilities
- provides virtual machines (EC2 Instances) in the cloud
- gives you full control over the guest operating system (windows or linux) on each instance
- you can launch instances of any size into an Availability Zone anywhere in the world
- launch instances from Amazon Machine Images (AMIs)
- launch instances with a few clicks or a line of code, and they are ready in minutes → speed and agility
- you can control traffic to and from instances via security groups
EC2/VMs: Selecting an Instance Type
- instance types are machine categories (how will the EC2 instance you create be used?)
- if you have specific needs, you can choose a category that fits your use case
- the instance type that you choose determines:
- memory (RAM)
- processing power (CPU)
- disk space and disk type (storage)
- network performance
- instance type categories (for AWS, categories depend on the service provider):
- general purpose
- compute optimized
- memory optimized
- storage optimized
- accelerated computing
- instance types offer family, generation, and size
EC2/VMs Instance type naming and sizes
- refers to how much resources
- example: t3.large
- t is the family name
- 3 is the generation number
- large i the size
- how many vCPU cores, how many GB of memory
Select instance type based on use case
- based on use case → what your generation needs
Category | General Purpose | Compute Optimized | Memory Optimized | Accelerated Computing | Storage Optimized |
---|---|---|---|---|---|
Instance types | a1, m4, m5, t2, t3 | c4, c5 | r4, r5, x1, z1 | f1, g3, g4, p2, p3 | d2, h1, i3 |
Use Case | Broad | High performance | in-memory databases | machine learning | distributed file systems |
comment | generic use-case, default choice | CPU-heavy, non-GPU compute | big data, in-memory database, makes DB queries REALLY fast | floating point, linear algebra, graphics | large storage, fast I/O or IOPS (I/O per second), fast read/write access |
EC2/VMs: User Data Script (Optional)
- you can run scripts on create such as download
apache
andgit pull
your web code - optionally specify a user data script at instance launch
- great for initial setup
- use user data scripts to customize the runtime environment of your instance
- script runs the first time the instance starts
- can be used strategically
EC2/VMs: Specify Storage
- configure the root volume (like C:/)
- where the guest operating system is installed
- attach additional storage volumes (like D:/) (optional)
- AMI might already include more than one volume
- for each volume, specify:
- the size of the disk (in GB)
- the volume type
- different types of SSDs and HDDs are available
- if the volume will be deleted if the instance is terminated
- if encryption should be used
- encryption is a choice: so if you choose not to have encryption and something bad happens, that's on you; user choice means user responsibility
EC2/VMs: storage options
there are two options for the root disk storage option
- Amazon Elastic Block Store (Amazon EBS) - separate cost from your VM
- durable, block-level storage volumes (like a hard disk or hard drive, overwrites blocks of storage)
- you can stop the instance and start it again, and the data will still be there (non-volatile but with payment)
- Amazon EC2 Instance Store - already part of a VM so no added cost
- ephemeral/temporary storage (volatile and good for temporary instances) is provided on disks that are attached to the host computer where the EC2 instance is running
- if the instance stops, data stored here is deleted
- Other options for storage (not for the root volume)
- mount an Amazon Elastic File System (Amazon EFS) file system - network storage (good for scaling and shared data)
- connect to Amazon Simple Storage Service (Amazon S3) - object storage for unstructured data
EC2/VMs: Example Storage Options
- Instance 1 characteristics:
- has an Amazon EBS root volume type for the operating system
- what will happen if the instance is restarted?
- data will retain
- Instance 2 characteristics:
- has an Instance Store root volume type for the operating system
- what will happen if the instance stops because of a user error or system malfunction?
- data will not retain
EC2/VMs: Console view of running EC2 instance (web GUI aka management console)
EC2/VMs: launching an EC2 instance with the AWS Command Line Interface
- the web GUI/management console is good for 1-2 VMs but if you need thousands it's hard to run the wizard so many times, so use the CLI instead
- EC2 instances can be created programmatically
- generates all the needed instances for you without needing to do it manually
EC2/VMs: Amazon EC2 instance lifecycle
- machine states
- only VMs with block storage can be stopped
- when you turn ephemeral storage ones it's deleted
EC2/VMs: Check your understanding
- managed service → managed by the cloud provider
- you have less control but it's easier on you because you have less responsibility
- what's the best option? → the answer is always that it depends
- managed service is like outsourcing. a VM is normally cheaper if you already have manpower and technical skills
Module 6 Section 3: Amazon EC2 Cost Optimization
30:26
- TLDR: cloud is expensive
- you have to optimize your cost so you can maximize what you pay for
Amazon EC2 Pricing Models
-
there are many options for different use-cases
-
On-demand Instances
- pay by the hour
- no long-term commitments
- eligible for AWS free tier
- stop guessing capacity but very expensive
-
Dedicated Hosts
- a physical server with EC2 instance capacity fully dedicated to your use
- good for compliance, rent the whole host server
-
Dedicated Instances
- instances that run in a VPC on hardware that is dedicated to a single customer
- good for isolation
-
Reserved Instances
- full, partial, or no upfront payment for instance you reserve
- discount on hourly charge for that instance
- 1-year or 3-year term (long term with discounts)
-
Scheduled Reserved Instances
- purchase a capacity reservation that is always available on a recurring schedule you specify
- 1-year term
- reservation but with schedules
- if you don't need it 24/7
-
Spot Instances
- instances run as long as they are available and your bid is above the Spot Instance Price
- they can be interrupted by AWS with a 2-minute notification
- interruption options include terminated, stopped, or hibernated
- prices can be significantly less expensive compared to On-Demand Instances
- good choice when you have flexibility in when your applications can run
- if you need high compute with the lowest cost and you are not in a hurry
Per second Billing is available for On-Demand Instances, Reserved Instances, and Spot Instances that run Amazon Linux or Ubuntu
Amazon EC2 Pricing Models: Benefits and Use Cases
On-Demand Instances | Spot Instances | Reserved Instances | Dedicated Hosts | |
---|---|---|---|---|
Benefits | - low cost, flexibility - good for short term - for auto scaling - if you have a "spiky pattern" of usage |
- large scale, dynamic workload - time insensitive - lowest cost |
- predictability ensures compute capacity is available when needed - for long term - good for constant use or baseline resource needs |
- save money on licensing costs - help meet compliance and regulatory requirements - rent the whole physical server - no "noisy neighbor" since whole server is dedicated (to you) |
spiky workloads | time-insensitive workloads | steady-state workloads | highly sensitive workloads | |
Sample Use cases | - short-term, spiky, or unpredictable workloads - application development or testing |
- applications with flexible start and end times - applications only feasible at very low compute prices - users with urgent computing needs for large amounts of additional capacity |
- steady state or predictable workloads - applications that require reserved capacity, including disaster recovery - users able to make upfront payments to reduce total computing costs even further |
- bring your own license - compliance and regulatory restrictions - usage and licensing tracking - control instance placement |
The 4 pillars of cost optimization
practices to help reduce cost
- Right size
- Increase elasticity
- Optimal Pricing Model
- Optimize storage choices
Pillar 1: Right Size
-
determine your baseline by monitoring and observing
-
right size means resources are not wasted and the cost is manageable
-
provision instances to match the need
- CPU, memory, storage, and network throughput
- select appropriate instance types for your use
-
use Amazon CloudWatch (monitoring) metrics
- how idle are instances and when?
- downsize instances
-
best practice: right size, then reserve (since Reserved Instances are cheaper)
Pillar 2: Increase Elasticity
-
scaling will support the changes or sudden resource spikes
-
stop or don't use the machines you don't really need right now
-
stop or hibernate Amazon EBS-backend instances that are not actively in use
- ex. non-production development or test instances
-
use automatic scaling to match needs based on usage
- automated and time-based elasticity
Pillar 3: Optimal Pricing Model
-
you can use multiple pricing models at the same time
-
leverage the right pricing model for your use case
- consider your usage patterns
-
optimize and combine purchase types
examples
- use On-Demand Instance and Spot Instances for variable workloads
- use Reserved Instances for predictable workloads
- consider serverless solutions like AWS Lambda
Pillar 4: Optimize Storage Choices
-
storage is not cheap
-
reduce costs while maintaining storage performance and availability
-
resize EBS volumes
-
change EBS volume types
- can you meet performance requirements with less expensive storage?
- ex. Amazon EBS Throughput Optimized HDD (st1) storage typically costs half as much as the default General purpose SSD (gp2) storage option
-
delete EBS snapshots that are no longer needed
-
identify the most appropriate destination for specific types of data
- does the application need the instance to reside on an Amazon EBS?
- Amazon S3 storage options with lifecycle policies can reduce costs
Cost Estimation Summary: Measure, monitor, improve
- cost estimation a continuous, ongoing process
- define and enforce cost allocation tagging
- define metrics, set targets, and review regularly
- encourage teams to architect for cost
- assign the responsibility of optimization to an individual or to a team
recording ended here
- rest of the slides are more in-depth about compute types