The basics of working with Amazon EC2

pan serwer Piotr Kmita

You may already be familiar with AWS. But have you heard of Amazon’s EC2 service? In this article you will find instructions on how to work with the service and what possibilities it offers. However, before we get to the heart of the article, it is worthwhile to first review the relevant information before launching your first server.

Amazon Web Services offers a large selection of instances. It is important to know how they differ from each other and which one will meet our needs. One such instance is EC2. It stands for Elastic Compute Cloud, or flexible public cloud. The individual Amazon EC2 instances are VPS virtual servers. They are run on shared hardware resources or private dedicated servers. These servers differ primarily in price. Sharing hardware is cheaper than owning an entire server for your own use.

I will only add that in the article we will indicate the original English names due to the fact that Amazon is created in English and it is easier to operate on the official AWS names.

Types of initiation in Amazon EC2

In the Amazon EC2 service, we can use several types of instances. In Amazon Elastic Compute Cloud, these are: general purpose, compute optimized, memory optimized, accelerated computing, storage optimized. We will go through each type in turn, so that you can see the difference between each type.

Instance types in Amazon EC2

Fig. 1 – Types of installations in Amazon EC2

General Purpose

It isan Amazon EC2 instance type that has centered parameters and is used when you want none of the parameters to be dominant. This type is divided into:

  • M5 and M4. Of which the M5 instance is the latest generation. It is well optimized for memory, network resources and processing power. The M4, on the other hand, has a different processor and is less optimized in terms of the EBS drive. The performance of M4 servers is fixed and not based on CPU credits.
  • T2 – this type is mainly used in small projects or test environments. T2 instances use CPU credits. This is the reason why they should not be used in large IT projects. Once CPU credits are exhausted, T2 instances significantly reduce their performance. For example, if we use a t2.micro instance and the CPU is used less than 20%, 6 credits per hour are collected. However, if we use the CPU more than 20% then these credits wear off. These credits are held for up to 24 hours.

Computer optimized

Another type of Amazon EC2 instance is computer optimized. This type is optimized for computing power. Computer optimized are divided into:

  • C4 and C5 – Both instances have high computing power for high-performance network servers, scientific modeling, batch processing and distributed analysis.

Memory optimized

Another type of instance is memory optimized. This is the type created for companies that use large amounts of RAM. The current subtypes of memory optimized instances are:

  • X1, X1e, R4. They are mainly used for high-performance databases. The largest instance of x1e.32xlarge has 3940 GB of DDR4 RAM. The instance is certified by SAP to work with Business Suite, S/4HANA, Business Suite on HANA (SoH), Business Warehouse on HANA (BW), Data Mart Solutions on HANA in AWS cloud computing.

GPU graphics and GPU compute

If GPUs are important to you, then Amazon EC2 instances such as GPU graphics and GPU compute may be useful to you.

  • The P2 and P3 sub-instances represent GPU compute. They are recommended for applications that require high computational power, e.g.: machine learning, computational fluid mechanics, high-performance databases, financial computing, seismic analysis, fluid dynamics, molecular modeling and genomics.
  • G3, on the other hand, is GPU graphics. The G3 is ideal for applications that require high performance graphics acceleration including: 3D visualization and rendering, video encoding or virtual reality. This instance provides GPUs, high CPU performance, as well as large memory and fast network speeds.

GPU instances and PFGA instances

Special types of instances in Amazon EC2 are: GPU inst ances and PFGA instances (Accelerated Computing). They have high computing power and an SSD as additional instance storage.

  • G2 is one of the aforementioned instances. It has a GPU and additional storage (SSD).
  • F1 – is the second of the instances. It offers customizable hardware acceleration, thanks to a programmable FPGA logic chip.

Storage optimized

The last type is storage optimized, or instances that are optimized for disk performance.

  • D2, I2, H1, H3 are designed for applications with high I/O requirements for storage size. D2, on the other hand, is recommended for use in large data warehouses or parallel file systems.

Before planning your infrastructure, it’s a good idea to make sure that the type of Amazon EC2 instance you intend to deploy is available in the geographic area you plan to deploy it in. Certain areas do not have some instances at this point. It is worth recalling that AWS services are dynamically changing and some services may already be superseded by other, improved services. To see if the service we need is available to us, it is best to use the official AWS website

Methods of settlement

When using Amazon Elastic Compute Cloud, we can run servers on a shared device or on a private device that is physically separate from the rest of the clients’ servers.

AWS Pricing

Fig. 2 – AWS price list

Depending on how the use of instances is accounted for, there are several instances:

  • on-demand – this type of instance is launched at the request of the client,
  • reserved instances – or reserved instances. They provide guarantees that we will have access to the resources we intend to use. With this type of settlement, the server will run continuously. As a result, we will save a lot of money, compared to running on-demand servers. It is worth remembering that if you opt for this instance, the contract is signed for 12 or 36 months.
  • spot instance – instances are launched on a bidding-like basis. Their biggest drawback is that this type of instance is not always available. In addition, Amazon can take our instance away at any time, giving just 2 minutes to complete processes and save the machine’s results. In case Amazon takes away our servers, we do not incur labor costs for the last hour. This type of instance is perfect for processing tasks from queues. The biggest benefit of this solution, is its price. They save up to 90% of costs compared to on-demand instances.
  • dedicated instances – these are dedicated instances. The devices are activated and used only by us. They are physically separated from the servers of other clients.

To estimate costs, AWS provides a calculator where you can estimate how much money it will cost you to use a particular tool. The calculator can be found at this link:

Amazon Web Services cloud management

Amazon provides several options for managing its services. We can manage them from the level:

  • AWS Management Console. It is a panel accessible through a browser. This solution is ideal for non-advanced users.
Fig. 3 – AWS cockpit
  • Command Line Interface (CLI) – we manage AWS via the command line.
Fig. 4 – command line interface (CLI)
  • Software Development Kits SDKs. It is a set of libraries that allows you to manage through programming languages such as: Java, Node.js, Python, PHP, C++, Go.
Fig. 5 – Developer toolkits (SDKs)

Before you start creating EC2

In order to create a virtual machine, it is required to configure the virtual network infrastructure beforehand. To run an Amazon EC2 instance, you need to configure such items:

  • Virtual Private Cloud (VPC) – a virtual network on AWS,
  • Subnet – a subnet in the VPC,
  • Internet Gateway – Internet gateway in VPC,
  • Route table – routing table,
  • Security group ,
  • Network ACL security policy.

It is recommended that you create your own components, however, AWS makes its components available if needed.

Pay attention to the functionalities

AWS has a great deal of functionality. At least some of it is worth looking into when creating virtual machines in EC2:

  • Instance types – these are designed for different environments. It is worth considering what we will use EC2 for. In one case the instance will be correct, and in another it will not. For example, in production environments, it is not recommended to use the T2 type because it has CPU credits. However, if we plan to test environments, the T2 type will be suitable.
  • Placement Groups – functionality, thanks to which virtual machines will be in one “Availability Zone”. This will result in low latency between servers in network communication. If you want to learn more about this, take a peek at the article on S3.(https://b )
  • AMI image – this is the image of the operating system that will be used to run the server,
  • Security group – the security group only allows selected network traffic, not all of it. This group is assigned to a particular EC2 instance.
  • EBS disk type – before choosing a disk, consider whether you need higher throughput or IOPS. The types of EBS drives are General Purpose SSD (gp2), Provisioned IOPS SSD (io1), Throughtput Optimized HDD (st1), Cold HDD (sc1).

If you want to know the detailed parameters of the disk types, here is all the information:


Starting the adventure with servers, however, it is worth considering what you intend to use it for and what needs you have in connection with it. It’s also worth asking yourself questions such as: “Do I need a lot of network bandwidth between other cloud servers” or “What will the disk load look like.” Some of the operations, e.g.: changing the type of disk or joining “Plecement Groups” can be problematic if you have already created a server.

If you’re going to use Amazon EC2, it’s worth browsing the official Amazon Web Services website and reading the details of the service to make sure you get the right solution for your needs.


Do you have questions? Get in touch with us