Use the AWS CLI to Configure a MySQL Database in Amazon RDS
Follow step-by-step instructions to set up a new MySQL database using the AWS CLI.
AWS provides many cloud computing services, and the AWS CLI allows us to interact with these services from the terminal.
In this lesson, we’ll use the AWS CLI to configure and set up a MySQL database in Amazon RDS. Later, the database will be used by the NestJS app deployed to the Amazon ECS.
What is Amazon RDS?
Amazon RDS is a managed relational database service that simplifies database setup, operation, and scaling. It supports various database engines, including MySQL, providing a reliable and scalable solution for hosting databases in the cloud.
We choose to use Amazon RDS to host the MySQL database because it comes with several benefits:
Managed service: Amazon RDS is a fully managed service that handles routine database tasks, like backups, software patching, and scaling. This can reduce the operational overhead for the team.
Automatic scaling: RDS provides automated scaling capabilities, allowing the database to scale vertically (upgrading to a larger instance type) or horizontally (using read replicas) without manual intervention.
High availability: RDS offers built-in features for high availability, such as automated backups, multi-AZ deployments, and automated failover. This enhances the reliability of the database. An Availability Zone (AZ) is a geographically isolated data center within a region, providing redundancy and fault tolerance for cloud services.
Security features: Amazon RDS includes various security features, like encryption, automated software patching, and integration with AWS Identity and Access Management (IAM) for access control.
AWS CLI
The AWS CLI provides a command-line interface for managing AWS services. It allows us to control multiple AWS services directly from our terminal, offering flexibility and automation in managing our cloud resources.
Before configuring the CLI, create a free tier AWS account by following the steps in the Set Up a Free AWS Account lesson of the “Appendix” chapter.
Obtain the AWS access key and secret access key
After creating a free tier AWS account, we can follow these steps to obtain the access key and secret:
Get hands-on with 1400+ tech skills courses.