|
| 1 | +# How to Use the AI Agent to Create Amazon RDS Database |
| 2 | + |
| 3 | +Welcome to this comprehensive guide on using the AI Infrastructure Agent to create a production-ready RDS MySQL database through natural language commands. This tutorial demonstrates how to build a complete database infrastructure with proper networking, security groups, and best practices for encryption and monitoring. |
| 4 | + |
| 5 | +## Quick Start with Docker |
| 6 | + |
| 7 | +The fastest way to get started is using Docker. Follow these steps to have the AI Infrastructure Agent running in minutes: |
| 8 | + |
| 9 | +### Step 1: Clone the Repository |
| 10 | + |
| 11 | +```bash |
| 12 | +git clone https://github.com/VersusControl/ai-infrastructure-agent.git |
| 13 | +cd ai-infrastructure-agent |
| 14 | +``` |
| 15 | + |
| 16 | +### Step 2: Configure Your AI Provider |
| 17 | + |
| 18 | +Choose your preferred AI provider and set up the configuration: |
| 19 | + |
| 20 | +```bash |
| 21 | +# For Google Gemini (Recommended) |
| 22 | +cp config.gemini.yaml.example config.yaml |
| 23 | + |
| 24 | +# For OpenAI |
| 25 | +cp config.openai.yaml.example config.yaml |
| 26 | + |
| 27 | +# For AWS Bedrock Nova |
| 28 | +cp config.bedrock.yaml.example config.yaml |
| 29 | +``` |
| 30 | + |
| 31 | +### Step 3: Run with Docker |
| 32 | + |
| 33 | +``` |
| 34 | +mkdir states |
| 35 | +``` |
| 36 | + |
| 37 | +```bash |
| 38 | +docker run -d \ |
| 39 | + -p 8080:8080 \ |
| 40 | + -v $(pwd)/config.yaml:/app/config.yaml \ |
| 41 | + -v $(pwd)/states:/app/states \ |
| 42 | + -e GEMINI_API_KEY="your-gemini-api-key-here" \ |
| 43 | + -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ |
| 44 | + -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ |
| 45 | + -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \ |
| 46 | + --name ai-agent \ |
| 47 | + ghcr.io/versuscontrol/ai-infrastructure-agent |
| 48 | +``` |
| 49 | + |
| 50 | +Open your browser and navigate to: |
| 51 | + |
| 52 | +``` |
| 53 | +http://localhost:8080 |
| 54 | +``` |
| 55 | + |
| 56 | +You should see the AI Infrastructure Agent dashboard, ready to accept your infrastructure requests! |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +> **For detailed installation instructions** including manual setup, troubleshooting, and advanced configurations, please refer to the [Getting Started Guide](../getting-started.md). |
| 61 | +
|
| 62 | +## Understanding RDS Database Architecture |
| 63 | + |
| 64 | +A well-designed RDS database deployment requires proper network isolation and security configurations. This guide walks you through creating a production-ready RDS MySQL database with: |
| 65 | + |
| 66 | +- **VPC Infrastructure**: Isolated network with public and private subnets across multiple availability zones |
| 67 | +- **DB Subnet Groups**: Subnets where your RDS instance will be deployed |
| 68 | +- **Security Groups**: Fine-grained access control for database connections |
| 69 | +- **Encryption**: Data encryption at rest for security compliance |
| 70 | +- **Performance Insights**: Advanced monitoring and troubleshooting capabilities |
| 71 | + |
| 72 | +Let's build this infrastructure step by step using natural language commands. |
| 73 | + |
| 74 | +## Part 1: Create the VPC Foundation |
| 75 | + |
| 76 | +**Goal:** Set up a production-ready VPC with proper network segmentation across multiple availability zones. |
| 77 | + |
| 78 | +### Step 1: Enter Your VPC Request |
| 79 | + |
| 80 | +Before creating an RDS database, we need a properly configured VPC. In the Web UI dashboard, type your infrastructure request in natural language: |
| 81 | + |
| 82 | +``` |
| 83 | +Create a production VPC with a CIDR block of 10.0.0.0/16 across two availability zones. Set up public subnets (10.0.1.0/24 and 10.0.2.0/24) for internet-facing load balancers. Create private subnets for application servers (10.0.11.0/24 and 10.0.12.0/24): Configure Internet Gateway and NAT Gateway for proper routing. |
| 84 | +``` |
| 85 | + |
| 86 | +Then click **"Process Request"** to let the AI analyze your requirements. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +*Enter your VPC creation request in the dashboard. The AI will analyze the requirements and generate a comprehensive execution plan.* |
| 91 | + |
| 92 | +### Step 2: Review the VPC Execution Plan |
| 93 | + |
| 94 | +After processing, you'll see a "Processing..." indicator while the AI generates the plan: |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +*The AI agent processes your natural language request and generates a detailed execution plan with all necessary steps.* |
| 99 | + |
| 100 | +The AI agent will present a detailed execution plan showing all the steps required to create the VPC infrastructure: |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +*The execution plan includes:* |
| 105 | +- *VPC creation with 10.0.0.0/16 CIDR block* |
| 106 | +- *Public and private subnets across two availability zones* |
| 107 | +- *Internet Gateway for public subnet connectivity* |
| 108 | +- *NAT Gateway for private subnet outbound access* |
| 109 | +- *Route tables with proper routing configuration* |
| 110 | +- *Subnet associations for correct traffic flow* |
| 111 | + |
| 112 | +**What's included in the plan:** |
| 113 | +1. **VPC Creation**: Main VPC with 10.0.0.0/16 CIDR block |
| 114 | +2. **Public Subnets**: Two subnets (10.0.1.0/24 and 10.0.2.0/24) for internet-facing resources |
| 115 | +3. **Private Subnets**: Two subnets (10.0.11.0/24 and 10.0.12.0/24) for application servers |
| 116 | +4. **Internet Gateway**: For public subnet internet connectivity |
| 117 | +5. **NAT Gateway**: For private subnet outbound internet access |
| 118 | +6. **Route Tables**: Properly configured for public and private traffic patterns |
| 119 | +7. **Subnet Associations**: All subnets associated with correct route tables |
| 120 | + |
| 121 | +### Step 3: Execute and Monitor VPC Creation |
| 122 | + |
| 123 | +Review the plan carefully, then click **"Confirm & Execute"** to start the deployment. The agent will execute each step in the correct order, handling all AWS API calls automatically. |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +*The VPC infrastructure is created successfully. All components including subnets, gateways, and route tables are now ready for the RDS deployment.* |
| 128 | + |
| 129 | +**VPC Creation Results:** |
| 130 | +- Production VPC with proper CIDR allocation |
| 131 | +- High availability across two availability zones |
| 132 | +- Segregated public and private subnets |
| 133 | +- Internet Gateway for public access |
| 134 | +- NAT Gateway for secure outbound connectivity |
| 135 | +- Proper routing configuration |
| 136 | + |
| 137 | +> **Note:** The VPC ID and subnet IDs generated during this step will be automatically referenced by the AI agent when creating the RDS database in the next part. You don't need to manually track these IDs! |
| 138 | +
|
| 139 | +## Part 2: Create the RDS MySQL Database |
| 140 | + |
| 141 | +**Goal:** Deploy a production-ready RDS MySQL 8.0 database with security best practices, encryption, and monitoring enabled. |
| 142 | + |
| 143 | +### Step 1: Enter Your RDS Request |
| 144 | + |
| 145 | +Now that we have a VPC, let's create the RDS database. In the dashboard, enter your database requirements: |
| 146 | + |
| 147 | +``` |
| 148 | +Create an RDS MySQL 8.0 database in a single AZ deployment, incorporating a dedicated security group that allows inbound MySQL traffic, while utilizing the db.t3.medium instance class paired with 100GB GP3 storage, and enabling both encryption at rest and Performance Insights. |
| 149 | +``` |
| 150 | + |
| 151 | +Click **"Process Request"** to generate the RDS deployment plan. |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | +*Enter your RDS creation request. The AI will understand the database specifications, security requirements, and monitoring needs.* |
| 156 | + |
| 157 | +### Step 2: Review the RDS Execution Plan |
| 158 | + |
| 159 | +The AI agent processes your request and generates a comprehensive plan: |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | +*The execution plan includes:* |
| 164 | +- *DB Subnet Group creation spanning multiple availability zones* |
| 165 | +- *Dedicated security group with MySQL port 3306 access rules* |
| 166 | +- *RDS MySQL 8.0 instance with db.t3.medium class* |
| 167 | +- *100GB GP3 storage for optimal performance* |
| 168 | +- *Encryption at rest enabled using AWS KMS* |
| 169 | +- *Performance Insights enabled for monitoring* |
| 170 | +- *Automated backups and maintenance window configuration* |
| 171 | + |
| 172 | +**What's included in the RDS plan:** |
| 173 | +**DB Subnet Group**: Contains the private subnets from Part 1 for database deployment |
| 174 | +2. **Security Group**: Dedicated security group with inbound rule for MySQL (port 3306) |
| 175 | +**RDS Instance**: MySQL 8.0 database with the following specifications: |
| 176 | +- Instance class: `db.t3.medium` |
| 177 | +- Storage: 100GB GP3 (General Purpose SSD) |
| 178 | +- Multi-AZ: Single AZ deployment |
| 179 | +- Encryption: Enabled at rest |
| 180 | +- Performance Insights: Enabled for query monitoring |
| 181 | +- Automated backups: Configured with retention period |
| 182 | +- Master username and password: Automatically generated |
| 183 | + |
| 184 | +### Step 3: Execute and Monitor RDS Creation |
| 185 | + |
| 186 | +Review the comprehensive plan, then click **"Confirm & Execute"** to deploy your RDS database: |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | +*The RDS MySQL database is being created. This process typically takes 10-15 minutes as AWS provisions the database instance, configures storage, sets up encryption, and initializes Performance Insights.* |
| 191 | + |
| 192 | +**RDS Creation Progress:** |
| 193 | +- DB Subnet Group created across availability zones |
| 194 | +- Security group configured with MySQL access |
| 195 | +- RDS instance provisioned with db.t3.medium |
| 196 | +- 100GB GP3 storage allocated and encrypted |
| 197 | +- Performance Insights enabled |
| 198 | +- Automated backups configured |
| 199 | +- Master credentials generated |
| 200 | + |
| 201 | +> **Important:** The RDS creation process can take 10-15 minutes. The AI agent will wait for the database to become available before marking the step as complete. |
| 202 | +
|
| 203 | +### Step 4: Verify in AWS Console |
| 204 | + |
| 205 | +After execution completes, verify the RDS database in the AWS Console: |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | +*Navigate to RDS → Databases in the AWS Console to verify:* |
| 210 | +- *Database is in "Available" status* |
| 211 | +- *Engine version is MySQL 8.0* |
| 212 | +- *Instance class is db.t3.medium* |
| 213 | +- *Storage shows 100GB GP3* |
| 214 | +- *Encryption is enabled* |
| 215 | +- *Performance Insights is active* |
| 216 | +- *Database endpoint is ready for connections* |
| 217 | + |
| 218 | +**What to verify in AWS Console:** |
| 219 | +- Database status: "Available" |
| 220 | +- Engine: MySQL 8.0.x |
| 221 | +- Instance size: db.t3.medium |
| 222 | +- Storage: 100GB GP3 |
| 223 | +- Encryption: Enabled |
| 224 | +- Performance Insights: Active |
| 225 | +- VPC: Deployed in the correct VPC |
| 226 | +- Subnet group: Using the created DB subnet group |
| 227 | +- Security group: Dedicated security group attached |
| 228 | + |
| 229 | +### Step 5: Retrieve Database Credentials |
| 230 | + |
| 231 | +To connect to your RDS database, you'll need the connection details. Check the Infrastructure Resources page in the AI Agent dashboard: |
| 232 | + |
| 233 | +**Connection Information:** |
| 234 | +- **Endpoint**: Find the database endpoint hostname (e.g., `mydb.xxxxxxxxxxxx.region.rds.amazonaws.com`) |
| 235 | +- **Port**: 3306 (MySQL default) |
| 236 | +- **Username**: Check the master username in the database details |
| 237 | +- **Password**: Retrieve from AWS Secrets Manager or the agent's state if stored |
| 238 | + |
| 239 | +> **Security Best Practice:** Store database credentials in AWS Secrets Manager and use IAM authentication for applications. Never hardcode credentials in your application code. |
| 240 | +
|
| 241 | +**Example connection string:** |
| 242 | +```bash |
| 243 | +mysql -h mydb.xxxxxxxxxxxx.ap-southeast-1.rds.amazonaws.com \ |
| 244 | + -P 3306 \ |
| 245 | + -u admin \ |
| 246 | + -p |
| 247 | +``` |
| 248 | + |
| 249 | +## Conclusion |
| 250 | + |
| 251 | +You've successfully used the AI Infrastructure Agent to create a complete RDS MySQL database infrastructure through natural language commands. The agent handled all the complexity of: |
| 252 | + |
| 253 | +- Setting up a production-ready VPC with proper network segmentation |
| 254 | +- Creating DB subnet groups across availability zones |
| 255 | +- Configuring security groups with appropriate access rules |
| 256 | +- Provisioning an RDS MySQL instance with encryption and monitoring |
| 257 | +- Enabling Performance Insights for query optimization |
| 258 | + |
| 259 | +This infrastructure provides a solid foundation for production applications with security, performance, and monitoring best practices built in. The natural language interface makes it easy to create complex infrastructure without needing to remember specific AWS API parameters or manual console steps. |
0 commit comments