Compute Flashcards
EC2
Manage & rent virtual servers
Lambda
A serverless compute service that runs code without you managing servers.
Uses your own app code, called functions, and supports many popular languages.
Scales automatically.
Lambda allows devs. to focus on core business logic for apps they are developing instead of worrying about managing servers
EC2 Spot Instance
Let you take advantage of unused EC2 capacity. Request is fulfilled only if capacity is available.
Uses:
- You are not concerned about start or stop time of your app
- Your workloads can be interrupted
- Your app is only feasible at very low compute prices
you can save up to 90% off on demand pricing. You pay spot prices that are in effect @ the beginning of each hour
EC2 On Demand Pricing
Fixed price in which you are billed down to the second based on the instance type. No contract and you only pay for usage.
Uses:
- You care about low cost without any upfront payment or commitment
- Your apps have unpredictable workloads that can’t be interrupted
- Your apps are under development
- Your workloads will not run longer than a year
You can reserve capacity using on-demand capacity reservations. The EC2 capacity is held for you whether or not you run the instance.
EC2 Reserved Instance
Allow you to commit to a specific instance type in a particular region for 1 - 3 years.
Uses:
- App has a steady state usage and you can commit for 1 - 3 years
- You can pay $ upfront to get a discount on, on-demand pricing
- Your app requires a capacity reservation
You can save up to 75% on, on-demand pricing.
You are required to sign a contract.
You can reserve capacity in an availability zone for any duration
You can pay all upfront, partial upfront, or no upfront. All upfront for a max term gets the best discount.
Provides convertible types at 54% discount
EC2 Dedicated Hosts
Dedicated Hosts allow you to pay for a physical server that is fully dedicated to running your instances.
Uses:
- You want to bring your own server bound licenses from vendors like MS or Oracle
- You have regulatory or corporate compliance requirements around your tenancy model
You can save up to 70% off on demand prices
You bring your existing per socket, per core, or per VM software licenses
There is no multi-tenancy meaning the server isn’t shared with other AWS customers
A dedicated host is a physical server where a dedicated instance runs on a host
EC2 Savings Plan
Allows commitment to compute usage, measured per hour, for 1 - 3 years
Uses:
- You want to lower your bill across multiple compute services
- You want the flexibility to change compute services, instance types, OS’s, or regions
You can save 72% off on demand pricing
You are not making a commitment to a dedicated host just compute usage
Savings can be be shared across various compute services like EC2, Fargate, and Lmbda
EC2 Load Balancing - Elastic Load Balancing
Automatically distributes your incoming app traffic across multiple EC2 instances.
Classic load balancers, app load balancers, gateway load balancers, network load balancers
EC2 Auto-scaling
Adds or replaces EC2 instances automatically across AZs, based on need and changing demand
Horizontal scaling - scaling out (auto scaling) reduces the impact of system failures and improves the availability of your apps.
*don’t confuse horizontal scaling for vertical scaling - scaling up. Vertical scaling upgrades an EC2 instance by adding more hardware resources to an existing VM
Ways to connect to an EC2 Instance
AWS mgmt console
SSH
EC2 instance connect
AWS systems manager
Lambda Use Case: Real-Time File Processing
Use a trigger like uploading a file to S3, lambda then pulls that data from S3 and imports it to dynamo db
Lambda Use Case: Sending Email Notifications
Sends an email based on predefined trigger in conjunction with other services
Lambda Features
- Supports popular programming languages like Java, python, powershell, ruby, c#, etc.
- You author the code either in your favorite ide, or via the console
- Lambda can execute code in response to events
- Lambda functions have a 15 minute time out and aren’t good for things longer than 15 min
Lambda Pricing Model
You’re charged on the duration and # of requests
- Compute time, pay only for the compute time used, there is no charge if your code isn’t running
- Request Count - a request is counted each time it starts execution. Test invokes in the console as well (eg. testing is charged)
- Always Free - the free usage tier includes 1 million free requests each month
AWS Fargate
Serverless compute engine for containers.
Allows management of containers like docker.
Fargate scales automatically.