Amazon EC2 _ AWS Cheat Sheet
Amazon EC2 _ AWS Cheat Sheet
Amazon Elastic
Compute Cloud
(Amazon EC2) is a web
service that provides
resizable compute
capacity in the cloud.
Amazon Linux.
Ubuntu.
Windows Server.
MacOS.
Red Hat Enterprise Linux.
SUSE Linux Enterprise Server.
Fedora.
Debian.
CentOS.
Gentoo Linux.
Oracle Linux.
FreeBSD.
With EC2 you have full control at the operating system layer
(root/admin access).
A template for the root volume for the instance (for example,
an operating system, an application server, and
applications).
Launch permissions that control which AWS accounts can
use the AMI to launch instances.
A block device mapping that specifies the volumes to attach
to the instance when it’s launched.
AMIs are regional. You can only launch an AMI from the region
in which it is stored. However, you can copy AMIs to other
regions using the console, command line, or the API.
On demand
Spot
Amazon EC2 Spot Instances let you take advantage of
unused EC2 capacity in the AWS cloud.
Spot Instances are available at up to a 90% discount
compared to On-Demand prices.
You can use Spot Instances for various stateless, fault-
tolerant, or flexible applications such as big data,
containerized workloads, CI/CD, web servers, high-
performance computing (HPC), and other test &
development workloads.
You can request Spot Instances by using the Spot
management console, CLI, API or the same interface that is
used for launching On-Demand instances by indicating the
option to use Spot.
You can also select a Launch Template or a pre-configured
or custom Amazon Machine Image (AMI), configure security
and network access to your Spot instance, choose from
multiple instance types and locations, use static IP
endpoints, and attach persistent block storage to your Spot
instances.
New pricing model: The Spot price is determined by long
term trends in supply and demand for EC2 spare capacity.
You don’t have to bid for Spot Instances in the new
pricing model, and you just pay the Spot price that’s in
effect for the current hour for the instances that you
launch.
Spot Instances receive a two-minute interruption notice
when these instances are about to be reclaimed by EC2,
because EC2 needs the capacity back.
Instances are not interrupted because of higher
competing bids.
To reduce the impact of interruptions and optimize Spot
Instances, diversify, and run your application across multiple
capacity pools.
Each instance family, each instance size, in each Availability
Zone, in every Region is a separate Spot pool.
You can use the RequestSpotFleet API operation to launch
thousands of Spot Instances and diversify resources
automatically.
To further reduce the impact of interruptions, you can also
set up Spot Instances and Spot Fleets to respond to an
interruption notice by stopping or hibernating rather than
terminating instances when capacity is no longer available.
Reserved
Standard Convertible
Change No Yes
instance family,
OS, tenancy,
payment
options
RI Attributes:
Ideal for short term Ideal for steady-state Ideal for cost-sensitive,
needs or workloads and compute intensive use
unpredictable predictable usage cases that can withstand
workloads interruption
Dedicated hosts
Physical servers dedicated just for your use.
You then have control over which instances are deployed on
that host.
Available as On-Demand or with Dedicated Host
Reservation.
Useful if you have server-bound software licenses that use
metrics like per-core, per-socket, or per-VM.
Each dedicated host can only run one EC2 instance size and
type.
Good for regulatory compliance or licensing requirements.
Predictable performance.
Complete isolation.
Most expensive option.
Billing is per host.
Dedicated instances
Virtualized instances on hardware just for you.
Also uses physically dedicated EC2 servers.
Does not provide the additional visibility and controls of
dedicated hosts (e.g. how instances are placed on a server).
Billing is per instance.
May share hardware with other non-dedicated instances in
the same account.
Available as On-Demand, Reserved Instances, and Spot
Instances.
Cost additional $2 per hour per region.
Networking
Networking Limits (per region or as specified):
IP Addresses
There are three types of IP address that can be assigned to an
Amazon EC2 instance:
AWS charges for elastic IP’s when they’re not being used.
When you stop and start and EC2 instance, it will generally be
moved to different underlying hardware.
Exam tip: You can stop and start an EC2 instance to move it to
a different physical host if EC2 status checks are failing or
there is planned maintenance on the current physical host.
Instance type.
User data.
Kernel.
RAM disk.
You can bring part or all your publicly routable IPv4 or IPv6
address range from your on-premises network to AWS. This is
called BYOIP.
Name Description
No charge
You can only add one extra ENI when launching but more can
be attached later.
Attaching ENIs:
This is the basic adapter type for when you don’t have any
high-performance requirements.
Can use with all instance types.
Good for use cases that require higher bandwidth and lower
inter-instance latency.
Supported for limited instance types (HVM only).
Placement Groups
Placement groups are a logical grouping of instances in one of
the following configurations.
Cluster – clusters instances into a low-latency group in a
single AZ:
When Need low network Reduce the risk of Need control and
latency and/or high simultaneous instance visibility into instance
network failure if underlying placement
throughput hardware fails
Pros Get the most out of Can span multiple Reduces likelihood of
enhanced AZs correlated failures for
networking large workloads.
Instances
IAM Roles
IAM roles are more secure than storing access keys and secret
access keys on EC2 instances
IAM roles are easier to manage and more secure than access
keys.
You can attach an IAM role to an instance at launch time or at
any time after by using the AWS CLI, SDK, or the EC2 console.
Bastion/Jump Hosts
You can configure EC2 instances as bastion hosts (aka jump
boxes) to access your VPC instances for management.
CloudTrail captures all API calls for Amazon EC2 and Amazon
EBS as events, including calls from the console and from code
calls to the APIs.
If you don’t configure a trail, you can still view the most recent
events in the CloudTrail console by viewing Event history (past
90 days only).
Tags are just arbitrary name/value pairs that you can assign to
virtually all AWS assets to serve as metadata.
Tags can help you manage, identify, organize, search for, and
filter resources.
Resource Groups
Resource groups are mappings of AWS assets defined by tags.
Migration
VM Import Export
Supported for:
Can only be used via the API or CLI (not the console).