AutomationFlowsEmail & Gmail › Create & Delete AWS Rds Databases via Email Commands with Terraform

Create & Delete AWS Rds Databases via Email Commands with Terraform

ByOneclick AI Squad @oneclick-ai on n8n.io

This automated n8n workflow enables the creation and management of AWS RDS databases through email interactions. Users can send emails with commands such as "Create RDS" or "Delete RDS," including details like database engine, instance class, and credentials. The workflow parses…

Manual trigger★★★★☆ complexity8 nodesGmailSshGoogle Sheets
Email & Gmail Trigger: Manual Nodes: 8 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #7294 — we link there as the canonical source.

This workflow follows the Gmail → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "RkDlxaIfbpwgxyDO",
  "name": "Automate Create and Delete AWS RDS Databases with Email",
  "tags": [],
  "nodes": [
    {
      "id": "4d5c0f8a-53b6-4032-abda-0a9ccf35f38d",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1160,
        60
      ],
      "parameters": {
        "color": 4,
        "width": 420,
        "height": 360,
        "content": "## \ud83d\ude80 AWS RDS Database Manager\n\n### Features:\n\u2022 Monitors Gmail for 'Create RDS' or 'Delete RDS' email requests\n\u2022 Extracts database details from emails\n\u2022 Creates or deletes RDS instances via AWS API using Terraform\n\u2022 Updates status in Google Sheets\n\u2022 Sends confirmation emails\n\u2022 Error handling with notifications\n\u2022 Triggered by email arrival\n\n### Trigger: Gmail email receipt"
      },
      "typeVersion": 1
    },
    {
      "id": "56cf5386-1289-4749-97de-cb854afb1c3c",
      "name": "Terraform Vars",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        120
      ],
      "parameters": {
        "color": 6,
        "width": 460,
        "height": 260,
        "content": "\n### **`terraform.tfvars`** (example values)\n\n```hcl\naws_region       = \"us-east-1\"\ndb_identifier    = \"my-rds-instance\"\ndb_engine        = \"mysql\"\ninstance_class   = \"db.t3.micro\"\nallocated_storage = 20\ndb_username      = \"admin\"\ndb_password      = \"securepassword123\"\ndb_name          = \"MyRDSDatabase\"\n```\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "397dce95-bdb4-4570-90a5-41b58cd2071d",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmail",
      "position": [
        740,
        500
      ],
      "parameters": {
        "operation": "trigger"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b904b90e-6495-4c19-a28b-afc37b3e0c1a",
      "name": "Parse Email Content",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        500
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "f5be0da2-a40b-42a0-837d-4bcb1e4176da",
      "name": "Manage RDS Instance",
      "type": "n8n-nodes-base.ssh",
      "position": [
        1180,
        500
      ],
      "parameters": {
        "command": "=$json.operation === 'create' ?\n`# Variables\nSERVER_USER=\"{{ $json.server_user }}\"\nSERVER_IP=\"{{ $json.server_ip }}\"\nWORKSPACE_NAME=\"{{ $json.db_identifier }}\"\nPWD=\"{{ $json.pwd }}\"\n\n# SSH and run Terraform commands\necho \"$PWD\" | ssh ${SERVER_USER}@${SERVER_IP} \"\n    cd /path/to/terraform/project &&\n    terraform workspace new ${WORKSPACE_NAME} || terraform workspace select ${WORKSPACE_NAME} &&\n    terraform init &&\n    terraform plan -out=tfplan &&\n    terraform apply -auto-approve tfplan\n\"` :\n`# Variables\nSERVER_USER=\"{{ $json.server_user }}\"\nSERVER_IP=\"{{ $json.server_ip }}\"\nWORKSPACE_NAME=\"{{ $json.db_identifier }}\"\nPWD=\"{{ $json.pwd }}\"\n\n# SSH and run Terraform destroy\necho \"$PWD\" | ssh ${SERVER_USER}@${SERVER_IP} \"\n    cd /path/to/terraform/project &&\n    terraform workspace select ${WORKSPACE_NAME} &&\n    terraform destroy -auto-approve\n\"`",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2ca5d24d-3476-44db-a935-b359eef7d5f7",
      "name": "Update Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1400,
        500
      ],
      "parameters": {
        "columns": {
          "value": {
            "region": "={{ $json.region }}",
            "db_name": "={{ $json.db_name }}",
            "endpoint": "={{ $json.endpoint || 'N/A' }}",
            "db_engine": "={{ $json.db_engine }}",
            "operation": "={{ $json.operation }}",
            "timestamp": "={{ $now.toISO() }}",
            "db_identifier": "={{ $json.db_identifier }}",
            "instance_class": "={{ $json.instance_class }}",
            "requester_email": "={{ $json.requester_email }}",
            "operation_status": "={{ $json.operation_status || 'Completed' }}",
            "allocated_storage": "={{ $json.allocated_storage }}"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "displayName": "Timestamp",
              "canBeUsedToMatch": true
            },
            {
              "id": "operation",
              "type": "string",
              "displayName": "Operation",
              "canBeUsedToMatch": true
            },
            {
              "id": "db_identifier",
              "type": "string",
              "displayName": "DB Identifier",
              "canBeUsedToMatch": true
            },
            {
              "id": "db_name",
              "type": "string",
              "displayName": "DB Name",
              "canBeUsedToMatch": true
            },
            {
              "id": "db_engine",
              "type": "string",
              "displayName": "DB Engine",
              "canBeUsedToMatch": true
            },
            {
              "id": "instance_class",
              "type": "string",
              "displayName": "Instance Class",
              "canBeUsedToMatch": true
            },
            {
              "id": "allocated_storage",
              "type": "number",
              "displayName": "Allocated Storage",
              "canBeUsedToMatch": true
            },
            {
              "id": "region",
              "type": "string",
              "displayName": "Region",
              "canBeUsedToMatch": true
            },
            {
              "id": "endpoint",
              "type": "string",
              "displayName": "Endpoint",
              "canBeUsedToMatch": true
            },
            {
              "id": "operation_status",
              "type": "string",
              "displayName": "Operation Status",
              "canBeUsedToMatch": true
            },
            {
              "id": "requester_email",
              "type": "string",
              "displayName": "Requester Email",
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "RDS_Operations",
          "cachedResultName": "RDS Operations"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_RDS_SHEET_ID",
          "cachedResultName": "RDS Operations"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2948754e-620d-457f-80fc-8568a27782f2",
      "name": "Send Confirmation Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1620,
        500
      ],
      "parameters": {
        "sendTo": "={{ $json.requester_email }}",
        "message": "=$json.operation === 'create' ?\n`<h2>\ud83d\ude80 RDS Database Creation Confirmation</h2><br><br><strong>Great news!</strong> Your RDS database has been created successfully.<br><br><div style=\"background-color: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 4px solid #28a745;\"><h3>\ud83d\udccb Database Details</h3><p><strong>DB Name:</strong> {{ $json.db_name }}<br><strong>DB Identifier:</strong> <code>{{ $json.db_identifier }}</code><br><strong>DB Engine:</strong> {{ $json.db_engine }}<br><strong>Instance Class:</strong> {{ $json.instance_class }}<br><strong>Allocated Storage:</strong> {{ $json.allocated_storage }} GB<br><strong>Region:</strong> {{ $json.region }}<br><strong>Endpoint:</strong> {{ $json.endpoint || 'Not available yet' }}</p></div><br><div style=\"background-color: #ffebee; padding: 15px; border-radius: 8px; border: 1px solid #f44336;\"><h4>\u26a0\ufe0f Important Notes</h4><ul><li>It may take a few minutes for the database to be fully available</li><li>Secure your credentials: <code>{{ $json.db_username }}/{{ $json.db_password }}</code></li><li>Remember to delete the database when no longer needed to avoid charges</li></ul></div><br><h3>\ud83d\udd17 AWS Console Link</h3><p><a href=\"https://{{ $json.region }}.console.aws.amazon.com/rds/home?region={{ $json.region }}#database:id={{ $json.db_identifier }}\" style=\"background-color: #007bff; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;\">View in AWS Console</a></p><br><p>If you have any questions, please contact the infrastructure team.</p><br><p><em>This database was created automatically via n8n workflow.</em></p>` :\n`<h2>\ud83d\uddd1\ufe0f RDS Database Deletion Confirmation</h2><br><br><strong>Success!</strong> Your RDS database has been deleted.<br><br><div style=\"background-color: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 4px solid #dc3545;\"><h3>\ud83d\udccb Database Details</h3><p><strong>DB Name:</strong> {{ $json.db_name }}<br><strong>DB Identifier:</strong> <code>{{ $json.db_identifier }}</code><br><strong>Region:</strong> {{ $json.region }}</p></div><br><p>If you have any questions, please contact the infrastructure team.</p><br><p><em>This database was deleted automatically via n8n workflow.</em></p>`",
        "options": {
          "ccList": "user@example.com"
        },
        "subject": "={{ $json.operation === 'create' ? '\u2705 AWS RDS Database Created Successfully - ' + $json.db_name : '\ud83d\uddd1\ufe0f AWS RDS Database Deleted Successfully - ' + $json.db_name }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "54738eab-47eb-4177-bd57-713c80d9e465",
      "name": "Terraform Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 1480,
        "content": "### **`main.tf`**\n\n```hcl\n# Configure AWS provider\nprovider \"aws\" {\n  region  = var.aws_region\n  profile = var.aws_profile\n}\n\n# Create RDS instance\nresource \"aws_db_instance\" \"example\" {\n  identifier           = var.db_identifier\n  engine               = var.db_engine\n  instance_class       = var.instance_class\n  allocated_storage    = var.allocated_storage\n  username             = var.db_username\n  password             = var.db_password\n  skip_final_snapshot  = true\n\n  tags = {\n    Name = var.db_name\n  }\n}\n\n# Output RDS endpoint\noutput \"rds_endpoint\" {\n  value = aws_db_instance.example.endpoint\n}\n```\n\n---\n\n### **`variables.tf`**\n\n```hcl\nvariable \"aws_region\" {\n  description = \"AWS region to deploy in\"\n  type        = string\n}\n\nvariable \"aws_profile\" {\n  description = \"AWS CLI profile to use\"\n  type        = string\n  default     = \"default\"\n}\n\nvariable \"db_identifier\" {\n  description = \"RDS database identifier\"\n  type        = string\n}\n\nvariable \"db_engine\" {\n  description = \"Database engine (e.g., mysql, postgres)\"\n  type        = string\n}\n\nvariable \"instance_class\" {\n  description = \"RDS instance class\"\n  type        = string\n  default     = \"db.t3.micro\"\n}\n\nvariable \"allocated_storage\" {\n  description = \"Storage size in GB\"\n  type        = number\n  default     = 20\n}\n\nvariable \"db_username\" {\n  description = \"Database admin username\"\n  type        = string\n}\n\nvariable \"db_password\" {\n  description = \"Database admin password\"\n  type        = string\n  sensitive   = true\n}\n\nvariable \"db_name\" {\n  description = \"RDS database Name tag\"\n  type        = string\n}\n```\n\n---\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "dfa9a87a-d049-4fe3-9151-954bf1d37081",
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Parse Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manage RDS Instance": {
      "main": [
        [
          {
            "node": "Update Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Email Content": {
      "main": [
        [
          {
            "node": "Manage RDS Instance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Sheet": {
      "main": [
        [
          {
            "node": "Send Confirmation Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This automated n8n workflow enables the creation and management of AWS RDS databases through email interactions. Users can send emails with commands such as "Create RDS" or "Delete RDS," including details like database engine, instance class, and credentials. The workflow parses…

Source: https://n8n.io/workflows/7294/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

Move Data Between Json And Spreadsheets. Uses httpRequest, googleSheets, spreadsheetFile, writeBinaryFile. Manual trigger; 14 nodes.

HTTP Request, Google Sheets, Spreadsheet File +3
Email & Gmail

Achieve a high-security, compliant payroll distribution system by using this automation to encrypt sensitive documents and manage delivery failures. This workflow provides an enterprise-grade solution

Google Drive, Google Sheets, N8N Nodes Htmlcsstopdf +2
Email & Gmail

This automated n8n workflow enables launching AWS EC2 instances directly from a Google Sheets document. Users can specify instance details (e.g., region, instance type, key pair) in a Google Sheet, tr

Google Sheets, Ssh, Gmail
Email & Gmail

Automate WhatsApp communication for recruitment agencies with an interactive, structured customer experience. This workflow handles pricing inquiries, request submissions, tracking, complaints, and hu

HTTP Request, Google Sheets, Gmail +1
Email & Gmail

Loan eligibility workflow. Uses formTrigger, googleSheets, gmail. Event-driven trigger; 53 nodes.

Form Trigger, Google Sheets, Gmail