AWS Cloud Practitioner - Section 10 (Other Compute Services: ECS, Lambda, Batch, Lightsail)
Benefits of Lambda
* Pricing: pay per request and compute time * Every month, free tier is 1,000,000 requests and 400,000 Gigabyte-seconds (400,000 seconds if function is 1GB RAM) of compute time * Integrated with the whole AWS suite of services * Event-driven: functions are only invoked when needed * Compatible with many programming languages * Easy monitoring thru AWS CloudWatch * Easy to get more resources per functions (up to 10 GB of RAM) * Increasing RAM will also improve CPU and network
Fargate
Also allows you to launch Docker containers on AWS. You don't provision the infrastructure though, so it's simpler. It's serverless. AWS just runs containers for you based on the CPU/RAM you need.
Serverless examples
Amazon S3, DynamoDB, Fargate, Lambda
ECR
Elastic Container Registry. This is where you store Docker images so they can be run by ECS or Fargate.
ECS
Elastic Container Server. Used to launch Docker containers on AWS. Must provision & maintain the infrastructure (EC2 instances), but AWS will take care of starting/stopping containers. Has integrations with ALBs.
Batch
Fully managed batch processing service at any scale. Can feficiently run 100,000s of computing batch jobs on AWS. A "batch" job has a start and an end, as opposed to a continuous (e.g. streaming) job that never ends. Batch will dynamically launch EC2 instances or Spot instances based on the load. Provisions the right amount of compute/memory. Submit or schedule batch jobs and Batch does the rest. Defined as Docker images that run on ECS. Helpful for cost optimizations/focusing less on the infrastructure.
API Gateway
Fully managed service for developers to easily create, publish, maintain, monitor, and secure APIs. Serverless, scalable. Supports RESTful APIs and WebSocket APIs. Support for security, user auth, API throttling, API keys, monitoring, etc. Example: Client <-Rest API-> API Gateway <-Proxy Requests-> Lambda <-CRUD-> DynamoDB
FaaS
Function as a Service. Pioneered by AWS Lambda, but now also includes anything that's managed, e.g. databases, messaging, storage, etc. There are still servers obviously, but you don't manage or see them.
Batch vs Lambda
Lambda: * Time limit * Limited runtimes * Limited temporary disk space * Serverless Batch: * No time limit * Any runtime, just needs to be in a Docker image * Rely on EBS / instance store for disk space (can be a lot more than Amazon) * Not serverless. Managed service, but relies on EC2 instances (but again they're managed by AWS so we don't worry about them)
Serverless
New paradigm in which developers don't have to manage servers, just need to deploy code as functions.
Amazon Lightsail
Simpler alternative to using EC2, RDS, ELB, EBS, Route 53, etc. Great for people with little cloud experience. Has low & predictable pricing, and it has virtual servers, storage, databases, and networking. Use cases: * Simple web applications (has templates for common stacks like MEAN, Node.js, etc.) * Simple websites like WordPress * Dev / test environments Has high availability but no auto-scaling. It has limited AWS integrations. From exam perspective, it's almost always the wrong answer, but it's for people with LIMITED CLOUD EXPERIENCE.
Lambda
Virtual functions, no servers to manage. Intended to be used for shorter executions that are run on-demand. Scaling is automated.
Batch (simplified example)
Want to process images submitted by user Images submitted to Amazon S3 (trigger). AWS Batch will spin up EC2 instances that run your Docker images that contain the application to process the images. Then it will output them into another S3 bucket.