Setting up a managed PostgreSQL database using AWS Lightsail

AWS LightsailPostgreSQLAWS

What is AWS Lightsail?

Amazon Lightsail is the easiest way to get started with Amazon Web Services (AWS) for anyone who needs to build websites or web applications. It includes everything you need to launch your project quickly - instances (virtual private servers), container services, managed databases, content delivery network (CDN) distributions, load balancers, SSD-based block storage, static IP addresses, DNS management of registered domains, and resource snapshots (backups) - for a low, predictable monthly price.

What is PostgreSQL?

PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

Why use a managed database?

Using a managed database simplifies setup and maintenance, offering automated backups, disaster recovery, and high availability. It provides scalability to handle increased traffic, robust security features, and performance optimization for responsive user experiences, streamlining development and ensuring data reliability.

Step 1: Sign up for an AWS Account

Start by creating your own AWS account. This will give you access to a variety of powerful tools and resources provided by Amazon Web Services, allowing you to easily build, deploy, and manage your applications in the cloud.

Step 2: Create a PostgreSQL managed database

  1. Sign in into the Lightsail console tab: Lightsail Console
  2. On the Lightsail Homepage, click on the Databases tab

Untitled.png

  1. Then click on Create database
  2. Choose the AWS Region and Availability Zone for your database

az.png

  1. If you want to change the AWS Region and Availability Zone then click on: Change AWS Region and Availability Zone

  2. Pick your database:

    • For this tutorial I am choosing PostgreSQL v13.14 as it is compatible to my Strapi project

selectdb.png

  1. Specify Database options like username, password and database name

    • This step is optional, you can specify these for yourselves, or AWS Lightsail will create and manage these for you.

dbdetails.png

  1. Choose your database plan

    • For this, you can choose between Standard or High Availability plan:
    • Standard plans are generally used for dev/test environments.
    • High Availability plans are used for production workloads
    • For this I am going to choose the Standard plan

dbplan.png

The good news is that AWS Lightsail offers first 3 months free for the Database instance.

  1. Choose a name for your database

    • Use tags to filter and organize your resources in the Lightsail console. Key-value tags can also be used to organize your billing, and to control access to your resources.

dbname.png

  1. Click on create database

Step 3: Connect to your database

Conclusion

Conclusively, with Lightsail, setting up and accessing your database is a breeze. Whether you're configuring it for data import or connecting through a database client, Lightsail offers simplicity and efficiency, empowering you to swiftly embark on your development journey with confidence.