Book Image

Developing Modern Database Applications with PostgreSQL

By : Dr. Quan Ha Le, Marcelo Diaz
Book Image

Developing Modern Database Applications with PostgreSQL

By: Dr. Quan Ha Le, Marcelo Diaz

Overview of this book

PostgreSQL is an open-source object-relational database management system (DBMS) that provides enterprise-level services, including high performance and scalability. This book is a collection of unique projects providing you with a wealth of information relating to administering, monitoring, and testing PostgreSQL. The focus of each project is on both the development and the administrative aspects of PostgreSQL. Starting by exploring development aspects such as database design and its implementation, you’ll then cover PostgreSQL administration by understanding PostgreSQL architecture, PostgreSQL performance, and high-availability clusters. Various PostgreSQL projects are explained through current technologies such as DevOps and cloud platforms using programming languages like Python and Node.js. Later, you’ll get to grips with the well-known database API tool, PostgREST, before learning how to use popular PostgreSQL database testing frameworks. The book is also packed with essential tips and tricks and common patterns for working seamlessly in a production environment. All the chapters will be explained with the help of a real-world case study on a small banking application for managing ATM locations in a city. By the end of this DBMS book, you’ll be proficient in building reliable database solutions as per your organization's needs.
Table of Contents (17 chapters)
1
Section 1 - Introducing PostgreSQL Development and Administration
3
Section 2 - Development in PostgreSQL
9
Section 3 - Administration in PostgreSQL

Setting up a Node.js project

In Chapter 2, we used Amazon Web Services (AWS) to set up a PostgreSQL RDS. In this chapter, we will use an AWS EC2 instance to create an API from Node.js to PostgreSQL.

An EC2 instance is a virtual server in Elastic Compute Cloud (or EC2) for executing our applications on the cloud infrastructure. Hence EC2 is a service evolving cloud computing platform and there are a variety of types of EC2 instances with different configurations of CPU, memory, storage, and networking resources to suit user needs. Each type is also available in two different sizes to address workload requirements.

In order to launch our EC2 instance for Node.js, we need to select an Amazon Machine Image (AMI), which is a special type of virtual appliance to deploy for services delivered to our EC2 instance. For our Node.js project in this chapter, we will use a good AWS AMI: ami-7d579d00, as seen in Figure 3.1.

We decide to use a CentOS image because CentOS is a very stable Linux version...