0% found this document useful (0 votes)
8 views17 pages

AWS EC2 Compute Options Explained

The document provides an overview of Amazon EC2 and its various compute options, including EC2, Lightsail, ECS, Elastic Beanstalk, Lambda, and Fargate. It details the features, use cases, and provisioning of EC2 instances, including the importance of Amazon Machine Images (AMIs) and instance types. Additionally, it discusses storage options, pricing models, and considerations for optimizing EC2 usage.

Uploaded by

ng qihan
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)
8 views17 pages

AWS EC2 Compute Options Explained

The document provides an overview of Amazon EC2 and its various compute options, including EC2, Lightsail, ECS, Elastic Beanstalk, Lambda, and Fargate. It details the features, use cases, and provisioning of EC2 instances, including the importance of Amazon Machine Images (AMIs) and instance types. Additionally, it discusses storage options, pricing models, and considerations for optimizing EC2 usage.

Uploaded by

ng qihan
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

Section 2: Adding compute with Amazon EC2

• AWS runtime compute choices

- EC2: Provides secure and resizable virtual servers in the cloud.


- Lightsail: provides virtual private servers to run simple workloads in a cost-effective
way
- ECS: Enables you to run Docker container applications on AWS
- Elastic Beanstalk: A solution that runs web applications and services that are
developed in languages such as Java
- Lambda: A serverless compute solution that runs Java, Go, PowerShell, [Link], C#,
Python, or Ruby code
- Fargate: A serverless compute platform for containers
- Outposts: Provides a way to run AWS infrastructure and services on-premises
- Batch: Service that runs batch jobs at any scale
When you select an AWS compute runtime for your workload,
- VM and container-based services: provide more control over your infrastructure
and enable higher degrees of customization
- PaaS and serverless services: enable you to focus more on your application and less
on infrastructure; enable quick deployment.
- Specialized solutions: category address specific types of workloads, or hybrid cloud
and batch; Work well for these use cases because they are also fully managed by
AWS

• Elastic Compute Cloud (EC2)


- Enables computing in cloud
- Provide VM (servers)
- Provisions(provide) servers in minutes
- Can auto scale capacity up or down as needed
- Pay for the capacity you use
• EC2 instances
- VM runs on a physical host
- Able to choose diff configuration of CPU & memory capacity
- Support diff storage option:
 Instance store: physically attached to host PC and provides temporary block-
level storage
 Elastic Block Store (EBS): provides persistent block storage volume; persists
on instance even when EC2 is stopped
- Provide network connectivity

• EC2 use cases


Use EC2 when you need:
- Complete control of computing resources, including OS and processor type
 Enable users to set up and configure everything about the instances, OS and
applications
- Options for optimizing compute costs
 Offers several ways to pay: On-demand Instances, Saving plans, Reserved
instances, and Spot instances
 Dedicated hosts: provide EC2 instances capacity on physical servers that are
dedicated for user use.
- Ability to run any type of workload
• Provisioning EC2 instances

- Amazon Machine Image (AMI): An AMI defines the base software configuration for
an instance and is used by Amazon EC2 to launch the instance.
- Instance type: An instance type defines a combination of CPU, memory, storage, and
networking capacity that provides a certain level of compute capability to run an
application.
- Network placement and addressing: When you launch an instance, you can specify
the appropriate network placement and addressing to provide the network access
and security that you want.
- Assumed role: Optionally, you can attach an AWS Identity and Access Management
(IAM) role, which grants permissions for accessing AWS services to applications that
run on the instance or users that are connected to the instance.
- User data: You can further initialize or customize instance configuration by
specifying a user data script. This script automatically runs when the instance is
launched.
- Storage: You must specify the type of storage that will be used to store the root or
boot volume of the instance.
- Security group: You must also configure a new security group or use an existing one.
The security group defines which ports network traffic is allowed on.
- Key pair: A key pair is typically also specified at launch. The key pair is used for
Secure Shell (SSH) connections or for establishing Remote Desktop Protocol (RDP)
access to the instance
Section 3: choosing an AMI to launch an EC2 instance

• Amazon Machine Image (AMI)


Provides info that is needed to launch instances:
- Template for root volume
 Root volume contain OS, and everything installed in OS
- Launch permissions
 Control which AWS account can use the AMI to launch instances; Enable you
to make AMI available to public
- Block device mappings
 specify additional storage volumes to attach to the instance when it is
launched

• Benefits
- Repeatability
 AMI can be used repeatedly to launch instances with efficiency and precision
- Reusability
 Instances launched from same AMI are identically configured
- Recoverability
 Create an AMI from a configured instances as a restorable backup
 Replace a failed instance by launching a new instance from same AMI

• Choosing an AMI
Choose an AMI based on:
- Region
 Must select an AMI that is in the Region where you want the instance to run.
 Can copy an AMI from one Region to another as needed
- OS: Microsoft Windows or Linux
- Storage type of the root device
 Amazon EBS-backed: data on an EBS volume persists independently of the
life of the instance
 instance store-backed: data on an instance store volume persists only during
the lifetime of the instance
- Architecture: Determine the type of processor architecture that best fits the
workload
- Virtualization type: Paravirtual (PV) or Hardware VM
 Main diff: how they boot and whether they can take advantage of special
hardware extension for better performance
 For best performance: use AMI with HVM

- AMI sources

• Instance store-backed VS Amazon EBS-backed AMI

• EC2 instance lifestyle


• Creating new AMI

Step 1: Launch the AMI (Quick Start or your own AMI)


Step 2: Create a VM that you configured with specific OS and application settings
Step 3: Capture as a new AMI
- EBS-backed: Create new image, AWS will auto register for you
- Instance-backed: Create a bundle for instance root volume, upload to S3 and
manually register the new AMI
Step 4: Copy AMI to any other region (Optional)

• EC2 image builder


Service that simplifies the creation, maintenance, validation, sharing, and deployment of
Linux or Microsoft Windows images
- Provides a graphical interface to create image-building pipelines
- Creates & maintains EC2 AMIs and on-premises VM images
- Produces secure, validated, and up-to-date images
- Enforces version control
• How it works

Step 1: Identify a source image to build your new image from


Step 2: Select build components software for installation or customization. You can choose
from build components that are provided by Amazon, components that you have built, or
components that have been shared with you.
Step 3: Select hardening tests that should be run each time the image pipeline runs, so that
the image passes security checks. It also enables you to catch incompatibilities that were
introduced by OS updates before deployment to AWS Regions. You can run both tests that
were provided by AWS and your own tests.
Step 4: Specify a build schedule to identify how often this pipeline should run, and when.
Step 5: Define whether you want the image to be distributed to selected Regions.

Section 4: Selecting an EC2 instance type

• EC2 instance type


• Suitability of instance types for workloads

• Choosing an instance type


- Choose instance type that meets:
 Performance needs of the application
 Cost requirement
- When create a new instance:
 In EC2 Console, use Instance Types page to filter by characteristics that you
choose
 Latest gen in an instance family typically has a better price-to-performance
ratio
- If is an already existing instance:
 Get recommendations for optimizing the instance type by using AWS
Compute Optimizer
 Evaluate recommendations and modify the instance accordingly

• AWS Compute Optimizer


Service that analyses the configuration and utilization metrics of EC2 instances and Auto
Scaling groups.
- Recommends optimal instance type, instance size, and Auto Scaling configuration
- Analyses workload patterns and makes recommendation
- Classifies instance findings as under/over-provisioned, optimized, or none
Section 5: Using user data to initialize an EC2 instance
• EC2 instance user data
- When EC2 is launched, specify user data to run an initialized script
- User data is implemented as a script, which contains shell commands or cloud-init
directives
- Cloud-init package
 Open-source application that was built by Canonical
 Used to bootstrap Linux instances (EC2)
 Configures specific aspects of new Amazon Linux instance
 Configures the .ssh/authorized_keys file for ec2-user so that user can log in
with private key
 specify your own cloud-init user directives by adding them as user data
directives

• Retrieving instance metadata


It is info about the instance
- Is accessible from instance at URL: [Link] URL/latest/meta-data
- Can be retrieved from user data script
• Configuring EC2 instance: AMI vs User Data

- Full AMI: The applications and all dependencies are pre-installed, which shortens
boot times but increases build times. Full AMIs typically have a shorter lifespan.
Consider your rollback strategy.
- Hybrid (partially configured) AMIs: Only prerequisite software and utilities are pre-
installed, which leads to a longer shelf life for the AMI. This approach provides a
balance between boot speed and build time. Rollbacks become easier.
- OS-only AMI: This approach is fully configurable and upgradeable over time and
shortens build times. However, it makes your EC2 instances slow to boot because all
required installations and configurations must be run at boot time

Section 6: Adding storage to an Amazon EC2 instance

• EC2 storage overview


• Instance store
- Provides non-persistent storage to an instance
 Data is stored on the same physical server where instances run
- Characteristics
 Temporary block-level storage
 Uses HDD or SSD
 Instance store data is lost when instance is stopped or terminated
- Example use cases: Buffers, Cache, Scratch data

• EBS
- Provides network-attached persistent storage to an EC2 instance
- Characteristics
 Persistent block-level storage
 Can attach to any instance in same AZ
 Can by encrypted
 Supports snapshots that are persisted to S3
 Data persists independently from life of instance
- Example use cases: Stand-alone database, General application data storage
• EBS SSD-backed volume types
- IOPS (Input/Output Operations Per Second)

• EBS HDD-backed volume types

• EBS-optimized instances
- Certain EC2 instance types can be EBS-optimized
- Benefits
 Provides a dedicated network connection to attached EBS volumes
 Increase I/O performance
 Additional performance is achieved if using EC2 Nitro System-based instance
type
- Usage
 For EBS-optimized types, optimization is enabled by default
 For other instance types, optimization must be manually enabled
• Shared file systems for EC2 instances

• Elastic File System (EFS)


Provides file system storage for Linux-based workloads
- Fully managed elastic file system
- Scales auto up or down as files are added or removed
- Petabytes of capacity
- Supports Network File System (NFS) protocols
- Compatible with all Linux-based AMIs for EC2

• EFS use cases


- Home directories: Provides storage for organizations that have many users who
must access and share common datasets.
- File system for enterprise applications: Provides the scalability, elasticity,
availability, and durability to be the file store for enterprise applications and for
applications that are delivered as a service.
- Application testing and development: Provides a common storage repository that
enables you to share code and other files in a secure and organized way.
- Database backups: Can be mounted with NFSv4 from database servers.
- Web serving and content management: Provides a durable, high-throughput file
system for content management systems that store and serve information for a
range of applications (such as websites, online publications, and archives).
- Big data analytics: Provides the scale and performance for big data applications that
need high throughput to compute nodes, along with read-after-write consistency
and low-latency file operations.
- Media workflows: Provides the strong data consistency model, high throughput, and
shared-file access that can reduce the time it takes to perform video editing, studio
production, broadcast processing, sound design, and rendering jobs. At the same
time, it consolidates multiple local file repositories into a single location for all users
• Amazon FSx for Window File Server
Provides fully managed shared file system storage for Microsoft Windows EC2 instances
- Native Microsoft Windows compatibility
- NTFS
- Native Server Message Block (SMB) protocol version 2.0 to 3.1.1
- Distributed File System (DFS) Namespaces and DFS replication
- Integrates with Microsoft Active directory & supports Windows ACLs
- Backed by high-performance SSD storage

• FSx use cases


- Home directories: Create a file system that hundreds of thousands of users can
access and establish permissions at the file or folder level.
- Lift-and-shift applications: It provides fully managed native Windows file shares with
features, like Microsoft Active Directory integration and automatic backups.
- Media and entertainment workflows: Media workflows—like media transcoding,
processing, and streaming—often depend on shared Windows file storage with
consistent performance. FSx for Windows File Server provides you with a shared file
system with the high throughput and low latencies that these Windows workloads
need.
- Data analytics: By providing scalable file systems with high throughput and low
latencies, FSx for Windows File Server enables you to run data-intensive analytics
workloads.
- Web serving and content management: Multiple web or content servers typically
need access to the same files. FSx for Windows File Server provides a file system that
can be accessed across thousands of instances simultaneously.
- Software development environments: FSx for Windows File Server enables you to
move to in-cloud development with no changes to your development workflows by
providing shared file storage that your developers and their environments can access
Section 7: EC2 pricing options

• EC2 pricing options


- On-demand instances
 Most flexibility, with no long-term contract and low rates
 Pay for compute capacity by the hour or by the second
 They are a good choice for applications with short-term, spiky, or
unpredictable workloads
 lowest upfront cost and no long-term contracts
- Reserved instances
 Enable you to reserve computing capacity for a 1-year or 3-year term with
lower hourly running costs.
 Discounted usage price is fixed for as long as you own the Reserved Instance
 Reserved Instances are a good choice if you have predictable or steady-state
compute needs
- Savings plan
 Flexible pricing model that offers low prices but with 1-year or 3-year term
commitment
 Good choice if only using Amazon EC2, AWS Lambda, and AWS Fargate usage
- Spot instances
 Enable users to bid on unused EC2 instances and request spare computing
capacity at substantial savings
 Recommended for fault-tolerant, flexible (non-time-critical), stateless
workloads
- Dedicated hosts
 Physical servers with instance capacity that is dedicated to your use
 Good choice when you have licensing restrictions for the software or single
tenancy to meet compliance requirement

• EC2 dedicated options


• EC2 cost optimization guideline

Section 8: EC2 considerations

• Placement groups
Enable users to control where instances run in AZ
- Influence where a group of independent instances run:
 Increase network performance between them
 Reduce correlated or simultaneous failure
- Placement strategies
 Cluster: Packs instances close together inside an AZ to achieve low-latency
network performance
 Partition: Spreads your instances across logical partitions so that groups of
instances in one partition do not share the underlying hardware with groups
of instances in different partitions
 Spread: Strictly places a small group of instances across distinct underlying
hardware to reduce correlated failures
- Limitations
 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

• Cluster placement group


• Partition placement group

• Spread placement group

You might also like