Amazon RDS Lambda Beanstalk

Amazon Integrated Services (part 1)

In this article, I am going to continue my overview of the Amazon Integrated Services trying to explain my understanding of the following services:

  • Relational Database Service (RDS)
  • Lambda
  • Beanstalk

Before reading this, make sure you read this and this.

Relational Database Service (RDS)

Amazon RDS allows, with a single click, to create a database, configure it (also in HA), and manage backups automatically. If you have experience in building applications you know that you can keep data in several places (file, remote storage, etc.) included a database. However, managing the database infrastructure is not easy. You need to manage the following items:

  • server hardware (cable, power, network, disks, etc.);
  • operating system (install, upgrade, and patches);
  • database engine software (install, upgrade, and patches);
  • create and manage the database containing data (create, data optimization, etc.);
  • create and manage backups for disaster recovery;
  • manage security;
  • if you need high availability you need to replicate the above effort for a number of replicas you need to manage.

Amazon RDS Configuration

The basic idea of the Amazon RDS is to let the customer choose the database to create its engine (i.e. PostgreSQL, MySQL, MariaDB, etc), configure it for disaster recovery, and high availability with a few mouse clicks. The application can live inside Amazon Cloud or outside it, it depends on the customer’s choice. The goal here is that customers focus on their own applications letting Amazon manage the whole database infrastructure.

Amazon RDS
Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

In order to create a database in Amazon RDS, you need to create a database instance. Basically, you need to define the DB Instance Class where you choose the number of CPU, the memory, and the network performance of the machine hosting the instance. Then, you need to define the DB Instance Storage, for example, the disk type (magnetic or SSD). Amazon RDS supports six Db engines: MySQL, Amazon Aurora, SQL Server, PostgreSQL, MariaDB, and Oracle. Depending on how you configure the DB Instance class and storage and the DB Engine the price change.

Amazon RDS Instance

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

Amazon RDS typical scenario

In a typical scenario, you should deploy your application and the database service on the same VPC, in a single AZ, on different subnets. Traffic from the Internet only reaches the application subnet that must be public, while the database subnet is private. Usually, you have to configure the private subnet to only accept connections from the public subnet.

Amazon RDS in a VPC

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

Amazon RDS in High Availability (HA) scenario

You can configure Amazon RDS to work in HA, in this case, you will have a DB Replica on a different AZ connected in Synchronous mode to the master database. In this way, you will not have any data loss because a transaction is closed only if it is present on both the DB Instance.

Amazon RDS HA

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

If for some reason the Amazon RDS master copy is unavailable, the application automatically connects to the Synchronous instance.

Amazon RDS Failover

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

Amazon RDS in Scalability scenario

Amazon RDS supports also Read Replica for MySQL, PostgreSQL, MariaDB, Amazon Aurora DB engines. Basically, the service automatically uses the standby copy for read-only queries. This allows splitting the database traffic on both the nodes. Updates are available only on the master node. This configuration is particularly useful on massive database read applications. However, the stand-by node works in an asynchronous mode so if you want to promote it to master a manual action is required.

Amazon RDS Read Replica

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course


Lambda is the FaaS solution of the Amazon AWS platform. A FaaS solution allows you to run programming functions without managing any server infrastructure. The difference with the PaaS solution is that only code is under the responsibility of the end-user while the Cloud platform manages the whole application stack included the data.

The benefit to use the Lambda service is that you only take care of the code to run when a given event occurs. The Cloud platform manages everything else like the server infrastructure, its scalability, the logging, and so on. CloudWatch can monitor your code so you know everything is going on with your application. Amazon Lambda supports a lot of programming languages like Node.js, Java, C#, Python, etc.

As said above the code running in Lambda always run in response to an event like an HTTP request, an SNS notification, and others.

Deploy a Lambda application is very easy because you only need to deploy the code and configure it to run when a given event occurs.

Lambda scenario example

Let’s consider the following scenario. We have a mobile application that takes a photo and automatically upload them on S3 bucket and they need to be cropped. Whenever the application uploads a photo on the S3 bucket we create an event that will run the Lambda code that takes the photo and crop it storing it again on the same bucket.

AWS Lambda Scenario

The customer only needs to create the crop code and upload it on the AWS Lambda service, then he needs to create a CloudWatch event to generate an event every time a photo is uploaded on a given bucket and associate with our Lambda code.

The AWS platform will manage the data storage that in our example is the S3 service. If for some reason the number of user increase and a lot of photos is uploaded, the code will be called a lot of time and the service automatically scale the infrastructure to satisfy the requests.

When you create the function you can write the code, define the memory to allocate, define the environment variable, specify the execution role, and much more.

There are a lot of scenarios where you can use the Lambda service, for example, image processing, automatic backups, notifications, IoT, data aggregation, log processing, Data Warehouse ETL, mobile backends, web backends, and others. You can think of Amazon Lambda as a mechanism to let AWS services cooperate to achieve a goal.

Elastic Beanstalk

Elastic Beanstalk is the Amazon Platform as a Service (PaaS) solution. PaaS is one of the service models of Cloud Computing and its basic idea is to let the customer quickly develop its application without managing the infrastructure (i.e. servers, network, disks, operating system, programming language framework, scaling). The customer only takes care of the application and the data, the platform manages everything else.

In the figure below, the Application Service layer is basically the framework (the runtime environment) where the application runs. For example, if your code is Java the application service is the Java Virtual Machine (JVM) that runs the compiled version of that code. The green box has the label “Your code” but this includes the data and configuration too, which must be managed by the customer.

Amazon Beanstalk Stack

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

The basic idea is that the developer develops the code and uploads it on a repository in the platform. This one will automatically compile and deploy the code on the server in a way completely transparent to the developer. The application will be accessible via web or API to the end-user. All the complexity to manage the infrastructure is removed.

Amazon Elastic Beanstalk

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course

What you can do on Elastic Beanstalk?

You can choose the following options:

  • instance type, basically the programming framework you needs for your application (Ruby, Java, Java with Tomcat, Node.js, PHP, Python, Go, containers, etc);
  •  database, you can attach a database to your application;
  • auto-scaling, scale up and down the application, for example, the default, max, and min number of instances;
  • update, update your application;
  • logs, access to the application logs;
  • HTTPS, configure HTTPS on the load balancer.

Application lifecycle

The following figure summarizes the application lifecycle. The developer develops the code and uploads it on a repository, then it creates the application instance in Elastic Beanstalk and associates that repository to it. Elastic Beanstalk prepares the environment for the code, depending on the programming language it instantiates a server with the OS and runtime framework to deploy the code in it. The developer manages the environments via monitoring to check that everything is ok. The developer can update the application at whatever moment by simply uploading the code changes into the repository.

Elastic Beanstalk Application Lifecycle

Photo from AWS Cloud Practitioner Essentials (2nd Edition) course


In this article, we talked about the RDS, Lambda, and Elastic Beanstalk services. In the next article, we will continue our overview with the other four services.

Getting Started with Docker
Print Friendly, PDF & Email
Posted in Cloud.