getting started with aws compute services
TRANSCRIPT
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Sr. Product Marketing Manager
Compute Services, AWS
May 2016
Getting Started with
AWS Compute Services
Aaron Kao
Agenda
Compute Overview
What is Amazon EC2
Applications Evolved
Compute Evolved
How to Choose
Compute Overview
AWS Compute Offerings
• VMs
• Machine as the unit of scale
• Abstracts the hardware
• Containers
• Application as the unit of scale
• Abstracts the OS
• Serverless
• Functions as the unit of scale
• Abstracts the language runtime
ECS
EC2
Lambda
What is Amazon EC2?
Amazon EC2 – Overview
Virtual Servers in the Cloud
Server
Hypervisor
VM 1 VM 2 VM 3
Physical Servers in AWS Global Regions
Over 1 million active customers across 190 countries
2,000 government agencies
5,000 educational institutions
17,500 nonprofits
12 regions
33 Availability Zones
*11 more Availability Zonesand 5 more Regions coming online throughout the year
AWS Global Infrastructure
Amazon EC2 – Nine Years Ago…
First generation, single instance family and size
• m1.small (1 vCPU, 1.7 GiB RAM, 160 GB storage)
Linux only
On-Demand pricing only
Amazon EC2 – Today
General-purpose: M1, M3 , T2, M4
Compute-optimized: C1, CC2, C3, C4
Memory-optimized: M2, CR1, R3 {X1}
Dense-storage: HS1, D2
I/O-optimized: HI1, I2
GPU: CG1, G2
Micro: T1, T2
# of
instances
EC2 Instances: Types and Sizes
c4.largeInstance family
Instance generation
Instance size
http://aws.amazon.com/ec2/instance-types/
EC2 Instances: Types and Sizes
1 2 4 8 16 321
2
4
8
16
32
64
128
256
Me
mo
ry (
GB
)
vCPU
g2.2xlarge8 vCPU, 15 GB1 x 60 SSDNVIDIA GPU (1,536 CUDA cores, 4GB Mem)
4 vCPU, 30.5 GBi2.xlarge (High IO) - 1 x 800 SSDd2.xlarge (Dense) - 3 x 2000 HDD
8 vCPU, 61 GBi2.xlarge (High IO) - 2 x 800 SSDd2.xlarge (Dense) - 6 x 2000 HDD
16 vCPU, 122 GBi2.xlarge (High IO) - 4 x 800 SSDd2.xlarge (Dense) - 12 x 2000 HDD
32 vCPU, 244 GBi2.xlarge (High IO) - 8 x 800 SSD
36 vCPU, 244 GBd2.xlarge (Dense) - 24 x 2000 HDD
m3.xlarge4 vCPU, 15 GB2 x 40 SSD
m3.2xlarge8 vCPU, 30 GB2 x 80 SSD
m3.large2 vCPU, 7.5 GB1 x 32 SSDm3.medium
1 vCPU, 3.75 GB, 1 x 4 SSD
t2.micro1 vCPU, 1GBEBS Only
t2.small1 vCPU, 2GBEBS Only
t2.medium2 vCPU, 4GBEBS Only
r3.large2 vCPU, 15.25 GB1 x 32 SSD
r3.xlarge4 vCPU, 30.5 GB1 x 80 SSD
r3.2xlarge8 vCPU, 61 GB1 x 160 SSD
r3.4xlarge16 vCPU, 122 GB1 x 320 SSD
r3.8xlarge32 vCPU, 244 GB2 x 320 SSD
2 vCPU, 3.75 GBc4.large - EBS Onlyc3.large - 2 x 16 SSD
4 vCPU, 7.5 GBc4.xlarge - EBS Onlyc3.xlarge - 2 x 40 SSD
8 vCPU, 15 GBc4.2xlarge - EBS Onlyc3.2xlarge - 2 x 80 SSD
16 vCPU, 30 GBc4.4xlarge - EBS Onlyc3.4xlarge - 2 x 160 SSD
32 vCPU, 60 GBc4.8xlarge - EBS Onlyc3.8xlarge - 2 x 320 SSD
m4.large2 vCPU, 8 GBEBS Only
m4.xlarge4 vCPU, 16 GBEBS Only
m4.2xlarge8 vCPU, 32 GBEBS Only
m4.4xlarge16 vCPU, 64 GBEBS Only
m4.10xlarge40 vCPU, 160GBEBS Only
m4.large2 vCPU, 8 GBEBS Only
Storage Optimized
GPU Instances
General Purpose
Memory Optimized
Compute Optimized
New M4’s/T2 Large
t2.nano1 vCPU, 512MBEBS Only
EC2 Instances: Types and Sizes
Locally attached or “instance storage”
Network attached:
Amazon EBS General Purpose (SSD) volumes
Amazon EBS Provisioned IOPS (SSD) volumes
Amazon EBS Magnetic volumes
Amazon EFS
Amazon S3 and Amazon Glacier for object storage
Storage Options
Elastic cloud-based resources
Actual demand
Resources scaled to demand
Waste Customer
dissatisfaction
Actual demand
Predicted demand
Rigid on-premises resources
Auto Scaling
On-Demand
Pay for compute
capacity by the
hour with no long-
term commitments
For spiky
workloads, or to
define needs
Reserved
Make a low, one-
time payment and
receive a
significant discount
on the hourly
charge
For committed
utilization
Spot
Bid for unused
capacity, charged at
a Spot Price which
fluctuates based on
supply and demand
For time-insensitive
or transient
workloads
Dedicated
Launch instances
within Amazon VPC
that run on hardware
dedicated to a single
customer
For highly sensitive
or compliance-related
workloads
Purchasing Options
Fast DeploymentsAccess computing
infrastructure in minutes
Low CostPay-as-you-go pricing
ElasticEasily add or remove capacity
Globally AccessibleEasily support customers
around the world
SecureA collection of tools to
protect data and privacy
ScalableAccess to effectively
limitless capacity
Benefits of Cloud Servers
Applications Evolved
Order UI User UIShipping
UI
Order
Service
User
Service
Shipping
Service
Data
Access
A Monolithic Architecture
Scaling a Monolithic Architecture
Order UI User UIShipping
UI
Order
Service
User
Service
Shipping
Service
A Microservices Architecture
Order UI User UI UI
Order
ServiceService
Shipping
Service
Order UIOrder UI
User UI UIShipping
UI
Order
ServiceOrder
Service
ServiceService
ServiceService
User
Service
Shipping
Service
Scaling a Microservices Architecture
Compute Evolved – Containers
Docker
What are Containers?
OS virtualization
Process isolation
Images
Automation Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Container Advantages
Portable
Flexible
Fast
EfficientServer
Guest OS
Bins/Libs Bins/Libs
App2App1
Containers are Natural for Microservices
Simple to model
Any app, any language
Image is the version
Test & deploy same artifact
Stateless servers decrease change risk
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Managing One Host is Straightforward
Managing a Fleet is Hard
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
AZ 1 AZ 2
AZ 3
What is Amazon ECS?
Amazon EC2 Container Service (Amazon ECS) is a highly
scalable, high performance container management
service.
You can use Amazon ECS to schedule the placement of
containers across your cluster.
You can also integrate your own scheduler or third-party
scheduler to meet business or application specific
requirements.
Container Management at Any Scale
Nothing to run
Complete state
Control and monitoring
Scale
Flexible Container Placement
Long running applications
Batch jobs
Multiple schedulers
Integration with the AWS Platform
Elastic Load Balancing
Amazon Elastic Block Store
Amazon Virtual Private Cloud
Amazon CloudWatch
AWS Identity and Access Management
AWS CloudTrail
Compute Evolved – Serverless
What is Serverless?
Operations and Management
Provisioning and Utilization
Scaling
Availability and Fault Tolerance
Benefits of Serverless
Simple
Scalable
Low Cost
Reliable
Low Latency
What is AWS Lambda?
AWS Lambda lets you 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.
Just upload your code and Lambda takes care of
everything required to run and scale your code with high
availability
Using AWS Lambda
Bring your own code
• Node.js, Java, Python
• Bring your own libraries
(even native ones)
Simple resource model
• Select power rating from
128 MB to 1.5 GB
• CPU and network allocated
proportionately
• Reports actual usage
Flexible authorization
• Securely grant access to
resources, including VPCs
• Fine-grained control over
who can call your functions
Flexible use
• Call or send events
• Integrated with other AWS
services
• Build whole serverless
ecosystems
Using AWS Lambda
Programming model
• AWS SDK built in (Python
and Node.js)
• Eclipse plugin (Java)
• Lambda is the “webserver”
• Use processes, threads,
/tmp, sockets normally
Stateless
• Persist data using Amazon
DynamoDB, S3, or
ElastiCache
• No affinity to infrastructure
(can’t “log in to the box”)
Authoring functions
• Author directly using the
console WYSIWYG editor
• Package code as a .zip and
upload to Lambda or S3
• Plugins for Eclipse and
Visual Studio
• Command line tools
Monitoring and logging
• Built-in metrics for requests,
errors, latency, and throttles
• Built-in logs in Amazon
CloudWatch Logs
Pay-per Request
• Buy compute time in
100 ms increments for
21 microcents
• Request charge of 20
microcents
• No hourly, daily, or
monthly minimums
• No per-device fees
Free Tier
1 million requests and 400,000 GBs of compute
every month, every customer
How to Choose
How Do I Choose?
• VMs
• “I want to configure machines,
storage, networking, and my OS”
• Containers
• “I want to run servers, configure
applications, and control scaling”
• Serverless
• “Run my code when it’s needed”
ECS
EC2
Lambda
If You Need to Run…
• Open-source cluster management, big data, and
database software (e.g., Mesos, Hadoop)
• Enterprise applications (e.g., SAP, Oracle, Sharepoint)
• On-premises migrations
EC2
If You Need to Run…
• Web applications
• Docker workloads
• Microservices
• Batch jobs
ECS
If You Need to Run…
Web applications
Mobile backends
IoT backends
Stream processing workloads
File processing workloads
Lambda
Thank you!
Appendix
How ECS Helps
What is Amazon ECS?
Amazon EC2 Container Service (Amazon ECS) is a highly
scalable, high performance container management
service.
You can use Amazon ECS to schedule the placement of
containers across your cluster.
You can also integrate your own scheduler or third-party
scheduler to meet business or application specific
requirements.
Container Management at Any Scale
Nothing to run
Complete state
Control and monitoring
Scale
Flexible Container Placement
Long running applications
Batch jobs
Multiple schedulers
Integration with the AWS Platform
Elastic Load Balancing
Amazon Elastic Block Store
Amazon Virtual Private Cloud
Amazon CloudWatch
AWS Identity and Access Management
AWS CloudTrail
Container Management
What is a Container Manager?
• Maintains available resources
• Tracks resource changes
• Accepts resource requests
• Guarantees accuracy and consistency
CPU
Memory
Ports
Disk space
Disk IOPS
Network bandwidth
Resources
ECS
Agent
Docker
Task
Container Instance
Container
ECS Agent
Task
Container
https://github.com/aws/amazon-ecs-agent
Instance Registration
register-container-instance --total-resources
[{
“name” : “cpu”,“type” : “integerValue”,“integerValue” : 2048
},…
]
Modifying Exposed Resources
Order UI User UIShipping
UI
Order
Service
User
Service
Shipping
Service
Data
Access
A Monolithic Architecture
Scaling a Monolithic Architecture
Order UI User UIShipping
UI
Order
Service
User
Service
Shipping
Service
A Microservices Architecture
Order UI User UI UI
Order
ServiceService
Shipping
Service
Order UIOrder UI
User UI UIShipping
UI
Order
ServiceOrder
Service
ServiceService
ServiceService
User
Service
Shipping
Service
Scaling a Microservices Architecture
Docker
Container Advantages
Portable
Flexible
Fast
EfficientServer
Guest OS
Bins/Libs Bins/Libs
App2App1
Containers are Natural for Microservices
Simple to model
Any app, any language
Image is the version
Test & deploy same artifact
Stateless servers decrease change risk
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Managing One Host is Straightforward
Managing a Fleet is Hard
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
AZ 1 AZ 2
AZ 3
What Are Microservices Challenges?
Resource and state management
Data management
Monitoring
Service discovery
Deployment
How do you model your
applications?
{
"environment": [],
"name": "simple-demo",
"image": "my-demo",
"cpu": 10,
"memory": 500,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"mountPoints": [
{
"sourceVolume": "my-vol",
"containerPath": "/var/www/my-vol"
}
],
"entryPoint": [
"/usr/sbin/apache2",
"-D",
"FOREGROUND"
],
"essential": true
},
Tasks
Shared Data Volume
Containers
launchContainer
Instance
Volume Definitions
Container Definitions
Starting a Task
API
User /
Scheduler
StartTask
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Docker
Container Instance
ECS Agent
Task
Container
WebSocket
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Docker
Task
Container Instance
Container
ECS Agent
Task
Container
SubmitStateChange
Tracking Resource Changes
Terminated Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Docker
Task
Container Instance
Container
ECS Agent
SubmitStateChange
Missing Container Instance
API
User /
Scheduler
StartTask
Cluster Management Engine
Docker
Task
Container Instance
Container
ECS Agent
?
Agent Communication
Terminated Container Instance
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Termination
Notifier
Docker
Task
Container Instance
Container
ECS Agent
Guaranteeing Accuracy and Consistency
Amazon ECS Under the Hood
IDN-1 IDN IDN+1 IDN+2 IDN+3 IDN+4 IDN+5
IDN+6
IDN+5
WRITE
READ
Amazon ECS Under the Hood
IDN-1 IDN IDN+1 IDN+2 IDN+3 IDN+4 IDN+5
IDN+6IDN+3
IDN+5IDN+2
WRITE WRITE
READREAD
Scalable
Schedulers
What is a Scheduler?
• Determine desired state
• Check against current state
• Perform action
Amazon ECS Service Scheduler
What is a Service?
• Models a long-running application
• Maintains desired state
• Optionally runs behind an Elastic Load Balancing load
balancer
Discovering DifferencesDeployment Status Desired Pending Running
ecs-svc/1 PRIMARY 5 0 0
Minimum Healthy Maximum Healthy
50% 200%
Discovering DifferencesDeployment Status Desired Pending Running
ecs-svc/2 PRIMARY 10 0 0
ecs-svc/1 ACTIVE 5 0 5
Minimum Healthy Maximum Healthy
50% 200%
Other Considerations
• ELB registration/deregistration
• Permissions and errors
• Task health
• Scale down requests
Multiple Schedulers
Amazon ECS: Scheduling
Amazon ECS: Scheduling
Amazon ECS: Scheduling
Amazon ECS: Scheduling
To recap
{
"environment": [],
"name": "simple-demo",
"image": "my-demo",
"cpu": 10,
"memory": 500,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"mountPoints": [
{
"sourceVolume": "my-vol",
"containerPath": "/var/www/my-vol"
}
],
"entryPoint": [
"/usr/sbin/apache2",
"-D",
"FOREGROUND"
],
"essential": true
},
“Task Definitions”
Docker
Task
Container Instance
Amazon
ECS
Container
ECS Agent
ELB
Internet
ELB
User / Scheduler
API
Cluster Management Engine
Task
Container
Docker
Task
Container Instance
Container
ECS Agent
Task
Container
Docker
Task
Container Instance
Container
ECS Agent
Task
Container
AZ 1 AZ 2
Key/Value Store
Agent Communication Service