AWS Elastic Cloud Compute – EC2

EC2 is one of the first and awesome features released by AWS that allows an user to create a server (windows and linux) of various sizes (scalable computing) in the cloud. This is awesome since the user or company does not need to invest in hardware and can use the server as long as it needs only. Another cool feature is that AWS only charges for running time. So, if test / dev server is setup, it can be turned off after business hours and weekends to save costs.

The user or company can also setup as many servers as it needs. However, there are limits on how many servers can be setup per type per region. Usually the limits are large enough but if more is required, the simply speak to the AWS representatives or request for limit increase.

EC2 Instances

EC2 Instances are the virtual computing enviroments. The EC2 instances can be created either from the predefined list of AWS hosted images or alternatively custom machine images (AMIs) can also be created that can be used to create an instance.

When an instance is created, CPU and memory configuration can b selected, different instance types like compute-optimised, memory-optimised, storage-optimised and many more options are available to choose from.

When the instance is created, the root key pairs (public and private keys) for linux or administrator id and password for windows server is provided. Note, it is only provided once, so store it securely.

EC2 AMIs

AMIs or Amazon Machine Images are images of the server that contain common software installed and configured. For example, a windows server may already have Sql Server installed or linux server may already be configured for NAT. Custom AMIs can also be created. Overall AMIs make it very easy and efficient to setup a server.

AMIs can be backed by different storage options - EBS backed storage or instance backed storage. The storage type determines the root device for the instance. For EBS backed storage, the root device is an EBS volume, for instance backed storage, the root device is an instance store volume created from a template stored in S3.

EC2 Instance - Storage

The root device contains the image used to start the instance. The instance can include both instance store volumes and EBS store volumes. There are limitations on the instance store volumes. The instance store volumes are better suited on instances for temporary use since the data on the volumes will be lost when the instance is stopped or terminated. EBS backed volumes are persistent and will be available even when the instance is stopped or terminated.

Other Information

  • EC2 can created within a VPC for a subnet
  • EC2 can have public IP automatically or manually assigned
  • An IAM role can be setup for the instance. Only recently the role can be changed after creating the insteance
  • Whether an instance stops or terminates when shutdown can be set from the console or the cli
  • EC2 instances can have termination protection that prevention accidental termination of the instance from API or console
  • Additional data / script can be passed when creating the instance that will automatically run - for example, it could download and install software from the internet
  • Tags can be assigned which helps in understanding costs