0% found this document useful (0 votes)
94 views

AcademyCloudArchitecting Module 04

Uploaded by

azeemnisar477
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

AcademyCloudArchitecting Module 04

Uploaded by

azeemnisar477
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 77

AW S A c a d e m y C l o u d A r c h i t e c t i n g

Module 4: Adding a Compute


Layer

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Module overview

Sections Demonstrations
1. Architectural need • Configuring an EC2 Instance with User
Data
2. Adding compute with Amazon EC2
• Reviewing the Spot Instance History
3. Choosing an AMI to launch an
Page
Amazon EC2 instance
4. Selecting an Amazon EC2 instance
type
Labs
5. Using user data to configure an
Amazon EC2 instance • Guided Lab: Introducing Amazon EFS
6. Adding storage to an Amazon EC2 • Challenge Lab: Creating a Dynamic
instance Website for the Café
7. Amazon EC2 pricing options
Knowledge check
8. Amazon EC2 considerations
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 2
reserved.
Module objectives

At the end of this module, you should be able to:


• Identify how Amazon Elastic Compute Cloud (Amazon EC2) can be used in an
architecture
• Explain the value of using Amazon Machine Images (AMIs) to accelerate the
creation and repeatability of infrastructure
• Differentiate between the EC2 instance types
• Recognize how to configure Amazon EC2 instances with user data
• Recognize storage solutions for Amazon EC2
• Describe EC2 pricing options
• Determine the placement group given an architectural consideration
• Launch an Amazon EC2 instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 3


reserved.
Module 4: Adding a Compute Layer

Section 1: Architectural need

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Compute as part of a larger
architecture
Region VPC
Public Private subnet Private subnet
subnet

Availability
Zone 2
Amazon
CloudFron
t NAT EC2 ElastiCach Amazon Amazon
gateway instances e for RDS EFS
v Interne Memcache standby mount
t d instance target
gatewa Application Amazon Amazon
y EC2 Auto EFS
Load
Amazon Scaling
Balancer
Public Private subnet Private subnet
Route subnet
Availability

53
Zone 1

NAT EC2 instance ElastiCach Amazon Amazon


Users Static gateway e for RDS EFS
website Memcache primary mount
d instance target
reserved.
on S3
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
5
Café business requirement

The café wants the website to display more than static content and to
provide dynamic capabilities. They want to introduce online ordering
for customers, and enable café staff to view submitted orders.

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 6


reserved.
Module 4: Adding a Compute Layer
Section 2: Adding compute with Amazon
EC2

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
AWS runtime compute choices
Virtual Specialized
Platform as a
Machines Containers Serverless Solutions
Service (PaaS)
(VMs)

Amazon Elastic Amazon Elastic AWS AWS Lambda AWS Outposts


Compute Cloud Elastic
(Amazon EC2) Container Beanstalk
Service
(Amazon ECS)

Amazon AWS Fargate AWS Batch


Lightsail
Higher infrastructure control and customization Fully managed services
Faster application
deployment
Different compute services are available to meet the needs of different use cases.
This module will discuss Amazon EC2.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 8
reserved.
Amazon EC2

Amazon EC2 provides resizable compute


capacity in the cloud.

• Provides virtual machines (servers)

• Provisions servers in minutes


Amazon Elastic
Compute Cloud • Can automatically scale capacity up or down as
(Amazon EC2) needed

• Enables you to pay only for the capacity that


you use
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 9
reserved.
EC2 instances

An EC2 instance is a Amazon EC2 virtualization


virtual machine that
runs on a physical host. EC2 Internet
• You can choose instances
different Hypervisor
configurations of CPU Network
and memory capacity CPUs AWS
services
• Supports different
storage options RAM
Amazon
• Instance store EBS-
optimized
• Amazon Elastic Block
Instance Amazon EBS
Store (Amazon EBS)
store (storage)
• Provides network
connectivity Host servers
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
10
reserved.
Amazon EC2 use cases

Use Amazon EC2 when you need: Web


server
• Complete control of your computing
resources, including operating system and
processor type
Anything a
Application
server can
• Options for optimizing your compute costs server
do

• On-Demand Instances, Reserved Instances,
and Spot Instances Amazon
• Savings Plans EC2

• Ability to run any type of workload, for Media Database


example – server server
• Simple websites
• Enterprise applications
© 2020,•Amazon
High Web performance computing
Services, Inc. or its Affiliates. All rights (HPC) 11
reserved.
Provisioning an EC2 instance
Essential instance launch configuration parameters
Amazon
Machine Image
Security group (AMI)
Key
pair

Instance
type
Instance
Instance store
or
Amazon EBS VPC

Network placement
and addressing
User data
Assumed role
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 12
reserved.
• Amazon EC2 enables you to run
Section 2 key Microsoft Windows and Linux
takeaways virtual machines in the cloud.
• You can use an EC2 instance when
you need complete control of your
computing resources and want to
run any type of workload.
• When you launch an EC2 instance,
you must choose an AMI and an
instance type. Launching an
instance involves specifying
configuration parameters,
including network, security,
storage, and user data settings.
13 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r
eserved.
Module 4: Adding a Compute Layer

Section 3: Choosing an AMI to launch an EC2


instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Amazon Machine Image (AMI)

An AMI provides the information that is Create multiple


instances from the
needed to launch an instance, including: same AMI

Launch
• A template for the root volume instance
• Contains the guest operating system (OS) and AMI Instance
perhaps other installed software 1
Launch additional similarly
configured instances
• Launch permissions
• Control which AWS accounts can access the AMI Instance
2
• Block device mappings
• Specifies any storage volumes to attach to the
instance Instance
3

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 15


reserved.
AMI benefits

• Repeatability
• An AMI can be used repeatedly to
launch instances with efficiency and
precision

• Reusability
• Instances launched from the same
AMI are identically configured

• Recoverability
• You can create an AMI from a
configured instance as a restorable
backup
• You can replace a failed instance by
launching a new instance from the
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
reserved.
same AMI 16
Choosing an AMI

Choose an AMI based


on:
• Region
• Operating system
• Microsoft Windows or
Linux
• Storage type of the root
device AMI sources:
• Architecture • Quick Start – Linux and Microsoft Windows AMIs that are
provided by AWS.
• Virtualization type • My AMIs – Any AMIs that you create.
• AWS Marketplace – Pre-configured templates from third
parties.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
reserved.
• Community AMIs – AMIs shared by others. Use at your17
Instance store-backed versus
Amazon EBS-backed AMI
Amazon EBS-Backed Instance Store-Backed
Characteristic
Instance Instance

Boot time for the instance Boots faster Takes longer to boot

Maximum size of root


16 TiB 10 GiB
device
Can’t stop the instance,
Ability to stop the instance Can stop the instance
only reboot or terminate it
Can’t change the instance
Ability to change the Can change the instance
type because the instance
instance type type by stopping instance
can’t be stopped
You are charged for
instance usage, EBS You are charged for
Instance charges volume usage, and storing instance usage and storing
your AMI as an EBS your AMI in Amazon S3
snapshot
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 18
reserved.
Amazon EC2 instance lifecycle

Amazon EBS-backed instances only

Launch Start
Pending

AMI

Reboot
Stop
Rebooting Running Stopping Stopped
Stop-
Hibernate
Terminat
e
Shutting
down

Terminate
Terminated

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


19
reserved.
Creating a new AMI
AWS Cloud

Region A Connect to the Capture as a new AMI:


instance and • Create a new image
Quick Start manually modify it (EBS-backed)
or other or run a script that • Create a bundle
existing Launch modifies the (instance-backed)
AMI instance
Starter an
AMI instance (for example,
1 upgrade 2installed 3
Unmodifie Modifie New
software)
d d AMI
instance instanc
(Optional) MyAMI e
Import
a virtual Region B
machine (Optional) Copy the AMI to any other Regions
where you want to use it
New 4
AMI

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 20


reserved.
EC2 Image Builder

EC2 Image Builder automates the creation,


management, and deployment of up-to-date and
compliant golden VM images.

• Provides a graphical interface to create image-


EC2 Image building pipelines
Builder
• Creates and maintains Amazon EC2 AMIs and on-
premises VM images

• Produces secure, validated, and up-to-date images

• Enforces version control

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 21


reserved.
How EC2 Image Builder works
An EC2 Image Builder image pipeline
Repeats according to your
defined build schedule

New
golden
image

The specified One or more added One or more added A configured Defined
source image build hardening tests build schedule automated
components (provided by AWS to specify how distribution
to customize or custom) to often the image details—Specify to
software verify security on pipeline will which
installations and the image produce new AWS Regions to
configurations images distribute
the golden image

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 22


reserved.
• An AMI provides the information
Section 3 key that is needed to launch an EC2
takeaways instance
• For best performance, use an AMI
with HVM virtualization type
• Only an instance launched from an
Amazon EBS-backed AMI can be
stopped and started
• An AMI is available in a Region

23 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r


eserved.
Module 4: Adding a Compute Layer

Section 4: Selecting an EC2 instance type

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
EC2 instance type
An EC2 instance type defines a configuration of CPU, memory, storage, and
network performance characteristics that provides a given level of compute
performance.
vCP 4
U Instance Type Naming

Memory 16 GiB Generation Size

m5d.xlarge
1 x 150
Storage NVMe SSD

Network
Up to 10 Family Additional
performanc Gbps
e capabilitie
s

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 25


reserved.
Suitability of instance types for
workloads
(1 of 2)
General purpose instance Compute optimized instance
types types
• Web or application servers • Batch processing
• Enterprise applications • Distributed analytics
• Gaming servers • High performance computing
• Caching fleets (HPC)
• Analytics applications • Ad server engines
• Development or test • Multiplayer gaming
environments • Video encoding
Example instance types: Example instance types:

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 26


reserved.
Suitability of instance types for
workloads
(2 of 2)
Memory optimized instance types Storage optimized instance types
• In-memory caches • High-performance databases1
• High-performance databases • Real-time analytics1
• Big data analytics • Transactional workloads1
• NoSQL databases1
Example instance types:
• Big data2
Accelerated computing instance • Data warehouse2
types • Log processing2
• Machine learning, artificial intelligence
(AI) High I/O example instance type:
1

• HPC
Dense Storage example instance types:
2
•Example instance types:
Graphics G4

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 27


reserved.
Choosing an instance type
• Choose the instance type that meets –
• The performance needs of your application With over 270 available instances types,
• Your cost requirements how do you choose the correct one?
• When you create a new instance –
• In the EC2 console, use the Instance Types page
to filter by characteristics that you choose

• Recommendation: The latest generation in an


instance family typically has a better price-to-
performance ratio

• If you have an already existing instance –


• You can get recommendations for optimizing
the instance type by using the
AWS Compute Optimizer

• You can evaluate recommendations and modify


the instance accordingly
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 28
reserved.
AWS Compute Optimizer

AWS
Compute
Optimizer

• Recommends optimal
instance type, instance
size, and Auto Scaling
group configuration
• Analyzes workload
patterns and makes
recommendations
• Classifies instance findings
as Under-provisioned,
Over-provisioned,
©Optimized, or Inc.
2020, Amazon Web Services, None
or its Affiliates. All rights 29
reserved.
• An EC2 instance type defines a
Section 4 key configuration of CPU, memory,
takeaways storage, and network performance
characteristics
• As a recommendation, choose new
generation instance types in a
family because they generally
have better
price-to-performance ratios
• Use the Instance Types page in the
Amazon EC2 console and AWS
Compute Optimizer to find the
right instance type for your
workload
30 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r
eserved.
Module 4: Adding a Compute Layer

Section 5: Using user data to configure an


EC2 instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
EC2 instance user data

When you launch an EC2 instance, specify user data to run an


initialization script (shell script or cloud-init directive).

User data

#!/bin/bash
yum update –y
service httpd start
Your AMI chkconfig httpd on Running EC2
instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 32


reserved.
Retrieving instance metadata

Instance metadata is information about your instance.


• Is accessible from your instance at URL: http://169.254.169.254/latest/meta-data/
• Can be retrieved from a user data script
User data
#!/bin/bash
yum update –y
hostname = $(curl -s http://169.254.169.254/latest/meta-data/public-
hostname)

Your AMI Metadata Value


Running
EC2
instance-id i-1234567890abcdef0
instance
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-ipv4 10.251.50.12
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 33
reserved.
Configuring an EC2 instance: AMI versus
user data
Flexibility
Bootstrap Dynamic at launch Dynamic at launch Dynamic at launch

Bootstrap

Bootstrap

Operating system
Bootstrap

Fully baked AMI Hybrid AMI Hybrid AMI JeOS AMI

Simplicity
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
34
reserved.
Demonstration:
Configuring an EC2
Instance with User
Data

35 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r


eserved.
• User data enables you to
Section 5 key configure an EC2 instance when
takeaways you launch it.
• Information about a running
instance can be accessed in the
instance through an instance
metadata URL.
• Baking configurations into an AMI
increases AMI build time, but
decreases instance boot time.
Configuring an instance by using
user data decreases AMI build
time, but increases instance boot
time.
36 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r
eserved.
Module 4: Adding a Compute Layer

Section 6: Adding storage to an Amazon


EC2 instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Amazon EC2 storage overview

Root volume Data volumes

This volume always contains the For data accessed by a single


guest OS instance

Instance Amazon EBS Instance Amazon EBS


store (SSD-backed store
only)
For data accessible from multiple
instances

An EC2 instance will always have a root volume,


and can optionally have one or more data Amazon Elastic File Amazon FSx for
volumes. System (Amazon EFS) Windows File Server
[Linux]

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 38


reserved.
Instance store

• An instance store provides non-persistent


storage to an instance –
• The data is stored on the same physical server
where the instance runs
• Characteristics – Instance Instance
1 2
• Temporary block-level storage
• Uses HDD or SSD
• Instance store data is lost when the instance
is stopped or terminated
Ephemeral Ephemeral Ephemeral
Instances
• Example use cases – 0 1 2

• Buffers Instance store


• Cache Physical host computer in AWS
• Scratch data

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 39
Amazon EBS

• Amazon EBS volumes provide network- AWS Cloud

attached persistent storage to an EC2 Region


instance. Availability Zone

• Characteristics – Instance Instance


1 2
• Is persistent block-level storage
• Can attach to any instance in the same Availability
Zone
Physical host
• Uses HDD or SSD
• Can be encrypted
• Supports snapshots that are persisted to S3
• Data persists independently from the life of the
instance EBS EBS
volume volume
• Example use cases –
• Stand-alone database
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 40
• General application data storage
reserved.
Amazon EBS SSD-backed volume
types
Amazon EBS SSD-backed volumes are suited for use cases
where the
performance focus is on IOPS.
General Purpose SSD (gp2) Provisioned IOPS SSD (io1)

Descriptio Balances price and performance for a • Highest-performance SSD volume


n wide variety of workloads • Good for mission-critical, low-
latency,
or high-throughput workloads

Use Cases • Recommended for most workloads • Critical business applications that
• Can be a boot volume require sustained IOPS
performance
• Large database workloads
• Transactional workloads
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights • It can be a boot volume 41
reserved.
Amazon EBS HDD-backed volume
types
Amazon EBS HDD-backed volumes work well when the focus is on
throughput.
Throughput Optimized HDD (st1) Cold HDD (sc1)

Descriptio • Low-cost volume type • Lowest-cost HDD volume


n • Designed for frequently accessed, • Designed for less frequently
throughput-intensive workloads accessed workloads

Use Cases • Streaming workloads • Throughput-oriented storage for


• Big data large volumes of infrequently
• Data warehouses accessed data
• Log processing • Use cases where the lowest
• It cannot be a boot volume storage cost is important
• It cannot be a boot volume

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 42


reserved.
Amazon EBS-optimized instances
AWS Cloud
• Certain EC2 instance types can be EBS-
Region
optimized
Availability Zone

• Benefits – Standard EBS-


instance optimized
• Provides a dedicated network connection to instance
attached EBS volumes
• Increases I/O performance
• Additional performance is achieved if using an Physical host
Amazon EC2 Nitro System-based instance type computer
Dedicated
• Usage – network
• For EBS-optimized instance types, optimization is connectio
n
enabled by default
• For other instances types that support it, EBS volume 1 EBS volume
optimization must be manually enabled 2

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


43
reserved.
Shared file systems for EC2
instances
What if you have multiple instances that must use the same
storage?

Amazon EFS and


Amazon FSx for
Windows File Server:
Amazon S3: Is an Both satisfy the
option, but is not requirement
ideal
Amazon EBS:
Attaches only to one
instance Amazon EFS Amazon FSx for
(Linux) Windows File
Amazon S3 Server (Windows)

Amazon EBS

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 44


reserved.
Amazon EFS

Amazon EFS provides file system storage for

Linux-based workloads.
• Fully managed elastic file system
• Scales automatically up or down as files are added
Amazon
Elastic File and removed
System (Amazon
EFS)
• Petabytes of capacity
• Supports Network File System (NFS) protocols
• Mount the file system to the EC2 instance
• Compatible with all Linux-based AMIs for Amazon
EC2

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


45
reserved.
Amazon EFS use cases
Common workloads and
applications:
EFS • Home directories
file • File system for enterprise applications
system
Mounted to • Application testing and development
each guest
OS • Database backups
• Web serving and content management
• Media workflows
Linux Linux Linux
Instance Instance Instance
• Big data analytics
1 2 3

Example command to mount the file system to each guest OS:


$ sudo mount -t nfs4 mount-target-DNS:/ ~/efs-mount-point

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


46
reserved.
Amazon FSx for Windows File
Server
Provides fully managed shared file
system storage for Microsoft Windows
EC2 instances.
• Native Microsoft Windows compatibility
• New Technology File System (NTFS)
Amazon FSx for • Native Server Message Block (SMB) protocol version 2.0 to
Windows File 3.1.1
Server
• Distributed File System (DFS) Namespaces and DFS
Replication
• Integrates with Microsoft Active Directory and supports
Windows access control lists (ACLs)
• Backed by high-performance SSD storage
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 47
reserved.
Amazon FSx for Windows File Server use
cases
Amazon FSx for Windows File Server
supports a broad set of Microsoft Windows
workloads.
• Home directories
• Lift-and-shift application
workloads
• Media and entertainment
workflows
• Data analytics
• Web serving and content
management
• Software development
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
48
environments
reserved.
• Storage options for EC2 instances
Section 6 key include instance store, Amazon EBS,
takeaways Amazon EFS, and Amazon FSx for
Windows File Server
• For a root volume, use instance store
or SSD-backed Amazon EBS
• For a data volume that serves only
one instance, use instance store or
Amazon EBS storage
• For a data volume that serves
multiple Linux instances, use Amazon
EFS
• For a data volume that serves
multiple Microsoft Windows instances,
use Amazon FSx for Windows File
49
Server © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r
eserved.
Module 4 – Guided
Lab:
Introducing Amazon
Elastic File System
(Amazon EFS)

50 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r


eserved.
Guided lab: Tasks

1. Creating a security group to access your EFS file system


2. Creating an Amazon EFS file system
3. Connecting to your EC2 instance via SSH
4. Creating a new directory and mounting the EFS file system
5. Examining the performance behavior of your new EFS file system

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 51


reserved.
~ 20 minutes

Begin Module 4 –
Guided Lab:
Introducing Amazon
Elastic File System
(Amazon EFS)

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 52


reserved.
Guided lab
debrief:
Key
takeaways

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 53


reserved.
Module 4: Adding a Compute Layer

Section 7: Amazon EC2 pricing options

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Amazon EC2 pricing options (1 of
2)
On-Demand Reserved Instances Savings Plans
Instances Make a 1-year or 3-year Same discounts as Reserved
commitment and receive a Instances with more flexibility
Pay for compute capacity
significant discount off on- in exchange for a $/hour
by the second or by the hour
demand prices. commitment.
with no long-term
commitments.

Committed and All Amazon EC2,


steady-state workloads AWS Fargate, and
Spiky workloads, AWS Lambda workloads
workload
experimentation
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 55
reserved.
Amazon EC2 pricing options (2 of
2)
Spot Instances Dedicated Hosts
Spare Amazon EC2 capacity at substantial Physical server with Amazon EC2 instance
savings off On-Demand Instance prices. capacity
fully dedicated for your use.

Fault-tolerant, flexible, stateless


workloads Workloads that require the use of your
own software licenses or single
tenancy to meet compliance
requirements
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 56
reserved.
Demonstration:
Reviewing the
Spot Instance
History Page

57 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r


eserved.
Amazon EC2 dedicated options
Amazon EC2 dedicated options provide EC2 instance capacity on
physical servers that are dedicated for your use (single-tenant
hardware).
Dedicated Instances Dedicated Hosts
• Per-instance billing • Per-host billing
• Automatic instance placement • Visibility of sockets, cores, and host
• Benefit – Isolates the hosts ID
that run your instances • Affinity between a host and an
instance
• Targeted instance placement
• Add capacity by using an allocation
request
• Benefit – Enables you to use your
server-bound software licenses and
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
address compliance requirements 58
reserved.
Amazon EC2 cost optimization
guideline
To optimize the cost of Amazon EC2 instances, combine the available purchase
options.
Scale using Spot Instances for
fault-tolerant, flexible, stateless
workloads

Number Use On-Demand Instances for


of new or stateful spiky workloads
instance
s Use Reserved Instances or Savings
Plans for known, steady-state
workloads
time

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 59


reserved.
• Amazon EC2 pricing models
Section 7 key include On-Demand Instances,
takeaways Reserved Instances, Savings
Plans, Spot Instances, and
Dedicated Hosts

• Per-second billing is available only


for On-Demand Instances,
Reserved Instances, and Spot
Instances that run Amazon Linux
or Ubuntu

• Use a combination of Reserved


Instances, Savings Plans, On-
Demand Instances, and Spot
60 Instances to optimize Amazon EC2
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights r
eserved.
Module 4: Adding a Compute Layer

Section 8: Amazon EC2 considerations

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Placement groups

Placement groups enable you to control where instances run in an


Availability Zone.
• They influence where a group of interdependent
instances run –
• Increase network performance between them
• Reduce correlated or simultaneous failure
• Placement strategies –
• Cluster
• Partition
• Spread
• Limitations –
• An instance can be launched in only one placement group
at a time
• Instances with a tenancy of host cannot be launched in a
placement group
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 62
reserved.
Cluster placement group

Cluster placement groups provide low-latency and high packet-per-


second network performance between instances in the same
Availability Zone.
• Instances are placed in the same high-bisection bandwidth
Availability Zone 1 segment of the network
Cluster
placement • Provides per-flow throughput limit of up to 10 Gbps for
group TCP/IP traffic

Instanc • Recommended for applications that benefit from low


es network latency, high network throughput, or both

• Best practice – Launch all instances in a single request

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 63


reserved.
Partition placement group

A partition placement group spreads instances across logical


partitions to reduce the likelihood of correlated hardware failure.

• Each partition has its own set of racks (network


Availability Zone 1 and power source)

Partition Partition Partition


• Each rack has its own network and power source
1 2 3

Instanc Instanc Instanc


• Partitions can be in multiple Availability Zones
es es es

• They are recommended for large distributed and


replicated workloads

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 64


reserved.
Spread placement group

Spread placement groups place instances across distinct


physical racks to reduce correlated hardware failure.

• Each rack has its own network and power


Availability Availability
source
Zone 1 Zone 2
Rack 1 Rack 2 Rack 3 • Group can span multiple Availability Zones

• They are recommended for applications that


Instance Instance Instance have a small number of critical instances that
1 2 3
should be kept separate from each other

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 65


reserved.
Module 4 –
Challenge Lab:
Creating a
Dynamic Website
for the Café

66 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights r


eserved.
The business need: Online
ordering
• Customer liked the static website that
the café introduced, but they now
want to place orders online
• It will also be important to maintain
an order history
• Amazon S3 worked well to host a
static website, but that simple
architecture will not meet this new
business need
• The café staff also wants separate
development and production
environments

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


67
reserved.
Challenge Lab: Tasks

1. Analyzing the existing EC2 instance


2. Connecting to the IDE on the EC2 instance
3. Analyzing the LAMP stack environment and confirming that
the web server is accessible
4. Installing the café application
5. Testing the web application
6. Creating an AMI and launching another EC2 instance
7. Verifying the new café instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 68


reserved.
Challenge lab: Final product
AWS Cloud
Region 1 (Development environment) Region 2 (Production environment)
VPC VPC

Public subnet Public subnet

Security group Security group

EC2 instance EC2 instance

Apache HTTP Apache HTTP


server server
Café web Café web
applicatio applicatio
n n
Web PHP
client PHP
cafe_db cafe_db
databas databas
e e

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


69
reserved.
~ 60 minutes

Begin Module 4 –
Challenge Lab:
Creating a Dynamic
Website for the Café

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 70


reserved.
Challenge lab
debrief:
Key
takeaways

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 71


reserved.
Module 4: Adding a Compute Layer

Module wrap-up

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Module summary

In summary, in this module, you learned how to:


• Identify how Amazon Elastic Compute Cloud (Amazon EC2) can be used in an
architecture
• Explain the value of using Amazon Machine Images (AMIs) to accelerate the
creation and repeatability of infrastructure
• Differentiate between the EC2 instance types
• Recognize how to configure Amazon EC2 instances with user data
• Recognize storage solutions for Amazon EC2
• Describe EC2 pricing options
• Determine the placement group given an architectural consideration
• Launch an Amazon EC2 instance

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 73


reserved.
Complete the knowledge check

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 74


reserved.
Sample exam question

A Solutions Architect wants to design a solution to save costs for EC2 instances that do
not need
to run during a 2-week company shutdown. The applications running on the instances
store data
in instance memory (RAM) that must be present when the instances resume operation.

Which approach should the Solutions Architect recommend to shut down and resume
the instances?

A. Modify the application to store the data on instance store volumes. Reattach the
volumes while restarting them.
B. Snapshot the instances before stopping them. Restore the snapshot after restarting
the instances.
C. Run the applications on instances enabled for hibernation. Hibernate the instances
before the shutdown.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights
75
reserved.
D. Note the Availability Zone for each instance before stopping it. Restart the
Additional resources

• Amazon EC2 User Guide for Linux Instances


• Amazon EC2 User Guide for Windows Instances
• Amazon EC2 FAQs
• EC2 Image Builder User Guide
• EC2 Image Builder FAQs
• AWS Compute Optimizer User Guide
• AWS Compute Optimizer FAQs
• How AWS Pricing Works

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights 76


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 or feedback on the course,
please email us at: [email protected]. For all other questions, contact us at: https://aws.amazon.com/contact-us/aws-training/. All
trademarks are the property of their owners.

You might also like