AWS Cloud Compute, Storage and Networking (Part 1)

Part 1, Part 2, Part 3


As mentioned in my previous article, we have an overview of AWS Cloud. These whole series articles will focus on cloud compute, storage and networking which are the most basic infrastructure in AWS. This article will talk about cloud compute first.

Amazon EC2

手把手程式實作分享系列: AWS EC2 連線. 唉呦螫騰了一番| by Walter Chiu | Bandai的機器學習筆記| Medium

EC2 is resizable compute capacity. Users can complete control of your computing resources. It reduced time required to obtain and boot new server instances. We can use tags to help manage Amazon EC2 resources.

There are 4 steps for launching an Amazon EC2:

  1. Determine the AWS Region in which you want to launch the Amazon EC2 instance.
  2. Launch an Amazon EC2 instance from a pre-configured Amazon Machine Image (AMI).
  3. Choose an instance type based on CPU, memory, storage, and network requirements.
  4. Configure network, IP address, security groups, storage volume, tags, and key pair.

We always select AMI based on the region, operation system, architecture, launch permissions and storage for the root device.

EC2 Lifecycle

        The instance lifecycle

The above figure shows the lifecycle of an instance.

Instance stateDescriptionInstance usage billing
pendingThe instance is preparing to enter the running state. An instance enters the pending state when it launches for the first time, or when it is started after being in the stopped state.Not billed
runningThe instance is running and ready for use.Billed
stoppingThe instance is preparing to be stopped or stop-hibernated.Not billed if preparing to stopBilled if preparing to hibernate
stoppedThe instance is shut down and cannot be used. The instance can be started at any time.Not billed
shutting-downThe instance is preparing to be terminated.Not billed
terminatedThe instance has been permanently deleted and cannot be started.Not billed. Note: Reserved Instances that applied to terminated instances are billed until the end of their term according to their payment option. For more information, see Reserved Instances

Above table shows the billing with respect to the instance state.

Choosing Right EC2 instance

When we want to launch an instance, we have to consider:

  • Core count
  • Memory Size
  • Storage size and type
  • Network performance
  • CPU technologies

Also, there are different instance family for different use cases.

For example, we can use t2, m4 and m3 for general purpose. However, if we want to have higher computing power, we can use c4 and c3. On the other hand, if we want to optimize the memory, we can use r3.

Instance Metadata

Generally speaking, metadata is data about data. When we curl or GET, it will return the metadata text.

User Data

Normally, we use user data to automate some configuration tasks. We usually use it when instance launches.

Typically, Linux script is an example of user data. It is executed by cloud-init. Perhaps, it can also be Windows batch or PowerShell scripts executed by EC2 Config service.

Options for EC2

As discussed in previous article, there are different options for EC2 instance. We can buy what we actually need and plan.

On-demand instances: We use On-Demand Instances for applications with short-term, irregular workloads that cannot be interrupted.

Reserved instances: We choose reserved instances in case we know the instances will keep running for a long time.

Scheduled instances: We use scheduled instances if we know some periods have high traffic. For instance, we expect Christmas Days will have much more traffic if we are retail and doing some promotion.

Spot instances: If you are researchers and running some time consuming tasks on computer, but in case your task does not care the computer will suddenly shut down, then spot instance is very suitable for you.

Dedicated instances are Amazon EC2 instances running in a virtual private cloud (VPC) on hardware dedicated to a single customer. On the other hand, a dedicated host is also a physical server dedicated for your use. With a Dedicated Host, you have visibility and control over how instances are placed on the server. The above table shows the difference between dedicated instance and dedicated host.


Despite that this article is only talking about cloud compute, it consists of a lot of things. We learn the lifecycle of an instance, how to choose a right instance type. In addition, we also learn what meta data and user data are. Finally, we learn different purchasing options for EC2. If we are choosing those things fitting our requirement, then it will really save much money.

Leave a Reply