EC2

EC2 (Virtual machine)

"basic computer/server", "instance". Use it for what ever you like.

Elastic Compute Cloud => EC2

Purchasing options

  • On-Demand

    • most expensive, most flexible (billed by hour)

  • Reserved

    • Purchase an instance for a set period of time for 1 or 3 years

    • you have a big discount

    • it does not matter whether you use it or not => you pay

  • Spot

    • unused instances are sold by amazon with a discount for short time

    • spot prices fluctuate

    • you are charged by the minute

    • when you have a bid => instance is provisioned for you when the spot price =< your bid

    • if (spot price > bid price) 
          provisioned instance terminates automatically

AMI (Amazon Machine images)

AMI = EC2 + operating system + software packages + settings

This is a template to quickly spin up EC2 instances based on defined AMI. (analog is a docker image and docker containers)

AMI components

  1. Root volume template

    1. operating system (e.g. Amazon linux)

    2. application software (e.g. Apache web server)

  2. Launch permissions (who is allowed to launch)

  3. Block device mapping

    1. EBS (hard drive mapping)

Available AMIs

  • Community AMI

    • free to use (but it is mainly a choice of OS)

  • AWS marketplace AMI

    • payed (may be with special vendor software)

  • My AMI

    • create yourself

Instance types

This is a CPU of your instance (hardware of the instance). E.g. t2.nano, t2.micro, t2.large, t2.xlarge, etc

EBS (Elastic Block Store)

EBS is a storage volume for an EC2 instance (think of hard drive).

EBS Snapshot

  1. A snapshot is an image of EBS volume that can be stored as a backup of the volume or used to create a duplicate.

  2. A snapshot is not an active EBS volume => you can not attach/detach it to EC2 instance

  3. To restore a snapshot you need to create a new EBS volume using the snapshot as its template.

IOPS

Input/Output operations per second. (in KiB)

Amount of data that can be written to or retrieved from EBS per second.

Each EC2 instance must have a root volume, which may or may not be EBS.

Security groups

Security groups are similar to NACL, but Security groups are found on instance level.

  • Security groups are stateful

    • if traffic could reach an instance through SG rule => the traffic will be able to leave SG even if there is no matching outbound SG rule

  • SG does not have numbers comparing to NACL rule numbers

  • Up to five (5) security groups can be assigned per instance.

IP addressing

It is providing an EC2 instance with a public IP address.

  • private IP address

    • by default all EC2 instances have a it

    • it allows instances to communicate with each other as long as they are located in the same VPC (private network)

  • public IP address

    • EC2 instances can be launched with/without it depending on VPC/subnet settings

    • Public IP addresses are required for the instance to communicate with a internet

    • default VPC and subnets are configured so that any new instance that is provisioned has a public IP

Last updated