🔑 Key points
- AWS RDS provides managed database support, handling maintenance and backups.
- Security groups act as virtual firewalls to protect database access.
- Credentials must be stored securely using environment variables or secrets.
- Deploying an RDS MySQL instance is a core step for the JWT Pizza Service infrastructure.
Cloud deployment allows you to leverage scalable database services that can dynamically increase storage and computing capacity as your user base grows. For the JWT Pizza service, you will use the AWS Relational Database Service (RDS) MySQL implementation.
AWS RDS manages configuration, backups, monitoring, and restoration for you. Additionally, you can adjust the size of your database server with just a few clicks. This allows you to reduce costs during low-demand periods and scale up as your customer traffic increases.
Important
Ensure you are using the us-east-1 (N. Virginia) AWS region for all work in this course.
Before creating your database instance, you must define the security groups that control network traffic. You will define two groups:
- jwt-pizza-service: A group for the application service.
- jwt-pizza-db: A group for the database that only allows traffic from the application service.
Initially, the jwt-pizza-service group will allow public traffic. Once a load balancer is deployed later in the course, you will restrict this group further.
-
Open the AWS Management Console and navigate to the VPC service.
-
Select Security groups from the left navigation panel.
-
Click Create security group.
-
Security group name:
jwt-pizza-service. -
Description:
JWT Pizza Service. -
Under Inbound rules, click Add rule:
- Type:
HTTPS. This auto-populates port 443. Set Source toAnywhere-IPv4(0.0.0.0/0). - Type:
HTTP. This auto-populates port 80. Set Source toAnywhere-IPv4(0.0.0.0/0).
- Type:
-
Do not delete the default Outbound rules.
-
Click Create security group.
-
Return to the Security groups page in the VPC service.
-
Click Create security group.
-
Security group name:
jwt-pizza-db. -
Description:
JWT Pizza Service Database. -
Under Inbound rules, click Add rule:
- Type:
MySQL/Aurora. This auto-populates port 3306. - Source: Select the
jwt-pizza-servicesecurity group you just created. As you typejwt-pizza-servicein the source box, the console should suggest the corresponding Security Group ID.
- Type:
-
Do not delete the default Outbound rules.
-
Click Create security group.
With the network security configured, you can now provision the MySQL server instance.
-
Open the AWS Management Console and navigate to the RDS service.
-
Click Create database.
-
Choose Standard create.
-
Engine options: Select
MySQL. -
Templates: Choose
Free tier. (If Free tier is unavailable, selectDev/Test). -
Settings:
-
DB instance identifier:
jwt-pizza-service-db. -
Master username:
admin. -
Credentials management: Select
Self managed. -
Master password: Specify a strong password.
⚠️ Warning: Avoid using special characters (like@,:, or/) in your password. Since this password is often passed within a URL connection string, certain punctuation marks can cause the connection to fail. It is safest to use alphanumeric characters.
-
-
Instance configuration:
-
Connectivity:
- Public access: Select No.
- VPC security group: Select Choose existing.
- Select the
jwt-pizza-dbsecurity group. - Remove the
defaultsecurity group.
- Select the
- Availability Zone: Select any available zone (e.g.,
us-east-1a).
-
Click Create database.
The database may take several minutes to provision. Once the status is Available, click on the instance name and copy the Endpoint. You will use this as your DB hostname.
While the database is now deployed, you must address two requirements before the JWT Pizza Service can use it: establishing network connectivity and managing credentials.
Security is often a trade-off between convenience and protection. DevOps automation helps bridge this gap by handling security requirements without manual overhead.
By keeping the database on a private network (Public access: No), you protect high-value user data from direct internet exposure. The JWT Pizza Service will be able to reach the database because you configured the jwt-pizza-db security group to explicitly allow traffic from the jwt-pizza-service security group.
To provide credentials to the application securely, you will store them as GitHub Actions secrets. During the CI/CD workflow, these secrets will be injected into the service's environment variables.
Update your GitHub repository secrets with the following values:
| Secret | Description | Example |
|---|---|---|
| DB_HOSTNAME | The production endpoint for the database | jwt-pizza-service-db.xxxx.us-east-1.rds.amazonaws.com |
| DB_USERNAME | The production username for the database | admin |
| DB_PASSWORD | The production password used to access the database | your-alphanumeric-password |
Deploy a MySQL server in your AWS account following the steps outlined above:
- Create the application and database security groups.
- Provision the MySQL RDS instance within the
jwt-pizza-dbsecurity group. - Add the database endpoint, username, and password to your
jwt-pizza-serviceGitHub Actions secrets.
{"id":"b365b915-dbff-4687-aa7b-ce69a074d77a", "title":"MySQL RDS", "type":"file-submission", "gradingCriteria":"AWS RDS running MySql" }
Submit a screenshot of your MySQL database running on AWS RDS.




