Elastic Compute Cloud (EC2)

Cloud Computing Service

Chose your OS, Storage, Memory, Network Throughput Launch and SSH into your server within minutes

Instance Types and Usage

General Purpose : A1 T3 T3a T2 M5 M5a M4 balance of compute, memory and code repositories Use-cases web servers and code repositories

Compute Optimized : C5 C5n C4 Ideal for compute bound applications that benefit from high performance processors Use-cases scientific modeling, dedicated gaming servers, and ad server engines

Memory Optimized : R5 R5a X1e X1 High Memory z1d fast performance for workloads that process large data sets in memory Use-cases in-memory caches, in-memory databases, real time big data analytics

Accelerated Optimized : P3 P2 G3 F1 hardware accelerators, or co-processors Use-cases Machine learning, computation finance, seismic analysis, speech recognition

Storage Optimized : I3 I3en D2 H1 high, sequential read and write access to very large data sets on local Storage Use-cases NoSQL in-memory, or transactional databases, data warehousing.

Instance Sizes

EC2 Instance Sizes generally double in price and key attributes

Instance Profile

Instead of embedding your AWS credentials in your code so your Instance has permission to access certain services you can Attach a role to an instance via an Instance Profile

You want to always avoid embedding your AWS credentials when possible

An Instance Profile holds a reference to a role. The EC2 instance is associated with the Instance Profile. When you select an IAM role when Launching an EC2 instance, AWS will automatically create the Instance Profile for you. Profiles are not easily view via the AWS Console.

Placement Groups

Placement Groups let you to choose the logical placement of your instances to optimize for communication, performance or durability. Placement groups are free.

Cluster

  • packs instances close together inside an AZ
  • low-latency network performance for tightly-coupled node-to-node communication
  • well suited for High Performance Computing (HPC) applications
  • Clusters cannot be multi-Az

Partition

  • spreads instances across logical partitions
  • each partition do not share the underlying hardware with each other (rack per partition)
  • well suite for large distributed and replicated workloads (Hadoop, Cassandra, Kafka)

Spread

  • Each instance is placed on a different rack
  • When critical instances should be keep separate from each other
  • You can spread a max of 7 instances. Spreads can be multi-AZ

UserData

You can provide an Ec2 with UserData which is a script that will be automatically run when launching an EC2 instance. You could instal package, apply updates or anything you like.

From within the EC2 instance, if you were to SSH in and CURL this special URL you can see the UserData script eg. curl http://169.254.169.254/latest/user-data

MetaData

From within your EC2 instance you can access information about the EC2 via a special url endpoint at

169.254.169.254

You would SSH into your EC2 instance and can use the CURL command: curl http://169.254.169.254/latest/meta-data

/public-ipv4 get the current public IPV4 address /ami-id the AMI ID used to launch this EC2 instance /instance-type the Instance Type of this EC2 instance

Combine metadata with userdata scripts to perform all sorts of advanced AWS staging automation