Other Compute Services Flashcards
What is Docker?
• Docker is a software development platform to deploy apps
• Apps are packaged in containers that can be run on any OS
• Apps run the same, regardless of where they’re run
• Scale containers up and down very quickly (seconds)
Where are Docker images stored?
• Docker images are stored in Docker Repositories
Docker versus Virtual Machines
• Docker is ”sort of” a virtualization technology, but not exactly
• Resources are shared with the host => many containers on one server
• VM emulates machine hardware whereas Docker emulates the operating system in which your application runs.
Elastic Container Service (ECS)
Is a fully managed container orchestration service that makes it easy for you to deploy, manage, and scale containerized applications.
• You must provision & maintain the infrastructure (the EC2 instances)
• AWS takes care of starting / stopping containers
Fargate
Fargate is a “serverless” way to run your ECS/EKS containers in a cluster. AWS manages the underlying host, which means you don’t have to think about patching, scaling, or securing of the host.
• AWS just runs containers for you based on the CPU / RAM you need
Elastic Container Registry (ECR)
• Private Docker Registry on AWS
• This is where you store your Docker images so they can be run by ECS or Fargate
What’s serverless?
• Serverless is a new paradigm in which the developers don’t have to manage servers anymore…
• They just deploy code
• They just deploy… functions
• Serverless does not mean there are no servers…
Some of the serverless services in AWS
• S3
• DynamoDB
• Fargate
• Lambda
Why AWS Lambda
• No servers to manage!
• Limited by time - short executions
• Run on-demand
• Scaling is automated!
Benefits of AWS Lambda
• Pay per request and compute time (Calls and Duration)
• Integrated with the whole AWS suite of services
• Event-Driven: functions get invoked by AWS when needed
• Can scale from a single request to hundreds of thousands per second.
• Integrated with many programming languages
• Easy to get more resources per functions (up to 10GB of RAM!)
AWS Lambda language support
• Node.js (JavaScript)
• Python
• Java (Java 8 compatible)
• C# (.NET Core)
• C# / Powershell
• Ruby
Lambda Container Image
Is a package that includes the Lambda Runtime API, necessary dependencies, an operating system, and function handlers required to run Docker containers in AWS Lambda.
• These packages allow development teams to deploy and execute arbitrary code and libraries into the Lambda runtime.
• ECS / Fargate is preferred for running arbitrary Docker images
Example: Serverless Thumbnail creation
New image in S3 > Trigger > AWS Lambda Function (Creates a Thumbnail) > Push > New thumbnail in S3
Example: Serverless CRON Job
CloudWatch Events EventBridge > Trigger Every 1 hour > AWS Lambda Function (Perform a task)
Amazon API Gateway
• Example: building a serverless API
• Fully managed service for developers to easily create, publish, maintain, monitor, and secure APIs
• Scalable
• Supports RESTful APIs and WebSocket APIs
• Support for security, user authentication, API throttling, API keys, monitoring…
Amazon API Gateway (Example)
Client > REST API > API Gateway > PROXY REQUESTS > Lambda > CRUD > DynamoDB
AWS Batch
A “batch” job is a job with a start and an end (opposed to continuous)
• Fully managed batch processing at any scale
• Efficiently run 100,000s of computing batch jobs on AWS
• Batch will dynamically launch EC2 instances or Spot Instances
• AWS Batch provisions the right amount of compute / memory
• Batch jobs are defined as Docker images and run on ECS
• You submit or schedule batch jobs and AWS Batch does the rest!
• Helpful for cost optimizations and focusing less on the infrastructure
AWS Batch (Example)
Amazon S3 > Trigger > AWS Batch with ECS launches an EC2 Instance & Spot Instance > Insert processed object > Amazon S3
Batch vs Lambda
Lambda: • Time limit • Limited runtimes • Limited temporary disk space • Serverless
Batch: • No time limit • Any runtime as long as it’s packaged as a Docker image • Rely on EBS / instance store for disk space • Relies on EC2 (can be managed by AWS)
Amazon Lightsail
Build applications and websites fast with low-cost, pre-configured cloud resources
• Virtual servers, storage, databases, and networking
• Low & predictable pricing
• Great for people with little cloud experience
• Has high availability but no auto-scaling, limited AWS integrations
• Use cases: Simple web applications, Websites and Dev / Test environment
Other Compute - Summary
• Docker: container technology to run applications
• ECS: run Docker containers on EC2 instances
• Fargate: Run Docker containers without provisioning the infrastructure (Serverless)
• ECR: Private Docker Images Repository
• Batch: run batch jobs on AWS across managed EC2 instances
• Lightsail: predictable & low pricing for simple application & DB stacks
Lambda Summary
• Lambda Billing: By the time run x by the RAM provisioned & By the number of invocations
• Language Support
• Invocation time: up to 15 minutes
• API Gateway: expose Lambda functions as HTTP API
• Use cases: Create Thumbnails for images uploaded onto S3 & Run a Serverless cron job