ArchitectingOnAWS Module 03 Compute Layer
ArchitectingOnAWS Module 03 Compute Layer
Module 3
Adding the Compute Layer
Region
Availability Zone
Target
Amazon
CloudFront
Application
Load Balancer Auto Scaling
Amazon
Amazon
Route 53
EFS
Public Subnet App Subnet Data Subnet
Availability Zone
Static Amazon EC2 Amazon
Amazon
NAT Gateway Memcached
Assets Instance RDS Primary EFS Mount
Target
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 3
You need to run applications that are going to be used by a consistent, but small number
of users.
Module Overview
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Adding Compute with Amazon EC2
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What Needs Can Amazon EC2 Address?
Web hosting
Databases
Authentication
Amazon
EC2
Anything a server can do
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Virtual Machines vs. Physical Servers
Amazon EC2 can solve some problems that are more difficult
with an on-premises server.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Launching Amazon EC2 Instances with
Amazon Machine Images (AMIs)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 and AMIs
Amazon EC2 Service
Your AMI
EC2 instances
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 and AMIs
Amazon EC2 Service
AMIs include:
One or more EBS volumes
Launch permissions
Your AMI
A block device mapping
EC2 instances
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Where Do You Get an AMI?
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Do AMIs Help?
Repeatability
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Do AMIs Help?
Repeatability
Reusability
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Do AMIs Help?
Repeatability
Reusability
Recoverability
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Do AMIs Help?
Repeatability
Reusability
Recoverability
Marketplace Solutions
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Do AMIs Help?
Repeatability
Reusability
Recoverability
Marketplace Solutions
Backups
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Image Builder
EC2 Image Builder simplifies the creation, maintenance, validation, sharing, and
deployment of Linux or Windows Server images.
Source image EC2 Image Customize software Source image with Test images Distribute golden
Builder installed on the AWS provided or images
image custom templates
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Launching Amazon EC2 Instances with
User Data
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Launching EC2 Instances with User Data
User Data
#!/bin/bash
yum update –y
service httpd start
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Retrieving Information about Your EC2 Instance with Instance
Metadata
User Data
#!/bin/bash
yum update –y
hostname = $(curl -s
http://169.254.169.254/latest/meta-data/public-
Metadata Value
instance-id i-1234567890abcdef0
mac 00-1B-63-84-45-E6
public-hostname ec2-203-0-113-25.compute-1.amazonaws.com
public-ipv4 67.202.51.223
local-hostname ip-10-251-50-12.ec2.internal
local-ipv4 10.251.50.12
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 and Storing Data
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What Problems Does Amazon Elastic Block Store (Amazon EBS)
Solve?
EC2
Application needs Instance store is
block-level storage ephemeral
Keep in mind: Multiple volumes of Amazon EBS can be on the same instance, but each
volume can be attached to only one instance at a time.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EBS Volume Types
Solid-State Backed
Description General purpose SSD volume that balances Highest-performance SSD volume for mission-
price and performance for a wide variety of critical low-latency or high-throughput
workloads workloads
Use Cases • Recommended for most workloads • Critical business applications that require
sustained IOPS performance
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EBS Volume Types
Hard-Disk Backed
Description Low cost HDD volume designed for Lowest cost HDD volume designed for less
frequently accessed, throughput-intensive frequently accessed workloads
workloads
Use Cases • Streaming workloads • Throughput-oriented storage for large
volumes of data that is infrequently
• Big data accessed
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Instances Optimized for Amazon EBS
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Shared File Systems
What if I have multiple instances that need to use the same storage?
EBS S3 EFS/FSx
Availability Zone
NFSv4 protocol
Availability Zone Availability Zone
Subnet Subnet
Shared Across
Mount Target
• Availability Zones Mount Target
Mount Target Mount Target
Mount Target
• Regions
• VPCs
• Account
Amazon EFS
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Instance Types
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Instances – What’s in a Name?
m5.large
Examples
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Instances – Sizes
m5.large 2
m5.xlarge 4
m5.2xlarge 8
m5.4xlarge 16
m5.12xlarge 48
m
m5.24xlarge 96
m
5.
5.
5.
xl
la
2x
ar
rg
la
ge
e
rg
e
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Instances – Types
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Instances – Types
General Purpose A1, T3, T3a, T2, M6g, M5, M5a, M5n, M4
Memory Optimized R5, R5a, R5n, R4, X1e, X1, High Mem., z1d
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 – General Purpose Example
Baseline
Model vCPU CPU Credits / Hour Mem (GiB) Storage
Performance/vCPU
2 6
t3.nano 5% 0.5 EBS-Only
2 12 EBS-Only
t3.micro 10% 1
2 24 EBS-Only
t3.small 20% 2
36
t3.large 2 30% 8 EBS-Only
96
t3.xlarge 4 40% 16 EBS-Only
192
t3.2xlarge 8 40% 32 EBS-Only
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 – Compute Optimized Example
4,500
c5.9xlarge 36 72 EBS-Only
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 – Memory Optimized Example
Networking
Mem Dedicated EBS
Model vCPU Storage (GiB) Performance
(GiB) Bandwidth (Mbps)
(Gbps)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 – Accelerated Computing Example
GPU Mem
Model GPUs vCPU Mem (GiB) GPU P2P
(GiB)
p3.2xlarge 1 8 61 16 -
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 – Storage Optimized Example
Up to 16 TB of HDD-based local
storage with high disk h1.8xlarge 32 128 10 Gigabit 4 x 2,000 HDD
throughput
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intel® Xeon CPUs and EC2 Instances
All current EC2 instance types include:
• Intel AES-NI: Reduces performance hit due to encryption
• Intel AVX (AVX2, AVX-512): Improve floating-point
performance. Only available on HVM deployments.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intel® Xeon CPUs and EC2 Instances
Some EC2 instance types include:
• Intel Turbo Boost: Runs cores faster than base clock speed when
needed
• Intel TSX: Uses multiple threads or single thread depending on need
• P state and C state control: Fine-tune performance and sleep state of
each core
• Intel® Deep Learning Boost: Embedded performance acceleration
for Artificial Intelligence workloads. Up to 30x performance
improvement for inference workloads compared to the previous
generation.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intel Processors for Your Workloads
AVX 512
Deep Learning Boost TSX
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intel® Xeon Scalable Processors
Latest generation of Intel Xeon processors
Up to:
• 28 cores per CPU
• 6 memory channels
• 48 PCIe lanes of bandwidth/throughput
• 100 Gbps network bandwidth (C5n.16xlarge)
Intel AVX-512:
• Twice the floating-point performance of AVX2
• 512-bit instructions (vs 256 for AVX/AVX2)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intel® Xeon Family and EC2 Instances
Intel Xeon Scalable Intel Xeon E5 Intel Xeon E7
Processor Family Processor Family Processor Family
• High Memory • M4 • X1/X1e
• z1d • R4
• C5/C5n • P2/P3
• M5 • G3
• R5 • F1
• T3 • H1
• I3
• D2
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Instance Generations and Cost
Newer generation instances generally have better
price-to-performance ratios
SQL Server Testing with HammerDB:
Average Cost Per 1 Billion Transactions Per Month
$60.00 $56.61
$50.00
$43.08
$40.00
$30.00
$20.00
$10.00
$0.00
m4.xlarge m5.xlarge
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Pricing Options
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Pricing Options
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
On-Demand Instances
• Pay for compute capacity per second (Amazon Linux and Ubuntu) or by the hour (all
other OS)
• No long-term commitments
• No upfront payments
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Reserved Instances
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Savings Plans
• Compute Savings Plans provide the most flexibility and help to reduce your costs
by up to 66%
• EC2 Instance Savings Plans apply to a specific instance family within a Region and
provide the largest discount (up to 72%, just like Standard RIs)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spot Instances
• No more bidding! – prices based on long term trends of supply & demand
Spot can provide up to 90% off on-demand pricing. Spot Instances are
appropriate for stateless, fault-tolerant workloads.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Dedicated Options
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Dedicated Instances
Dedicated instances are physically isolated
from other AWS accounts
Dedicated Instances
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Dedicated Hosts
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Tenancy
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Compute Optimizer
AWS Compute Optimizer recommends optimal AWS compute resources for your workloads to reduce
costs and improve performance by using machine learning to analyze historical utilization metrics.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Keeping Track of Your Instances
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tagging Best Practices
Helps you to understand what your resources are doing and their cost impact.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Considerations
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Architectural Considerations 1
Does your compute layer require the lowest latency and highest packet-per-
second network performance possible?
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Architectural Considerations 2
Do you have applications that have a small number of critical instances that
should be kept separate from each other?
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Architectural Considerations 3
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Checks
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Check 4
What is an AMI? 1. An AMI is an object that stores data about the instance
such as Local Hostname, Instance ID, or Public IP
address.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Check 4: Answer
What is an AMI? 1. An AMI is an object that stores data about the instance
such as Local Hostname, Instance ID, or Public IP
address.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Check 5
If you wanted to select the host on which an instance would run, which
option should you use?
1. Default
2. Dedicated instance
3. Dedicated Host
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Check 5: Answer
If you wanted to select the host on which an instance would run, which
option should you use?
1. Default
2. Dedicated instance
3. Dedicated Host
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Check 6
What is Amazon EBS? 1. Object storage solution that can scale to incredible sizes to
meet demand and storage requirements
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Knowledge Check 6: Answer
What is Amazon EBS? 1. Object storage solution that can scale to incredible sizes to
meet demand and storage requirements
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank You
© 2020 Amazon Web Services, Inc. or its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior
written permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited. Corrections, feedback, or other questions? Contact
us at https://support.aws.amazon.com/#/contacts/aws-training. All trademarks are the property of their owners.