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

module 6

The AWS Academy Cloud Foundations Module 6 focuses on compute services, specifically Amazon EC2, AWS Lambda, and AWS Elastic Beanstalk. It covers the overview, cost optimization, and practical activities to demonstrate the use of these services. The module aims to equip learners with the ability to choose the appropriate compute service based on application design and usage patterns.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

module 6

The AWS Academy Cloud Foundations Module 6 focuses on compute services, specifically Amazon EC2, AWS Lambda, and AWS Elastic Beanstalk. It covers the overview, cost optimization, and practical activities to demonstrate the use of these services. The module aims to equip learners with the ability to choose the appropriate compute service based on application design and usage patterns.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 90

AWS Academy Cloud Foundations

Module 6: Compute

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module overview

Topics Activities
• Compute services overview • Amazon EC2 versus Managed Service
• Amazon EC2 • Hands-on with AWS Lambda
• Amazon EC2 cost optimization • Hands-on with AWS Elastic Beanstalk
• Container services
• Introduction to AWS Lambda Demo
• Introduction to AWS Elastic Beanstalk • Recorded demonstration of Amazon EC2

Lab
• Introduction to Amazon EC2

Knowledge
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights check 2
reserved.
Module objectives

After completing this module, you should be able to:


• Provide an overview of different AWS compute services in the cloud
• Demonstrate why to use Amazon Elastic Compute Cloud (Amazon EC2)
• Identify the functionality in the EC2 console
• Perform basic functions in Amazon EC2 to build a virtual computing environment
• Identify Amazon EC2 cost optimization elements
• Demonstrate when to use AWS Elastic Beanstalk
• Demonstrate when to use AWS Lambda
• Identify how to run containerized applications in a cluster of managed servers

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


3
reserved.
Module 6: Compute

Section 1: Compute services overview

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


reserved.
AWS compute services
Amazon Web Services (AWS) offers many compute services. This module will discuss the
highlighted services.

Amazon EC2 Amazon EC2 Amazon Elastic Amazon Elastic VMware Cloud
Auto Scaling Container Registry Container Service on AWS
(Amazon ECR) (Amazon ECS)

AWS Elastic AWS Lambda Amazon Elastic Amazon Lightsail AWS Batch
Beanstalk Kubernetes Service
(Amazon EKS)

AWS Fargate AWS Outposts AWS Serverless


Application Repository
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
5
reserved.
Categorizing compute services
Services Key Concepts Characteristics Ease of Use
• Amazon EC2 • Infrastructure as a service (IaaS) • Provision virtual machines that you A familiar concept to many IT
• Instance-based can manage as you choose professionals.
• Virtual machines
• AWS Lambda • Serverless computing • Write and deploy code that runs on A relatively new concept for
• Function-based a schedule or that can be triggered many IT staff members, but easy
• Low-cost by events to use after you learn how.
• Use when possible (architect for the
cloud)
• Amazon ECS • Container-based computing • Spin up and run jobs more quickly AWS Fargate reduces
• Amazon EKS • Instance-based administrative overhead, but
• AWS Fargate you can use options that give
• Amazon ECR you more control.
• AWS Elastic • Platform as a service (PaaS) • Focus on your code (building your Fast and easy to get started.
Beanstalk • For web applications application)
• Can easily tie into other services—
databases, Domain Name System
(DNS), etc.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
6
reserved.
Choosing the optimal compute service

• The optimal compute service or services that you use will depend on
your use case
• Some aspects to consider –
• What is your application design?
• What are your usage patterns?
• Which configuration settings will you want to manage?
• Selecting the wrong compute solution for an architecture can lead to
lower performance efficiency
• A good starting place—Understand the available compute options

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


7
reserved.
Module 6: Compute

Section 2: Amazon EC2

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


reserved.
Amazon Elastic Compute Cloud (Amazon
EC2)
Example uses of
Amazon EC2
instances
✔ Application server
✔ Web server
✔ Database server
✔ Game server
✔ Mail server
✔ Media server
✔ Catalog server Amazon EC2
Photo by Taylor ✔ File server
instances
Vick on Unsplash
✔ Computing server
On-premises
servers ✔ Proxy server

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights Photo by panumas nikhomkhai from Pexels
9
reserved.
Amazon EC2 overview

• Amazon Elastic Compute Cloud (Amazon


EC2)
• Provides virtual machines—referred to as EC2
instances—in the cloud.
• Gives you full control over the guest operating
system (Windows or Linux) on each instance.
• You can launch instances of any size into an
Amazon Availability Zone anywhere in the world.
EC2 • Launch instances from Amazon Machine Images
(AMIs).
• Launch instances with a few clicks or a line of code,
and they are ready in minutes.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
reserved.
• You can control traffic to and from instances. 10
Launching an Amazon EC2 instance

This section of the module


walks through nine key
decisions to make when you
create an EC2 instance by
using the AWS Management
Console Launch Instance
Wizard.

⮚Along the way, essential


Amazon EC2 concepts will
be explored.

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


11
reserved.
1. Select an AMI

Choices made using the Launch


instanc
Launch Instance Wizard: e
AMI Instance

1. AMI
• Amazon Machine Image (AMI)
2. Instance Type
• Is a template that is used to create an EC2 instance (which is a virtual
3. Network settings machine, or VM, that runs in the AWS Cloud)
4. IAM role
• Contains a Windows or Linux operating system
5. User data
• Often also has some software pre-installed
6. Storage options
7. Tags • AMI choices:
8. Security group • Quick Start – Linux and Windows AMIs that are provided by AWS
9. Key pair • My AMIs – Any AMIs that you created
• AWS Marketplace – Pre-configured templates from third parties
• Community AMIs – AMIs shared by others; use at your own risk

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


12
reserved.
Creating a new AMI: Example
AWS Cloud
AMI
details Region A
Connect to the instance
and manually modify it
Quick Start or run a script that
or other modifies the instance
Launch (for example, upgrade Capture
existing AMI
Starter an installed software) as
AMI instance a new AMI
1 2 3
Unmodified Modified New
Instance Instance AMI

(Optional) Import MyAMI


a virtual machine
Region B Copy the AMI to any other
Regions
New where you4want to use it
AMI

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


13
reserved.
2. Select an instance type

Choices made using the • Consider your use case


Launch Instance Wizard: • How will the EC2 instance you create be used?
• The instance type that you choose determines –
1. AMI
• Memory (RAM)
2. Instance Type
• Processing power (CPU)
3. Network settings • Disk space and disk type (Storage)
4. IAM role • Network performance
5. User data
6. Storage options
• Instance type categories –
• General purpose
7. Tags
• Compute optimized
8. Security group
• Memory optimized
9. Key pair
• Storage optimized
• Accelerated computing
• Instance types offer family, generation, and size

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


14
reserved.
EC2 instance type naming and sizes

Instance type Example instance


details
sizes
Instance
vCPU Memory (GB) Storage
Name
Instance type naming t3.nano 2 0.5 EBS-Only

• Example: t3.large t3.micro 2 1 EBS-Only


• T is the family name
• 3 is the generation number t3.small 2 2 EBS-Only
• Large is the size
t3.medium 2 4 EBS-Only

t3.large 2 8 EBS-Only

t3.xlarge 4 16 EBS-Only

t3.2xlarge 8 32 EBS-Only

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


15
reserved.
Select instance type: Based on use
case
Instance type
details

General Compute Memory Accelerated Storage


Purpose Optimized Optimized Computing Optimized

Instance a1, m4, m5, r4, r5, f1, g3, g4,


c4, c5 d2, h1, i3
Types t2, t3 x1, z1 p2, p3

High In-memory Machine Distributed file


Use Case Broad
performance databases learning systems

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


16
reserved.
Instance types: Networking features

• The network bandwidth (Gbps) varies by instance type.


• See Amazon EC2 Instance Types to compare.
• To maximize networking and bandwidth performance of your instance type:
• If you have interdependent instances, launch them into a cluster placement group.
• Enable enhanced networking.
• Enhanced networking types are supported on most instance types.
• See the Networking and Storage Features documentation for details.
• Enhanced networking types –
• Elastic Network Adapter (ENA): Supports network speeds of up to 100 Gbps.
• Intel 82599 Virtual Function interface: Supports network speeds of up to 10 Gbps.

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


17
reserved.
3. Specify network settings

Choices made by using • Where should the instance be deployed?


the • Identify the VPC and optionally the subnet
Launch Instance Wizard:
• Should a public IP address be automatically assigned?
1. AMI • To make it internet-accessible
2. Instance Type
AWS Cloud
3. Network settings
Region
4. IAM role
Availability Zone 1 Availability Zone 2
5. User data
6. Storage options VPC
Public subnet
7. Tags Example:
8. Security group specify to
9. Key pair deploy the Instance
instance here
Private subnet

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


18
reserved.
4. Attach IAM role (optional)

Choices made by using • Will software on the EC2 instance need to interact with other
the AWS services?
Launch Instance Wizard: • If yes, attach an appropriate IAM Role.

1. AMI
• An AWS Identity and Access Management (IAM) role that is
attached to an EC2 instance is kept in an instance profile.
2. Instance Type
3. Network settings • You are not restricted to attaching a role only at instance
4. IAM role launch.
5. User data • You can also attach a role to an instance that already
6. Storage options exists.
7. Tags
Example Application on
8. Security group : attached to instance can
9. Key pair access
Role that grants Amazon
S3 bucket
Simple Storage Service Instance
with objects
(Amazon S3) bucket
access permissions
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
19
reserved.
5. User data script (optional)

Choices made by using User data


the
#!/bin/bash
Launch Instance Wizard:
yum update –y
1. AMI yum install -y wget
2. Instance Type AMI Running
3. Network settings EC2 instance
4. IAM role
5. User data • Optionally specify a user data script at instance launch
6. Storage options
• Use user data scripts to customize the runtime environment of
7. Tags your instance
8. Security group
• Script runs the first time the instance starts
9. Key pair
• Can be used strategically
• For example, reduce the number of custom AMIs that you build
and maintain
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
20
reserved.
6. Specify storage

Choices made by using • Configure the root volume


the • Where the guest operating system is installed
Launch Instance Wizard:
• Attach additional storage volumes (optional)
1. AMI • AMI might already include more than one volume
2. Instance Type
3. Network settings • For each volume, specify:
4. IAM role • The size of the disk (in GB)
5. User data • The volume type
6. Storage options • Different types of solid state drives (SSDs) and hard
7. Tags disk drives (HDDs) are available
8. Security group • If the volume will be deleted when the instance is
9. Key pair terminated
• If encryption should be used

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


21
reserved.
Amazon EC2 storage options

• Amazon Elastic Block Store (Amazon EBS) –


• Durable, block-level storage volumes.
• You can stop the instance and start it again, and the data will still
be there.
• Amazon EC2 Instance Store –
• Ephemeral storage is provided on disks that are attached to the
host computer where the EC2 instance is running.
• If the instance stops, data stored here is deleted.
• Other options for storage (not for the root volume) –
• Mount an Amazon Elastic File System (Amazon EFS) file system.
• Connect to Amazon Simple Storage Service (Amazon S3).

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


22
reserved.
Example storage options
Host computer
• Instance 1 characteristics Amazon Elastic
– Block Store
(Amazon EBS) Instance
• It has an Amazon EBS root Store
volume type for the operating Attached as Attached as
system. Root Storage
• What will happen if the instance 20-GB volume volume volume Ephemeral
Instance 1
is stopped and then started volume 1
again? Attached as
Storage
volume Attached as
500-GB volume
• Instance 2 characteristics Root
volume Ephemeral
– Instance 2
volume 2
• It has an Instance Store root
volume type for the operating
system.
• What will happen if the instance
stops (because of user error or
a Web
© 2019 Amazon system malfunction)?
Services, Inc. or its Affiliates. All rights
23
reserved.
7. Add tags

Choices made by using • A tag is a label that you can assign to an AWS
the resource.
Launch Instance Wizard:
• Consists of a key and an optional value.
1. AMI • Tagging is how you can attach metadata to an
2. Instance Type
EC2 instance.
3. Network settings
4. IAM role • Potential benefits of tagging—Filtering,
5. User data automation, cost allocation, and access
6. Storage options control.
7. Tags
8. Security group
9. Key pair Example:

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


24
reserved.
8. Security group settings

Choices made by using • A security group is a set of firewall rules that


the control traffic to the instance.
Launch Instance Wizard:
• It exists outside of the instance's guest OS.
1. AMI • Create rules that specify the source and which
2. Instance Type ports that network communications can use.
3. Network settings
• Specify the port number and the protocol, such as
4. IAM role
Transmission Control Protocol (TCP), User Datagram
5. User data Protocol (UDP), or Internet Control Message Protocol
6. Storage options (ICMP).
7. Tags
• Specify the source (for example, an IP address or
8. Security group another security group) that is allowed to use the rule.
9. Key pair

Example rule:

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


25
reserved.
9. Identify or create the key pair

Choices made by using • At instance launch, you specify an existing


the key pair or create a new key pair.
Launch Instance Wizard:
• A key pair consists of – mykey.pe
m
1. AMI • A public key that AWS stores.
2. Instance Type • A private key file that you store.
3. Network settings
4. IAM role • It enables secure connections to the
5. User data instance.
6. Storage options
• For Windows AMIs –
7. Tags
8. Security group • Use the private key to obtain the administrator
9. Key pair
password that you need to log in to your instance.
• For Linux AMIs –
• Use the private key to use SSH to securely
connect to your instance.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
26
reserved.
Amazon EC2 console view of a running
EC2 instance

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


27
reserved.
Another option: Launch an EC2 instance
with the AWS Command Line Interface
• EC2 instances can also be created
programmatically.
AWS Command Line
Interface (AWS CLI)

• This example shows how simple the Example


command can be. command:
aws ec2 run-instances \
• This command assumes that the key pair and --image-id ami-1a2b3c4d \
security group already exist.
--count 1 \
--instance-type c3.large \
• More options could be specified. See the
AWS CLI Command Reference for details.
--key-name MyKeyPair \
--security-groups MySecurityGroup \
--region us-east-1

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


28
reserved.
Amazon EC2 instance lifecycle

Only instances backed by Amazon EBS

Launch Start
pending

AMI

Reboot Stop
rebooting running stopping stopped
Stop-
Hibernate
Terminate

shutting-
down

Terminate
terminated

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


29
reserved.
Instance hibernation option

• Benefits
• It saves the contents from the instance memory (RAM).
• On instance restart, RAM contents are reloaded, previously running processes are resumed.
• You can save on cost in a hibernated state versus a running state (costs are similar to a
stopped instance).
• Prerequisites
• Only certain Linux AMIs (such as Amazon Linux 2) and only certain instance families support
it.
• Instance must have an encrypted Amazon EBS root volume and a maximum of150 GB RAM.
reserved.• Hibernation must be enabled at instance launch.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
30
Consider using an Elastic IP address

• Rebooting an instance will not • If you require a persistent public IP


change any IP addresses or DNS address –
hostnames. • Associate an Elastic IP address with
the instance.

• When an instance is stopped and


• Elastic IP address characteristics –
then started again –
• Can be associated with instances in the
• The public IPv4 address and external Region as needed.
DNS hostname will change.
• Remains allocated to your account until
• The private IPv4 address and internal you choose to release it.
DNS hostname do not change.

Elastic IP
Address
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
31
reserved.
EC2 instance metadata

• Instance metadata is data about your instance.


• While you are connected to the instance, you can view it –
• In a browser: http://169.254.169.254/latest/meta-data/
• In a terminal window: curl http://169.254.169.254/latest/meta-data/
• Example retrievable values –
• Public IP address, private IP address, public hostname, instance ID, security groups, Region,
Availability Zone.
• Any user data specified at instance launch can also be accessed at:
http://169.254.169.254/latest/user-data/
• It can be used to configure or manage a running instance.
• For example, author a configuration script that reads the metadata and uses it to configure
applications or OS settings.

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


32
reserved.
Amazon CloudWatch for monitoring

• Use Amazon CloudWatch to monitor EC2


instances Amazon CloudWatch Instance with CloudWatch
• Provides near-real-time metrics
• Provides charts in the Amazon EC2 console
Monitoring tab that you can view
• Maintains 15 months of historical data

• Basic monitoring
• Default, no additional cost
• Metric data sent to CloudWatch every 5 minutes

• Detailed monitoring
• Fixed monthly rate for seven pre-selected metrics
• Metric data delivered every 1 minute

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


33
reserved.
• Amazon EC2 enables you to run Windows and
Section 2 key Linux virtual machines in the cloud.

takeaways • You launch EC2 instances from an AMI


template into a VPC in your account.
• You can choose from many instance types.
Each instance type offers different
combinations of CPU, RAM, storage, and
networking capabilities.
• You can configure security groups to control
access to instances (specify allowed ports and
source).
• User data enables you to specify a script to run
the first time that an instance launches.
• Only instances that are backed by Amazon
EBS can be stopped.
• You can use Amazon CloudWatch to capture
34 and review metrics© on EC2Webinstances.
2019 Amazon Services, Inc. or its Affiliates. All rights reserved.
Recorded
Amazon EC2
demonstration

35 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 3:
Introduction to
Amazon EC2

36 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 3 scenario
In this lab, you will launch and configure your first virtual machine that
runs on Amazon EC2.
AWS Cloud
Region
Availability Zone 1
Lab VPC
Public subnet

Web server
instance

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


37
reserved.
Lab 3: Tasks

• Task 1 – Launch Your Amazon EC2 Instance

• Task 2 – Monitor Your Instance

• Task 3 – Update Your Security Group and Access the Web


Server

• Task 4 – Resize Your Instance: Instance Type and EBS


Volume

• Task 5 – Explore EC2 Limits

• Task 6 – Test Termination Protection


© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
38
reserved.
Lab 3: Final product
Amazon EC2
By the end of the lab, you will have:
1. Launched an instance that is configured as
a web server VPC
AMI
2. Viewed the instance system log
Security
3. Reconfigured a security group group
4. Modified the instance type and root volume t2.micro t2.small
size instance instance

Amazon Elastic
Block Store
(Amazon EBS)

8-GB root 10-GB root


volume volume

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


39
reserved.
Begin Lab 1: Introduction to AWS IAM

~ 35 minutes

Begin Lab 3: Introduction


to Amazon EC2

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


40
reserved.
Lab debrief:
Key takeaways

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


41
reserved.
Activity: Amazon EC2

Photo by Pixabay from Pexels.

42 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Activity: Gather information
Amazon EC2 Amazon RDS

AWS Cloud
Availability Zone 1 Availability Zone 2
MS SQL Server MS SQL Server
primary DB instance secondary
Always-on DB instance
mirroring

Volume Volume Volume Volume


replica replica

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


43
reserved.
Activity: Check your understanding

1. Between Amazon EC2 or Amazon RDS, which provides a managed service? What does
managed service mean?
• ANSWER: Amazon RDS provides a managed service. Amazon RDS handles provisioning, installation
and patching, automated backups, restoring snapshots from points in time, high availability, and
monitoring.
2. Name at least one advantage of deploying Microsoft SQL Server on Amazon EC2 instead of
Amazon RDS.
• ANSWER: Amazon EC2 offers complete control over every configuration, the OS, and the software
stack.
3. What advantage does the Quick Start provide over a manual installation on Amazon EC2?
• ANSWER: The Quick Start is a reference architecture with proven best practices built into the design.
4. Which deployment option offers the best approach for all use cases?
• ANSWER: Neither. The correct deployment option depends on your specific needs.
5. Which approach costs more: using Amazon EC2 or using Amazon RDS?
• ANSWER: It depends. Managing the database deployment on Amazon EC2 requires more customer
oversight
© 2019 Amazon and
Web Services, Inc. time.AllIfrights
or its Affiliates. time is your priority, then Amazon RDS might be less expensive. If you have in- 44
reserved.
house expertise, Amazon EC2 might be more cost-effective.
Module 6: Compute

Section 3: Amazon EC2 cost optimization

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


reserved.
Amazon EC2 pricing models

On-Demand Instances Reserved Instances Spot Instances


• Pay by the hour • Full, partial, or no upfront payment • Instances run as long as they are
for instance you reserve. available and your bid is above the
• No long-term commitments. Spot Instance price.
• Discount on hourly charge for that
• Eligible for the AWS Free Tier. instance. • They can be interrupted by AWS
with a 2-minute notification.
• 1-year or 3-year term.
Dedicated Hosts • Interruption options include
terminated, stopped or hibernated.
• A physical server with EC2 instance
capacity fully dedicated to your use. Scheduled Reserved • Prices can be significantly less
Instances expensive compared to On-
Demand Instances
Dedicated Instances • Purchase a capacity reservation
that is always available on a • Good choice when you have
recurring schedule you specify. flexibility in when your applications
• Instances that run in a VPC on can run.
hardware that is dedicated to a
• 1-year term.
single customer.
Per second billing available for On-Demand Instances, Reserved Instances,
and
reserved.
Spot Instances that run Amazon Linux or Ubuntu.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
46
Amazon EC2 pricing models: Benefits

On-Demand Instances Spot Instances Reserved Instances Dedicated Hosts


• Low cost and flexibility • Large scale, dynamic • Predictability ensures • Save money on licensing
workload compute capacity is costs
available when needed • Help meet compliance
and regulatory
requirements

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


47
reserved.
Amazon EC2 pricing models: Use
cases

Spiky Time-Insensitive Steady-State Workloads Highly Sensitive


Workloads Workloads Workloads

On-Demand Instances Spot Instances Reserved Instances Dedicated Hosts


• Short-term, spiky, or • Applications with flexible • Steady state or predictable • Bring your own license
unpredictable workloads start and end times usage workloads (BYOL)
• Application development or • Applications only feasible • Applications that require • Compliance and regulatory
testing at very low compute prices reserved capacity, restrictions
• Users with urgent including disaster recovery
computing needs for large • Users able to make upfront • Usage and licensing
amounts of additional payments to reduce total tracking
capacity computing costs even • Control instance
further placement

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


48
reserved.
The four pillars of cost optimization
Cost Optimization

Increase Optimal Optimize


Right size
elasticity pricing storage
model choices

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


49
reserved.
Pillar 1: Right size

Pillars ✔Provision instances to match the need


: 1. Right size • CPU, memory, storage, and network throughput
2. Increase elasticity • Select appropriate instance types for your use
3. Optimal pricing model
4. Optimize storage choices ✔Use Amazon CloudWatch metrics
• How idle are instances? When?
• Downsize instances

✔Best practice: Right size, then reserve

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


50
reserved.
Pillar 2: Increase elasticity

✔Stop or hibernate Amazon EBS-backed


Pillars instances that are not actively in use
: 1. Right-Size • Example: non-production development or test
2. Increase Elasticity instances
3. Optimal pricing model
4. Optimize storage choices
✔Use automatic scaling to match needs based
on usage
• Automated and time-based elasticity

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


51
reserved.
Pillar 3: Optimal pricing model

✔Leverage the right pricing model for your use


Pillars
: 1. Right-Size case
2. Increase Elasticity
• Consider your usage patterns
3. Optimal pricing model
4. Optimize storage choices ✔Optimize and combine purchase types

✔Examples:
• Use On-Demand Instance and Spot Instances for
variable workloads

• Use Reserved Instances for predictable workloads

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


✔Consider serverless solutions (AWS Lambda)
52
reserved.
Pillar 4: Optimize storage choices

✔Reduce costs while maintaining storage performance and


Pillars availability
: 1. Right-Size ✔Resize EBS volumes
2. Increase Elasticity
3. Optimal pricing model ✔Change EBS volume types
4. Optimize storage choices ✔ Can you meet performance requirements with less expensive
storage?
✔ Example: Amazon EBS Throughput Optimized HDD (st1) storage
typically costs half as much as the default General Purpose SSD
(gp2) storage option.

✔Delete EBS snapshots that are no longer needed

✔Identify the most appropriate destination for specific types


of data
✔ Does the application need the instance to reside on Amazon EBS?
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights ✔ Amazon S3 storage options with lifecycle policies can reduce costs
53
reserved.
Measure, monitor, and improve

• Cost optimization is an ongoing process.

• Recommendations –
• Define and enforce cost allocation tagging.

• Define metrics, set targets, and review regularly.

• Encourage teams to architect for cost.

• Assign the responsibility of optimization to an individual or to


a team.

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


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

• Spot Instances can be interrupted with a 2-


minute notification. However, they can offer
significant cost savings over On-Demand
Instances.

• The four pillars of cost optimization are:


• Right size
• Increase elasticity
• Optimal pricing model
• Optimize storage choices

55 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 6: Compute

Section 4: Container services

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


reserved.
Container basics

• Containers are a method of


Your
operating system virtualization. Container
Your application
• Benefits –
• Repeatable.
Dependencie
• Self-contained environments. s
• Software runs the same in different
environments. Configurations
• Developer's laptop, test, production.
• Faster to launch and stop or terminate Hooks into OS
than virtual machines

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


57
reserved.
What is Docker?

• Docker is a software platform


that enables you to build, test, Container
and deploy applications quickly.
• You run containers on Docker. Containers have everything the
• Containers are created from a software needs to run:
template called an image.
• A container has everything a System
Libraries Code Runtime
software application needs to tools

run.

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


58
reserved.
Containers versus virtual machines
Three virtual machines on three EC2
Exampl instances
e Three containers on one EC2 VM 1 VM 2 VM 3
Container
instance App 1 App 2 App 3
Container Container Container
instance 1 Bins/Libs Bins/Libs Bins/Libs
instance 2 instance 3

Docke App 1 App 2 App 3 EC2 EC2 EC2


r
instance instance instance
engine Bins/Libs Bins/Libs Bins/Libs guest guest guest
OS OS OS
EC2 instance guest OS

Hypervisor
Part of
Host operating system AWS Global
Infrastructure
Physical server
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
59
reserved.
Amazon Elastic Container Service
(Amazon ECS)
• Amazon Elastic Container Service (Amazon ECS) –
• A highly scalable, fast, container management service

• Key benefits – Amazon Elastic


Container Service
• Orchestrates the running of Docker containers
• Maintains and scales the fleet of nodes that run your containers
• Removes the complexity of standing up the infrastructure

• Integrated with features that are familiar to Amazon EC2 service users –
• Elastic Load Balancing
• Amazon EC2 security groups
• Amazon EBS volumes
• IAM roles
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
60
reserved.
Amazon ECS orchestrates containers

EC2 instance
Requests to run containers
x3 x2

Container A
EC2 instance

Container B
Amazon Elastic Container
Service (Amazon ECS)

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


reserved.
ECS cluster 61
Amazon ECS cluster options
• Key question: Do you want to manage the Amazon ECS cluster that runs the
containers?

• If yes, create an Amazon ECS cluster backed by Amazon EC2 (provides more granular
control over infrastructure)
• If no, create an Amazon ECS cluster backed by AWS Fargate (easier to maintain, focus on
your applications) Containers
Amazon ECS Container Container Container Amazon ECS
cluster backed instance 1 instance 2 instance 3 cluster backed by
by Amazon EC2 Fargate
App 1 App 2 App 3
You manage
Bins/Libs Bins/Libs Bins/Libs
You manage
Docker engines (one per OS in the cluster)
AWS
VM guest operating systems in the Amazon ECS cluster manages
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
62
reserved.
What is Kubernetes?

• Kubernetes is open source software for container orchestration.


• Deploy and manage containerized applications at scale.
• The same toolset can be used on premises and in the cloud.
• Complements Docker.
• Docker enables you to run multiple containers on a single OS host.
• Kubernetes orchestrates multiple Docker hosts (nodes).
• Automates –
• Container provisioning.
• Networking.
• Load distribution.
• Scaling.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
63
reserved.
Amazon Elastic Kubernetes Service
(Amazon EKS)
• Amazon Elastic Kubernetes Service (Amazon EKS)
• Enables you to run Kubernetes on AWS
• Certified Kubernetes conformant (supports easy migration)
• Supports Linux and Windows containers Amazon Elastic
Kubernetes Service
• Compatible with Kubernetes community tools and supports
popular Kubernetes add-ons

• Use Amazon EKS to –


• Manage clusters of Amazon EC2 compute instances
• Run containers that are orchestrated by Kubernetes on
those instances

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


64
reserved.
Amazon Elastic Container Registry
(Amazon ECR)
Amazon ECR is a fully managed Docker container
registry that makes it easy for developers to store,
manage, and deploy Docker container images. Amazon ECS integration

Docker support

Team collaboration

Amazon Elastic
Container Registry Access control

Third-party integrations
Image Registry

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


65
reserved.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
reserved.
• Containers can hold everything that an
Section 4 key application needs to run.

takeaways • Docker is a software platform that packages


software into containers.
• A single application can span multiple containers.
• Amazon Elastic Container Service (Amazon
ECS) orchestrates the running of Docker
containers.
• Kubernetes is open source software for
container orchestration.
• Amazon Elastic Kubernetes Service (Amazon
EKS) enables you to run Kubernetes on AWS
• Amazon Elastic Container Registry (Amazon
ECR) enables you to store, manage, and deploy
your Docker containers.

66 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 6: Compute

Section 5: Introduction to AWS Lambda

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


67
reserved.
AWS Lambda: Run code without
servers
AWS Lambda is a serverless compute
service.
The code you
run
Upload your is a Lambda
code function

AWS HTTP
servi endpoint Your code Pay only for the
ces Mobile s
apps
runs only when compute time
Run your code on a schedule
it is that
or in response to events
triggered you use

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


68
reserved.
Benefits of Lambda

It supports multiple programming languages


Completely automated administration
Built-in fault tolerance
AWS It supports the orchestration of multiple functions
Lambda
Pay-per-use pricing

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


69
reserved.
AWS Lambda event sources
Event sources Configure other AWS services as event sources to
invoke your function as shown here.

Amazon Alternatively, invoke a Lambda function from the


S3 Lambda console, AWS SDK, or AWS CLI.
Amazon
DynamoDB
Amazon Simple Notification
Service (Amazon SNS)
Lambda Running of your code
Amazon Simple Queue function (only when triggered)
Service (Amazon SQS)
AWS Lambda
Amazon API
Gateway Logging,
monitoring, and
Application Load metrics
Balancer Amazon
Many more… CloudWatch

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


70
reserved.
AWS Lambda function configuration
Lambda function configuration

Function code

Running of your code (only


AWS when it is triggered)
Lambda
Dependencies AWS Lambda
function
(code libraries, etc.)
Logging,
monitoring, and
metrics
Amazon
Execution role CloudWatch

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


71
reserved.
Schedule-based Lambda function example:
Start and stop EC2 instances
Stop instances
example

Stop
IAM role

Time-based
1 CloudWatch 2 Lambda function 3 EC2 instances
event triggered stopped

Start instances
example
Start
IAM role

Time-based
4 5 Lambda function 6 EC2 instances
CloudWatch
triggered started
event
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
72
reserved.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
reserved.
Event-based Lambda function example:
Create thumbnail images
AWS Cloud
1
2 3

Use
r
Sour Lambda 4
ce
buck Execution
et 5
role
Acce
ss
polic
Targ
y
et Lamb
buck da
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
et functio
73
reserved.
n
AWS Lambda quotas

Soft limits per Region:


• Concurrent executions = 1,000
• Function and layer storage = 75 GB

Hard limits for individual functions:


• Maximum function memory allocation = 10,240 MB
• Function timeout = 15 minutes
• Deployment package size = 250 MB unzipped, including layers
• Container image code package size = 10 GB

Additional limits also exist. Details are in the AWS Lambda quotas documentation.

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


74
reserved.
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
reserved.
• Serverless computing enables you to build
Section 5 key and run applications and services without
takeaways provisioning or managing servers.

• AWS Lambda is a serverless compute


service that provides built-in fault tolerance
and automatic scaling.

• An event source is an AWS service or


developer-created application that triggers a
Lambda function to run.

• The maximum memory allocation for a single


Lambda function is 10,240 MB.

• The maximum run time for a Lambda function


is 15 minutes.
75 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Activity: Create an To complete this activity:
AWS Lambda
Stopinator Function • Go to the hands-on lab environment
and launch the AWS Lambda activity.

• Follow the instructions that are


provided in the hands-on lab
environment.

Photo by Pixabay from Pexels.

76 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Activity debrief:
key takeaways

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


77
reserved.
Module 6: Compute

Section 6: Introduction to AWS Elastic Beanstalk

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


reserved.
AWS Elastic Beanstalk

• An easy way to get web applications up and running

• A managed service that automatically handles –


• Infrastructure provisioning and configuration
• Deployment
• Load balancing
• Automatic scaling
AWS Elastic • Health monitoring
Beanstalk • Analysis and debugging
• Logging

• No additional charge for Elastic Beanstalk


• Pay only for the underlying resources that are used
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
79
reserved.
AWS Elastic Beanstalk deployments

• It supports web applications


written for common platforms
• Java, .NET, PHP, Node.js,
You Your
Python, Ruby, Go, and Docker manag code
e HTTP
server
• You upload your code Application
server
AWS Language
• Elastic Beanstalk automatically manage interpreter
handles the deployment s Operating
system
• Deploys on servers such as Hos
t
Apache, NGINX, Passenger,
Puma, and Microsoft Internet
Information Services (IIS)
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
80
reserved.
Benefits of Elastic Beanstalk

Fast and simple to Developer Difficult to Complete resource


start using productivity outgrow control

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


81
reserved.
To complete this activity:
Activity: AWS
Elastic Beanstalk • Go to the hands-on lab environment
and launch the AWS Elastic Beanstalk
activity.

• Follow the instructions that are


provided in the hands-on lab
environment.

82 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Activity debrief:
Key takeaways

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


83
reserved.
• AWS Elastic Beanstalk enhances
Section 6 key developer productivity.
takeaways • Simplifies the process of deploying your
application.
• Reduces management complexity.

• Elastic Beanstalk supports Java, .NET,


PHP, Node.js, Python, Ruby, Go, and
Docker

• There is no charge for Elastic


Beanstalk. Pay only for the AWS
resources that you use.

84 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 6: Compute

Module wrap-up

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


reserved.
Module summary

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


• Provide an overview of different AWS compute services in the cloud
• Demonstrate why to use Amazon Elastic Compute Cloud (Amazon EC2)
• Identify the functionality in the Amazon EC2 console
• Perform basic functions in Amazon EC2 to build a virtual computing environment
• Identify Amazon EC2 cost optimization elements
• Demonstrate when to use AWS Elastic Beanstalk
• Demonstrate when to use AWS Lambda
• Identify how to run containerized applications in a cluster of managed servers

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


86
reserved.
Complete the knowledge check

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


87
reserved.
Sample exam question

Which AWS service helps developers quickly deploy resources which


can make use of different programming languages, such as .NET and
Java?

A. AWS CloudFormation

B. AWS SQS

C. AWS Elastic Beanstalk

D. Amazon Elastic Compute Cloud (Amazon EC2)

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved. 88
Additional resources

• Amazon EC2 Documentation


• Amazon EC2 Pricing
• Amazon ECS Workshop
• Running Containers on AWS
• Amazon EKS Workshop
• AWS Lambda Documentation
• AWS Elastic Beanstalk Documentation
• Cost Optimization Playbook

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


89
reserved.
Thank you

© 2019 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: aws-course-
feedback@amazon.com. 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy