DEV Community

Peter Mbanugo
Peter Mbanugo

Posted on

How I choose AWS services for running my application

To choose which AWS service to use for running your application might be somewhat confusing to some of us. Even for the experienced, we may take some time trying to make a decision. It may be confusing to you because you are new to AWS and still need to understand the what and why of the various AWS services, or you might be experienced using it but it takes you longer because you don't have a process to facilitate easy selection. Let me show you how I do this and the process I follow.

A look at the process

During the process of selecting what service to use for running an application, I try to answer the following questions:

Qustion 1: How much control do I need?

In answering this question I decide on what I want to have control over and which I'd like to leave its responsibility with AWS. I choose if I want to control which operating system (OS) it'll run on, how the network is configured, the server, the application code, and its configuration. But with more control comes great responsibility. For example, if I'm in control of the OS I'll be responsible for updating, securing it and configuring what is exposed to the public network. The different cloud computing options give you varying control and responsibility. Let's look at these options and what we can control:

Option 1: Infrastructure as a Service (IaaS):

IaaS computing option provides you with the highest level of flexibility and management control over your IT resources. It provides access to networking features, computers (virtual or on dedicated hardware), and data storage space. Use this option if you want to be in control of the bare metals running your app and handle all the responsibility of the following:

  1. Application configuration
  2. Application code
  3. Server maintenance and configuration
  4. Operating System
  5. Antivirus
  6. Network

Services available as IaaS are:

  1. Elastic Compute Cloud (EC2) Instances
  2. Amazon Lightsail
  3. EC2 Container Service (ECS)
  4. Elastic Container Service for Kubernetes (EKS)
  5. AWS Batch

Option 2: Platform as a Service (PaaS)

PaaS computing removes the need for you to manage the underlying infrastructure (hardware, OS, networking). With this, you focus on creating and running applications rather than constructing and maintaining the underlying infrastructure and services. Use this option if you want to control:

  1. Application configuration
  2. Application code
  3. Server configuration

while leaving other responsibilities to AWS. Services available as PaaS are:

  1. Elastic Beanstalk
  2. Mobile Hub

Option 3: Functions as a Service (FaaS)

FaaS computing provides you with the ability to just deploy code, set the configuration needed to run the code and leave it to AWS to handle the underlying infrastructure and networking. Use this option if you want to control just your application logic and configuration. Also, another important reason to use it is if the application will run occasionally. That is, not always on and running unlike the applications in the other types of cloud service offerings. Services available in this category are:

  1. Lambda
  2. Step Functions

Question 2: How will the app be used?

Another question to consider is knowing how will the application be used?

  1. Will it be always on and running, waiting for input/data to process? Even if no input/data/request comes in, it'll just be idle, consuming server resources and infrastructure.

  2. Will it run only when needed? In this case, the application is started when it has a request or data to process and stopped when it is completed.

If my application usage model satisfies question 1, then I'll need to use the classic model for running applications. I could use EC2 instances, ECS, or Elastic Beanstalk. If it satisfies question 2, I'll run with Lambda.

Sometimes we want to run background tasks. They will vary based on how long they run and how much resources they will need to run well. When faced with this problem I will pick between using Lambda and Batch. I go for Lambda if I need a task to run within the maximum allowable processing time for Lambda and that it doesn't require more resource than Lambda can provide. if it's the opposite of this, I'll go with Batch.

These two questions help me in my process of picking a service in AWS. The table below shows you how to achieve the purpose by answering more specific questions and knowing which services meet the criterias.

Selecting a IaaS product

Objective EC2 ECS EKS Batch
Move your app to the cloud ✔️
Apps without orchestrator ✔️ ✔️
Apps with orchestrator ✔️
Short running task ✔️
Long running and intensive task ✔️
Deploy a monolith ✔️
Deploy a microservice ✔️ ✔️ ✔️ ✔️

Selecting a PaaS product

Objective Elastic Beanstalk Mobile Hub Lambda Step Functions
Deploy a monolith ✔️
Deploy a microservice ✔️ ✔️
Host web app ✔️
Host your API ✔️
Host backend for mobile apps ✔️

Selecting a FaaS product

Objective Lambda Step Functions
Short running task ✔️
Deploy a microservice ✔️
Can deploy only the code necessary to run ✔️
Automate one step of a process ✔️
Automate a complete process ✔️ ✔️

The steps above should guide you in making decisions faster, and I hope you find it useful. This is my process and it's likely to change in the future, but I'll try to keep this post updated. I've left out some services relating to data/storage, which I'll be sharing in a future post. Please leave a comment if you would like to share your thoughts, or correct something you think I've got wrong. I've learned some of these steps from my friend Barry Luijbregts

Feel free to reach me via email on p.mbanugo@yahoo.com. Happy Coding 💃

Top comments (0)