This system automates RDS database provisioning, integrates with GitHub for version-controlled Terraform updates, and provides logging and monitoring via AWS CloudWatch. It also includes lifecycle management for old databases to prevent unnecessary costs.
RDS Provisioning Automation
Overview
This repository provides an automated system for provisioning RDS databases based on user input via an HTTP POST request. The system:
Architecture
The system is built using AWS SAM (Serverless Application Model) and follows this architecture:
.tfvarsfile with the request parameters.RDS_USERSIAM group.Installation
1. Fork the Repository
First, fork this repository to your GitHub account.
2. Connect the Repository to CircleCI
main.3. Configure Terraform Variables
Edit the following file:
Ensure it contains:
4. Configure SAM Deployment
Edit the following file:
Update it with:
username/repo-name)5. Set Up Environment Variables in CircleCI
Add the following environment variables to CircleCI:
AWS_ACCESS_KEY_ID: IAM access key ID for AWS authentication.AWS_SECRET_ACCESS_KEY: IAM secret access key.GITHUB_TOKEN: A GitHub token withrepoandpull_requestspermissions.SLACK_BOT_TOKEN(optional): Slack bot token for notifications.How to Obtain the Tokens?
repoandpull_requestsscopes.6. Setting Up a Slack App for Notifications
To enable Slack notifications, follow these steps:
1️⃣ Create a Slack App
2️⃣ Add Required Permissions
chat:write→ To send messages to channels.chat:write.dm→ To send direct messages to users.users:read→ To retrieve user Slack IDs.im:write→ To initiate direct messages.xoxb-xxxxxxxxxx).7. Deploy the System
main.Example API Request
To create a new RDS environment, send an HTTP POST request:
The
slack_idis the user’s personal Slack ID and is optional.Alternatively:
Summary
This system automates RDS database provisioning, integrates with GitHub for version-controlled Terraform updates, and provides logging and monitoring via AWS CloudWatch. It also includes lifecycle management for old databases to prevent unnecessary costs.