あなたのメールから直接AWS S3バケットとファイルを作成、削除、そして整理する

中級

これはFile Management, Multimodal AI分野の自動化ワークフローで、15個のノードを含みます。主にIf, Code, AwsS3, Switch, EmailSendなどのノードを使用。 メールから直接AWS S3バケットとファイルを作成、削除、整理

前提条件
  • AWS Access Key と Secret
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "OO8dBG01EPaQGcVA",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Create, Delete, and Organize AWS S3 Buckets & Files Directly from Your Email",
  "tags": [],
  "nodes": [
    {
      "id": "de49fbb0-5d1b-42ad-b500-beed9e895414",
      "name": "ワークフロー開始 (GETリクエスト)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        0,
        920
      ],
      "parameters": {
        "options": {
          "customEmailConfig": "[\"UNSEEN\", [\"SUBJECT\", \"s3\"]]"
        }
      },
      "credentials": {
        "imap": {
          "id": "zTEGYssr7MSVeCs3",
          "name": "IMAP-test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4ab408d8-416d-4a39-91cd-3e06553c36a1",
      "name": "メールからデータ抽出",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        920
      ],
      "parameters": {
        "jsCode": "const emailBody = $json[\"textPlain\"] || \"\";\n\n// Helper function to match patterns\nfunction matchFirst(patterns) {\n  for (const pattern of patterns) {\n    const match = emailBody.match(pattern);\n    if (match) return match[1];\n  }\n  return null;\n}\n\n// Detect bucket name\nconst bucket = matchFirst([\n  /bucket[:\\s*]*([a-z0-9.-]+)/i,\n  /on bucket\\s+([a-z0-9.-]+)/i\n]);\n\n// Detect file name\nconst fileName = matchFirst([\n  /file[:\\s*]*([^\\s]+)/i,\n  /named\\s+([^\\s]+)/i\n]);\n\n// Detect source file (for copy)\nconst sourceFile = matchFirst([\n  /source\\s+([^\\s]+)/i\n]);\n\n// Detect destination file (for copy)\nconst destFile = matchFirst([\n  /destination\\s+([^\\s]+)/i\n]);\n\n// Decide task type\nlet task_type = null;\nif (/create bucket/i.test(emailBody)) task_type = \"create_bucket\";\nelse if (/delete bucket/i.test(emailBody)) task_type = \"delete_bucket\";\nelse if (/copy file/i.test(emailBody)) task_type = \"copy_file\";\nelse if (/delete file/i.test(emailBody)) task_type = \"delete_file\";\nelse if (/download file/i.test(emailBody)) task_type = \"download_file\";\nelse if (/upload file/i.test(emailBody)) task_type = \"upload_file\";\nelse if (/list files/i.test(emailBody)) task_type = \"get_files\";\n\nreturn [\n  {\n    json: {\n      bucket,\n      fileName,\n      sourceFile,\n      destFile,\n      task_type\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d2926988-4e41-4d5e-84e2-75893ed04565",
      "name": "バケット作成",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        320
      ],
      "parameters": {
        "name": "new-project",
        "resource": "bucket",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1401cf3e-62c1-44db-bca6-29231f3add1e",
      "name": "バケット削除",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        520
      ],
      "parameters": {
        "name": "new-project",
        "resource": "bucket",
        "operation": "delete"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "43d9a1bb-6ad5-4916-91ef-0e9df365d8f4",
      "name": "ファイルコピー",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        720
      ],
      "parameters": {
        "operation": "copy",
        "sourcePath": "/old/old-project-image.jpg",
        "destinationPath": "/new/new-project-image.jpg",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b7af67ad-ba3d-41fe-96fc-3613f332a1fa",
      "name": "ファイルアップロード",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        1320
      ],
      "parameters": {
        "fileName": "/new/new-project-image.jpg",
        "operation": "upload",
        "bucketName": "new-project",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e8290bcc-0816-421d-bea3-e588809d63b9",
      "name": "複数ファイル取得",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        1520
      ],
      "parameters": {
        "options": {},
        "operation": "getAll",
        "bucketName": "={{ $json.bucket }}"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "cd585a21-6073-4a59-a157-943360266ac4",
      "name": "ファイルダウンロード",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        1120
      ],
      "parameters": {
        "fileKey": "/new/new-project-image.jpg",
        "bucketName": "new-project"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "33819696-4b09-45c8-b938-0a929281be26",
      "name": "ファイル削除",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        920
      ],
      "parameters": {
        "fileKey": "/new/new-project-image.jpg",
        "options": {},
        "operation": "delete",
        "bucketName": "new-project-image"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ae71cb97-4e9e-4733-a024-990045bed90f",
      "name": "タスクタイプ確認",
      "type": "n8n-nodes-base.switch",
      "position": [
        440,
        836
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "99e9f0b2-e19b-45c5-a60e-317d772e6291",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "create_bucket"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4e72b4c7-eed9-4039-84c7-773a4dee2eb6",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "delete_bucket"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "aef1b8b8-9175-4819-9cb8-87209e4b2954",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "copy_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a256941b-0882-4ee1-9126-491da78f5fb4",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "delete_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a502de56-2efa-4766-b883-65d8cefaab1a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "download_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "62aae8fd-71f2-4194-af78-b8d42179a2d0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "upload_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e70fb51d-7d2e-4ed2-bdde-7edd03059033",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "get_files"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "a3b10fac-ff46-4aac-9683-949c4c6246c8",
      "name": "失敗メール送信",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1100,
        1020
      ],
      "webhookId": "2c315c54-22bb-49c5-8f74-5f32569b8821",
      "parameters": {
        "text": "=AWS S3 Operation Failed",
        "options": {
          "replyTo": "={{ $('Start Workflow (GET Request)').item.json.from }}"
        },
        "subject": "=AWS S3 Operation Failed",
        "toEmail": "={{ $('Start Workflow (GET Request)').item.json.from }}",
        "fromEmail": "xyz@gmail.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7c01eb42-56e7-431e-ba13-9fa8b88cb84f",
      "name": "成功メール送信",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1100,
        820
      ],
      "webhookId": "2c315c54-22bb-49c5-8f74-5f32569b8821",
      "parameters": {
        "text": "=AWS S3 Operation Successful",
        "options": {
          "replyTo": "={{ $('Start Workflow (GET Request)').item.json.from }}"
        },
        "subject": "=AWS S3 Operation Successful",
        "toEmail": "={{ $('Start Workflow (GET Request)').item.json.from }}",
        "fromEmail": "xyz@gmail.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d79e2096-604a-441b-9697-6e308b3002f5",
      "name": "成功/失敗確認",
      "type": "n8n-nodes-base.if",
      "position": [
        880,
        920
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "045a2b56-33db-45b3-8c14-ad7d0ba64db7",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Key }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "d6872864-93fc-462a-8693-41377e283d37",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        380
      ],
      "parameters": {
        "width": 1000,
        "height": 140,
        "content": "\n## What is this workflow for?\n### This workflow enables the management of AWS S3 buckets and files by processing email commands. It supports creating and deleting buckets, uploading and downloading files, copying files, and listing files, with automated email responses for confirmation or failure."
      },
      "typeVersion": 1
    },
    {
      "id": "c19d98fb-6112-4886-807f-c78f5aead7be",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        760
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 400,
        "content": "## How It Works\n- **Start Workflow (GET Request)** - Captures incoming email requests.\n- **Extract Data from Email** - Parses email content to extract S3 operation commands.\n- **Check Task Type** - Validates the type of task (e.g., create bucket, delete file).\n- **Create a Bucket** - Creates a new S3 bucket.\n- **Delete a Bucket** - Deletes an existing S3 bucket.\n- **Copy a File** - Copies a file within S3.\n- **Delete a File** - Deletes a file from S3.\n- **Download a File** - Downloads a file from S3.\n- **Upload a File** - Uploads a file to S3.\n- **Get Many Files** - Lists multiple files in a bucket.\n- **Check Success or Fail** - Determines the outcome of the operation.\n- **Send Success Email** - Sends a success confirmation email.\n- **Send Failed Email** - Sends a failure notification email."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2bdf2886-f43d-4a91-853c-f40359658edd",
  "connections": {
    "43d9a1bb-6ad5-4916-91ef-0e9df365d8f4": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "33819696-4b09-45c8-b938-0a929281be26": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b7af67ad-ba3d-41fe-96fc-3613f332a1fa": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e8290bcc-0816-421d-bea3-e588809d63b9": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ae71cb97-4e9e-4733-a024-990045bed90f": {
      "main": [
        [
          {
            "node": "d2926988-4e41-4d5e-84e2-75893ed04565",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1401cf3e-62c1-44db-bca6-29231f3add1e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "43d9a1bb-6ad5-4916-91ef-0e9df365d8f4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "33819696-4b09-45c8-b938-0a929281be26",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "cd585a21-6073-4a59-a157-943360266ac4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "b7af67ad-ba3d-41fe-96fc-3613f332a1fa",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e8290bcc-0816-421d-bea3-e588809d63b9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d2926988-4e41-4d5e-84e2-75893ed04565": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1401cf3e-62c1-44db-bca6-29231f3add1e": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cd585a21-6073-4a59-a157-943360266ac4": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d79e2096-604a-441b-9697-6e308b3002f5": {
      "main": [
        [
          {
            "node": "7c01eb42-56e7-431e-ba13-9fa8b88cb84f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a3b10fac-ff46-4aac-9683-949c4c6246c8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4ab408d8-416d-4a39-91cd-3e06553c36a1": {
      "main": [
        [
          {
            "node": "ae71cb97-4e9e-4733-a024-990045bed90f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de49fbb0-5d1b-42ad-b500-beed9e895414": {
      "main": [
        [
          {
            "node": "4ab408d8-416d-4a39-91cd-3e06553c36a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - ファイル管理, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数15
カテゴリー2
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34