AWS Advanced Compute Services

AWS has many advanced compute services like Lambda, ECS, Fargate, Batch, Lightsail, etc. This session will cover the main features of these services and how to use them. Lambda is a serverless compute service that allows you to run code without provisioning or managing servers. You pay only for the compute time you consume – there is no charge when your code is not running. You can run your code in response to events, such as HTTP requests via Amazon API Gateway, Amazon S3, or Amazon DynamoDB updates, or schedule your code to run at specific intervals using Amazon CloudWatch Events. You can also run code responding to messages from other AWS services, such as Amazon S3, Amazon DynamoDB, Amazon Kinesis, and Amazon Simple Queue Service (SQS).

Introduction To Docker

Docker is an open-source containerization platform. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment.

• Docker is a software development platform for deploying apps
• Apps are packaged in containers that can be run on any OS
• Apps run the same, regardless of where they’re run • Any machine
• No compatibility issues
• Predictable behavior
• Less work
• Easier to maintain and deploy
• Works with any language, any OS, any technology
• Scale containers up and down very quickly (seconds)

Docker Image Storage

Docker Hub is a hosted repository service provided by Docker for finding and sharing container images with your team. Key features include Private Repositories: Push and pull container images. Automated Builds: Automatically build container images from GitHub and Bitbucket and push them to Docker Hub.

• Docker images are stored in Docker Repositories
• Public: Docker Hub https://hub.docker.com

• Find base images for many technologies or OS:

• Ubuntu
• MySQL
• NodeJS, Java, Python
• Private: Amazon ECR (Elastic Container Registry)

Docker vs. Virtual Machines

Virtual machines have a host operating system and a guest operating system inside each VM. The guest OS can be any OS, such as Linux or Windows, irrespective of the host OS. In contrast, Docker containers are hosted on a single physical server with the host OS.

What Is Amazon ECS?

Amazon Elastic Container Service (ECS) is a highly scalable and fast container management service. You can use it to run, stop, and manage containers on a cluster. With Amazon ECS, your containers are defined in a task definition that you use to run an individual task or task within a service.

• ECS = Elastic Container Service
• Launch Docker containers on AWS
• You must provision & maintain the infrastructure (the EC2 instances)
• AWS takes care of starting/stopping containers
• Has integrations with the Application Load Balancer

What Is AWS Fargate?

AWS Fargate is serverless; pay-as-you-go compute engine that lets you focus on building applications without managing servers. AWS Fargate is compatible with Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS).

• Launch Docker containers on AWS
• You do not provision the infrastructure (no EC2 instances to manage) – simpler!
• Serverless offering
• AWS runs containers for you based on the CPU / RAM you need

Amazon ECR

Amazon Elastic Container Registry (Amazon ECR) is an AWS-managed container image registry service that is secure, scalable, and reliable. Amazon ECR supports private repositories with resource-based permissions using AWS IAM.

• Elastic Container Registry
• Private Docker Registry on AWS
• This is where you store your Docker images so they can be run by ECS or Fargate

How does AWS Serverless work?

AWS offers technologies for running code, managing data, and integrating applications without managing servers. Serverless technologies feature automatic scaling, built-in high availability, and a pay-for-use billing model to increase agility and optimize costs.

• Serverless is a new paradigm in which the developers don’t have to manage servers anymore
• They deploy code
• They deploy functions!
• Initially Serverless == FaaS (Function as a Service)
• AWS Lambda pioneered serverless but now includes anything managed: “databases, messaging, storage, etc.”
• Serverless does not mean there are no servers
it means you don’t manage / provision / see them

What Is AWS Lambda?

AWS Lambda allows you to add custom logic to AWS resources, such as Amazon S3 buckets and Amazon DynamoDB tables. You can easily apply it to compute data as it enters or moves through the cloud. It is easy to get started with AWS Lambda.

• Virtual functions – no servers to manage! • Limited by time – short executions
• Run on-demand
• Scaling is automated!

• Integrated with the whole AWS suite of services
• Event-Driven: functions get invoked by AWS when needed
• Integrated with many programming languages
• Easy monitoring through AWS CloudWatch
• Easy to get more resources per function (up to 10GB of RAM!) • Increasing RAM will also improve CPU and network!

AWS Lambda natively supports Java, Go, PowerShell, NodeJS, C#, Python, and Ruby code and provides a Runtime API that allows you to use additional programming languages to author your functions. Please read our documentation on using Node. Js, Python, Java, Ruby, C#, Go, and PowerShell.

• You can find overall pricing information here: https://aws.amazon.com/lambda/pricing
• Pay per call:
• First 1,000,000 requests are free
• $0.20 per 1 million requests after that ($0.0000002 per request)
• Pay per duration: (in increment of 1 ms)
• 400,000 GB-seconds of compute time per month for FREE • == 400,000 seconds if function is 1GB RAM
• == 3,200,000 seconds if function is 128 MB RAM
• After that $1.00 for 600,000 GB-seconds
• It is usually very cheap to run AWS Lambda, so it’s prevalent

Amazon API Gateway

Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. APIs are the “front door” for applications to access data, business logic, or functionality from your backend services.

• Fully managed service for developers to easily create, publish, maintain, monitor, and secure APIs
• Serverless and scalable
• Suppor ts RESTful APIs and WebSocket APIs
• Suppor t for security, user authentication, API throttling, API keys, monitoring

What is AWS Batch?

AWS Batch plans, schedules, and executes your batch computing workloads across the full range of AWS compute services and features, such as Amazon EC2 and Spot Instances. AWS Lambda is a computing service that lets you run code without provisioning or managing servers.

• Fully managed batch processing at any scale
• Efficiently run 100,000s of computing batch jobs on AWS
• A “batch” job is a job with a start, and an end (as opposed to continuous) • Batch will dynamically launch EC2 instances or Spot Instances
• AWS Batch provisions the right amount of compute / memory
• You submit or schedule batch jobs, and AWS Batch does the rest!
• Batch jobs are defined as Docker images and run on ECS
• Helpful for cost optimizations and focusing less on the infrastructure

• 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

Amazon Lightsail is a virtual private server (VPS) provider. It is the easiest way to get started with AWS for developers, small businesses, students, and other users who need a solution to build and host their applications on the cloud.

• Virtual servers, storage, databases, and networking
• Low & predictable pricing
• Simpler alternative to using EC2, RDS, ELB, EBS, Route 53…
• Great for people with little cloud experience!
• Can setup notifications and monitoring of your Lightsail resources
• Use cases:
• Simple web applications (has templates for LAMP, Nginx, MEAN, Node.js…) • Websites (templates for WordPress, Magento, Plesk, Joomla)
• Dev /Test environment
• Has high availability but no auto-scaling, limited AWS integrations

• Docker: container technology to run applications
• ECS: run Docker containers on EC2 instances
• Fargate:
• Run Docker containers without provisioning the infrastructure • Serverless offering (no EC2 instances)
• ECR: Private Docker Images Repository
• Batch: run batch jobs on AWS across managed EC2 instances
• Lightsail: predictable & low pricing for simple applications & DB stacks

• Lambda is Serverless, Function as a Service has seamless scaling, reactive
• Lambda Billing:
• By the time run x by the RAM provisioned • By the number of invocations
• Language Support: many programming languages except (arbitrary) Docker
• Invocation time: up to 15 minutes
• Use cases:
• Create Thumbnails for images uploaded onto S3 • Run a Serverless cron job
• API Gateway: expose Lambda functions as HTTP API

Learn More