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

Compute in the Cloud

The document provides an overview of cloud computing services, focusing on Amazon EC2 and its various features, including cost optimization and instance types. It discusses the importance of selecting the right compute service based on application design and usage patterns. Additionally, it covers the process of launching EC2 instances and the significance of Amazon Machine Images (AMIs) in creating and managing virtual servers.

Uploaded by

attilaisci04
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)
2 views

Compute in the Cloud

The document provides an overview of cloud computing services, focusing on Amazon EC2 and its various features, including cost optimization and instance types. It discusses the importance of selecting the right compute service based on application design and usage patterns. Additionally, it covers the process of launching EC2 instances and the significance of Amazon Machine Images (AMIs) in creating and managing virtual servers.

Uploaded by

attilaisci04
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/ 53

Compute in the Cloud

Module overview

Topics
• Compute services overview
• Amazon EC2
• Amazon EC2 cost optimization
• Container services
• Introduction to AWS Lambda
• Introduction to AWS Elastic Beanstalk

2
Module objectives

• In this session we will look at


• Compute Power in the Cloud
• Specifically in this session we will concentrate on EC2
• Generations
• Types

3
Compute services overview
Compute Power in the Cloud
• At some stage you will require compute power
• You are writing or using applications and need a location to run this code
on
• Due to the familiarity with the technology a lot of people when starting will
use a cloud based server
• IAAS (Infrastructure As A Service)
• PAAS (Platform As A Service)
• This is fine and is a good starting point
• It allows you to use your code in the cloud in a similar way that you would
of done if you were using an on premise solution
• All of the same features are there which you would see if you owned the
server
• As you develop your skill set though you will find that this solution is not
as popular as you might first think and later in the course we will see
more examples where SAAS is more popular and WHY 5
Compute Options
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
6
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 executes A relatively new concept for
• Function-based on 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 execute jobs more AWS Fargate reduces
• Amazon EKS • Instance-based quickly administrative overhead, but you
• AWS Fargate can use options that give you
• Amazon ECR 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.
7
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?
• Is there a specific feature which you need
• Selecting the wrong compute solution for an architecture can lead to
lower performance efficiency
• Lower performance == lower satisfaction in your software
• A good starting place—Understand the available compute options
• In the Cloud, if a mistake is made this can be solved very quickly
8
EC2 - Virtual Cloud Server
Multiple providers
• We will not keep on discussing this - BUT
• Remember there is nothing different in the main between the different
providers
• All that changes is the name
• Azure Virtual Machines
• https://learn.microsoft.com/en-us/azure/virtual-machines/sizes
• AWS Elastic Compute Cloud
• https://aws.amazon.com/ec2/instance-types/
• GCloud
• https://cloud.google.com/compute/docs/machine-types
• As we will see later in the lecture your choice of the instance type is
important
• As a developer/company the correct decision needs to be made to reduce the loading
• Reduced overhead will give you reduced cost
• Better still increased profits :)

10
Equipment
• Just consider a server which is physical
• You need to specify the hardware so that it has a lifetime
• As an example the laptop which I use at the university
• This was purchased at a specification where it will still be useful
for 5 years
• At the start it is overspecified
• Right now it is good at what it does
• In the near future it will start to slow down as the resources which
are needed is greater than its capability
• You have not a lot of choice on this as the lead time to get equipment
is slow
• It is also a large upfront investment to buy this equipment

11
Equipment
● This is just to visualise - in reality the line will change a lot
Useful depending on the workload
Use for the expected tasks

Useless
Purchased Time Recycle 12
Amazon EC2 - Video

Amazon
EC2
What is Amazon EC2?
• What is Elastic Compute Cloud (EC2)
• The term might simply be causing an issue as it is something you have not
seen
• The truth is in Cloud computing they usually use different names to what
you are used to
• The idea is that you do not get stuck with the concepts which you have for
physical devices
• Here you realise that the hardware is flexible and can change
What is Amazon EC2?
• What is Elastic Compute Cloud (EC2)
• This is simply a populated motherboard
• CPU
• Type - ARM, Intel Xeon, AMD EPYC, Apple M series
• Features
• Cores
• Memory
• Network Bandwidth
• Storage Bandwidth
• Storage Type
• If needed additional cards i.e. Nvidia GPU
• https://aws.amazon.com/ec2/instance-types/
• https://aws.amazon.com/ec2/instance-explorer/
What is Amazon EC2?
• Comparison to Physical setups
• You do not need to replicate your physical infrastructure in the
cloud
• The best idea is to try a processor and setup and see how it
operates
• Just because your physical server has 16 cores does not mean that your
Virtual server (EC2) also needs this
• It is easy with Cloudwatch to gather statistics and then work out if your
EC2 instance is over specified
• If it is then this is costing you money!
What is Amazon EC2?
• Remember also you are paying as you use this
• In the physical world you will buy a server to experiment on and then just
leave it going
• In the Cloud environment it is a consideration to turn it off when you are not
using it i.e. overnight
• When it is not running you are NOT paying
• The fact that it is configured for your use, still does not mean you are
paying
• You only pay when you are using it i.e. powered on
• Consider this when using the provided Sandbox as well
• When you are not using this turn it all off
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 instances
✔ File server
✔ Computing server
On-premises servers
✔ Proxy server

Photo by panumas nikhomkhai from Pexels


18
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, MAC or Linux) on each instance.
• You can launch instances of any size into an
Availability Zone anywhere in the world.
Amazon • Launch instances from Amazon Machine Images
EC2 (AMIs).
• Launch instances with a few clicks or a line of code,
and they are ready in minutes.
• You can control traffic to and from instances.
19
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.

20
1. Select an AMI

Choices made using the Launch


instance
Launch Instance Wizard:
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, MAC 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

21
Amazon Machine Image (AMI)
• Here is a list of provided AMI’s
• https://aws.amazon.com/marketplace
• Of Course though you can just use your own and you will do this in one of the
practical sessions
• You create your OS and the patches and the software you need
• You will register this as an AMI which is private to you
• You can then launch EC2 instances based on this
• Although not a great way to do this
• Simply create an OS
• Patch this
• Install the software you need
• Put a copy of your application on this
• Make an AMI
• This is now your “Golden Image”
• Simply use this for all of your servers
Disclosure
• As full disclosure
• If you are writing software really the Golden Image is now rarely used
• It is a easy one to understand and think it is a good idea
• In the world of fast changing computing and cyber security risks
• the golden image can go out of date very quickly
• In the cloud think of everything as being temporary and short usage
• This does not mean your application is short term usage - it is the compute
which is
• The risks are more important than the benefits of this quick technique
• Nice to try though in a lab :)
Where to work
• As we will see later Cloud computing DOES cost money
• If you are working on some software you can simply work locally and then transfer this to
the a EC2 server
• An example which we have at the university is to work on a Virtual Image on a VMWare
server
• The idea of working on a VMWare server is that IF you make a mistake and you install
conflicting libraries or any other software
• You simply roll back to a previous version
• On all most everything I do now it is all done in virtual machines (Free from the
university for VMWare)
• In the past I have had way too many problems playing with open source software
which ruined an installation
• Anyway once your virtual image is operational as you want - simply move this to the
Cloud and run again on EC2
• This can even be automatic for you where really you do not know where you are
working - the monitoring system is making the best decisions based on your
considerations
Amazon Machine Image (AMI)

• Here is a demonstration of importing a VMWare image into EC2


Amazon Machine Image (AMI)

• VMware vRealize Orchestrator


• https://docs.vmware.com/en/vRealize-Orchestrator/index.html
Amazon Machine Image (AMI)

• Serverless Application Model (SAM) - Working Locally


Creating a new AMI: Example
AWS Cloud
AMI details
Connect to the instance
Region A and manually modify it
Quick Start or run a script that
or other modifies the instance
Launch an (for example, upgrade Capture as
existing AMI a new AMI
Starter instance installed software)
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
where you want to use it
New 4
AMI

28
Moving between the clouds

• Beyond what we will teach


• But if you want to move your image to a different cloud provider
• This is quite straightforward to do
• https://cloud.google.com/compute/docs/import/import-aws-image
• Create your image in AWS based on something
• Decide to use Gcloud - simply move it across and use
• https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport
_image.html#vmexport-limits

AWS GCloud
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

30
EC2 instance type naming and sizes
Instance type Example instance sizes
details
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

31
Select instance type: Based on use
case
Instance type
details

General Compute Memory Accelerated Storage


Purpose Optimized Optimized Computing Optimized

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


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

High In-memory Machine Distributed file


Use Case Broad
performance databases learning systems

https://aws.amazon.com/ec2/instance-types/
EC2 instance type
• It is important to so select the right processor for the task
• These are virtual CPU (vCPU) but are mapped to a physical CPU
• When you look at each type as a computing person you can decide if has the right
functionality for what YOU need
• The right decision can reduce your costs
• This does involve your computing knowledge which you did some in the first year with Jim
• As an example if you look at the M5 instance type
• https://aws.amazon.com/ec2/instance-types/m5/
• This has the Xeon 8000 series processor with “Intel Advanced Vector Extensions 512
(AVX-512) instruction set”
• In this case it has the capability of improving the performance for Neural Networks
• If you are doing image processing look for chips with Intel AVX-512
• This is the same for ARM and AMD Processors
• https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
• Do not just look for the Cores
EC2 instance type
• ARM Processors are now getting a lot of good discussions
• In the right jobs they can be a lot quicker at a lower cost
• https://www.infoq.com/articles/arm-vs-x86-cloud-perform
ance/
• In AWS the ARM processor is Graviton2
• Smaller is better in this graph - but do go and look at
the article
• You need to experiment to work out if it is better for
your software
• Here is a IEEE paper on this topic
• https://ieeexplore.ieee.org/document/9582322
• In summary for video work they found:
• H264 use ARM
• H265 use Intel
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.

35
3. Specify network settings

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


Launch Instance Wizard: • Identify the VPC and optionally the subnet

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

36
4. Attach IAM role (optional)

Choices made by using the • Will software on the EC2 instance need to interact with other
Launch Instance Wizard: AWS services?
• If yes, attach an appropriate IAM Role.
1. AMI
• An AWS Identity and Access Management (IAM) role that is
2. Instance Type
attached to an EC2 instance is kept in an instance profile.
3. Network settings
4. IAM role • You are not restricted to attaching a role only at instance
5. User data launch.
6. Storage options • You can also attach a role to an instance that already
7. Tags exists.
8. Security group Example: Application on
9. Key pair attached to instance can
access
Role that grants Amazon
S3 bucket
Simple Storage Service Instance
with objects
(Amazon S3) bucket
access permissions
37
5. User data script (optional)

Choices made by using the User data


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

38
6. Specify storage

Choices made by using the • Configure the root volume


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

39
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).

40
Example storage options
Host computer
• Instance 1 characteristics – Amazon Elastic
Block Store
• It has an Amazon EBS root
(Amazon EBS) Instance Store
volume type for the operating
system. Attached as Attached as
• What will happen if the instance is Root volume Storage
stopped and then started again?
20-GB volume Instance 1 volume Ephemeral
volume 1
Attached as
• Instance 2 characteristics – Storage volume
• It has an Instance Store root Attached as
500-GB volume Root
volume type for the operating
system. volume Ephemeral
Instance 2
volume 2
• What will happen if the instance
stops (because of user error or a
system malfunction)?

41
Security group settings

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

Example rule:

42
9. Identify or create the key pair

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


Launch Instance Wizard: key pair or create a new key pair.
1. AMI • A key pair consists of – mykey.pem
2. Instance Type • A public key that AWS stores.
3. Network settings • A private key file that you store.
4. IAM role
5. User data • It enables secure connections to the
6. Storage options instance.
7. Tags
• For Windows AMIs –
8. Security group
9. Key pair
• Use the private key to obtain the administrator
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.
43
Amazon EC2 console view of a running
EC2 instance

44
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:


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

46
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.

47
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

48
Amazon CloudWatch for monitoring

• Example Video of Cloudwatch with the use of


Cloudwatch

49
• 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
50 and review metrics on EC2 instances.
Recorded
Amazon EC2
demonstration

51
Thank you for your time

• I know this is a lot of information


• Do not worry at all about this though
• A lot of the names are confusing - once you use them though you realise that they are
quite obvious
• They are things you are doing every day
• The new laptop you are going to buy
• You will check
• What CPU
• Some of you might even look at benchmarks to see how well it works and change
based on that
• How much RAM
• What type of Storage and how much
• Does it support the latest network standards - no point paying for a 1 Gbps ISP
connection from Virgin if your computer will only support 80211.N at 2.4 Ghz
• What OS do you get with the device and any free software
• All of this is the same in the Cloud - with the opportunity to change

52
Thank you for your time

• Any questions just come and talk to myself or Dr Bauer

53

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