This workflow corresponds to n8n.io template #7485 — we link there as the canonical source.
This workflow follows the Agent → OpenAI Chat 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 →
{
"id": "hA8TizePEKZNGeee",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Automating AWS S3 Operations with n8n: Buckets, Folders, and Files",
"tags": [],
"nodes": [
{
"id": "8839c349-fde5-4fef-9b73-e337e47c0deb",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1424,
240
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "94dd22ea-6cf3-4c7f-9b20-a9b11680ec1d",
"name": "Generate an image",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1728,
16
],
"parameters": {
"prompt": "={{ $json.output }}",
"options": {},
"resource": "image"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "7108a3aa-a2d5-4167-9c16-5201c0fe11d1",
"name": "Upload a file",
"type": "n8n-nodes-base.awsS3",
"position": [
2224,
16
],
"parameters": {
"fileName": "={{ $('Edit Fields').item.json.folder_name }}/image_{{ $now.format('yyyy-MM-dd') }}.{{ $json.fileExtension }}",
"operation": "upload",
"bucketName": "=bucket{{ $workflow.id }}",
"additionalFields": {}
},
"credentials": {
"aws": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "548ec1cf-53dc-4df0-b2f4-9c17d795af4c",
"name": "Prompt Generation Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1328,
16
],
"parameters": {
"text": "=You're prompt generator agent, you will create prompt for the open-ai image generation model with a random topic among:\n- Education\n- Science \n- Sport\n- Economy\n- Health\nOutput the prompt only, nothing else",
"options": {},
"promptType": "define"
},
"typeVersion": 2.1
},
{
"id": "0c16a07e-9892-442c-840a-abc9201c8b85",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-320,
16
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a1cabec4-957e-4954-aae9-ea54103fc379",
"name": "Create AWS S3 Bucket",
"type": "n8n-nodes-base.awsS3",
"onError": "continueRegularOutput",
"position": [
736,
16
],
"parameters": {
"name": "=bucket{{ $workflow.id }}",
"resource": "bucket",
"additionalFields": {
"region": "={{ $('Edit Fields').item.json.aws_region }}"
}
},
"credentials": {
"aws": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "96a3f0bc-468a-42e2-b07f-0d57636c9b5a",
"name": "Create a folder",
"type": "n8n-nodes-base.awsS3",
"position": [
1104,
16
],
"parameters": {
"resource": "folder",
"bucketName": "=bucket{{ $workflow.id }}",
"folderName": "={{ $('Edit Fields').item.json.folder_name }}",
"additionalFields": {}
},
"credentials": {
"aws": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "7e6da7e5-721f-4979-9101-c477d6a9b9cf",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
96,
16
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "af3e6c69-fbfe-49f4-9c29-3a68a821c5a6",
"name": "aws_region",
"type": "string",
"value": "ap-southeast-1"
},
{
"id": "1a693ae0-2ba0-4b1b-a00a-4399a8d3ab57",
"name": "folder_name",
"type": "string",
"value": "my_s3_folder"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a962b9e3-a7f0-4fa9-9d79-3726d5f4d2b9",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1264,
-480
],
"parameters": {
"width": 816,
"height": 1280,
"content": "# Automating AWS S3 Operations with n8n: Buckets, Folders, and Files\n\nThis tutorial walks you through setting up an automated workflow that **generates AI-powered images** from prompts and securely stores them in **AWS S3**. It leverages the new **AI Tool Node** and OpenAI models for prompt-to-image generation. \n\n## **Who\u2019s it for**\nThis workflow is ideal for:\n- **Designers & marketers** who need quick, on-demand AI-generated visuals. \n- **Developers & automation builders** exploring **AI-driven workflows** integrated with cloud storage. \n- **Educators or trainers** creating tutorials or exercises on AI image generation. \n- **Businesses** looking to automate **image content pipelines** with AWS S3 storage. \n\n## **How it works / What it does**\n1. **Trigger**: The workflow starts manually when you click **\u201cExecute Workflow\u201d**. \n2. **Edit Fields**: You can provide input fields such as image description, resolution, or naming convention. \n3. **Create AWS S3 Bucket**: Automatically creates a new **S3 bucket** if it doesn\u2019t exist. \n4. **Create a Folder**: Inside the bucket, a folder is created to organize generated images. \n5. **Prompt Generation Agent**: An AI agent generates or refines the image prompt using the **OpenAI Chat Model**. \n6. **Generate an Image**: The refined prompt is used to generate an image using AI. \n7. **Upload File to S3**: The generated image is uploaded to the AWS S3 bucket for secure storage. \n\nThis workflow showcases how to combine **AI + Cloud Storage** seamlessly in an automated pipeline. \n\n## **How to set up**\n1. **Import the workflow** into **n8n**. \n2. Configure the following credentials: \n - **AWS S3** (Access Key, Secret Key, Region). \n - **OpenAI API Key** (for Chat + Image models). \n3. Update the **Edit Fields node** with your preferred input fields (e.g., image size, description). \n4. Execute the workflow and test by entering a sample image prompt (e.g., *\u201cFuturistic city skyline in watercolor style\u201d*). \n5. Check your AWS S3 bucket to verify the uploaded image. \n\n## **Requirements**\n- **n8n** (latest version with AI Tool Node support). \n- **AWS account** with S3 permissions to create buckets and upload files. \n- **OpenAI API key** (for prompt refinement and image generation). \n- Basic familiarity with **AWS S3 structure** (buckets, folders, objects). \n\n## **How to customize the workflow**\n- **Custom Buckets**: Replace the auto-create step with an existing S3 bucket. \n- **Image Variations**: Generate multiple image variations per prompt by looping the image generation step. \n- **File Naming**: Adjust file naming conventions (e.g., timestamp, user input). \n- **Metadata**: Add metadata such as tags, categories, or owner info when uploading to S3. \n- **Alternative Storage**: Swap AWS S3 with **Google Cloud Storage, Azure Blob, or Dropbox**. \n- **Trigger Options**: Replace manual trigger with **Webhook, Form Submission, or Scheduler** for automation. \n\n\u2705 This workflow is a **hands-on example** of how to combine **AI prompt engineering, image generation, and cloud storage automation** into a single streamlined process. "
},
"typeVersion": 1
},
{
"id": "9bbf079c-2987-484a-886c-9b0884e5049c",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-368,
-272
],
"parameters": {
"color": 4,
"width": 448,
"height": 192,
"content": "## Step 1: Trigger Workflow\n- The workflow begins when you **click \u201cExecute Workflow\u201d** in n8n. \n- This is a manual trigger, giving you control over when to generate images. \n\ud83d\udc49 You can later replace this with a **Webhook** or **Scheduler** if you want automation."
},
"typeVersion": 1
},
{
"id": "e181e6ad-0c22-414d-aefb-6fdc6811db21",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
208
],
"parameters": {
"color": 4,
"width": 448,
"height": 272,
"content": "## Step 2: Edit Fields\n- This node allows you to **manually provide input fields** for the workflow. \n- Typical inputs include: \n - **Image Description** (e.g., *\u201cA futuristic city skyline in watercolor style\u201d*) \n - **Image Size** (e.g., 512x512, 1024x1024) \n - **Folder Name** (to organize images in S3) \n\n\ud83d\udc49 Customize these fields to fit your use case (e.g., campaign name, project ID). \n"
},
"typeVersion": 1
},
{
"id": "2263ecde-5632-4a67-ab9b-bad883b0215e",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
-288
],
"parameters": {
"color": 4,
"width": 432,
"height": 224,
"content": "## Step 3: Create AWS S3 Bucket\n- The workflow will create a new **AWS S3 bucket** to store your images. \n- If the bucket already exists, it will skip this step. \n- Recommended format: `ai-images-demo-[yourname]`. \n\n\ud83d\udc49 Make sure your AWS credentials in n8n have **permission to create buckets**. "
},
"typeVersion": 1
},
{
"id": "9a1b2396-a262-4540-85d7-11576ce70d0f",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
288
],
"parameters": {
"color": 4,
"width": 432,
"content": "## Step 4: Create a Folder\n- Inside your S3 bucket, a **folder** (sometimes called a \u201cprefix\u201d) is created. \n- This helps keep images organized (e.g., by project, user, or campaign). \n- Example: `ai-images/marketing/` \n\n\ud83d\udc49 You can also dynamically name folders using values from the **Edit Fields** step. "
},
"typeVersion": 1
},
{
"id": "41197544-3daa-4d41-9152-8887f59d4894",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
992,
-288
],
"parameters": {
"color": 4,
"width": 544,
"height": 208,
"content": "## Step 5: Prompt Generation Agent\n- This node uses the **OpenAI Chat Model** to **refine your prompt** before generating the image. \n- Example: If you enter *\u201cdog in a park\u201d*, the agent might expand it to: \n *\u201cA realistic illustration of a golden retriever running in a lush green park, morning sunlight, 4K resolution.\u201d* \n\n\ud83d\udc49 This ensures better and more consistent image quality. "
},
"typeVersion": 1
},
{
"id": "f6cc0eca-f4e1-41b0-ab62-fda3bedc074c",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1424,
224
],
"parameters": {
"color": 4,
"width": 544,
"height": 240,
"content": "## Step 6: Generate an Image\n- Using the refined prompt, the **OpenAI Image Generation model** creates an image. \n- You can define: \n - Resolution (512px, 1024px, etc.) \n - Style (realistic, watercolor, anime, etc.) \n- Output will be a **PNG or JPEG file**. \n\n\ud83d\udc49 You can generate multiple variations by looping this step. "
},
"typeVersion": 1
},
{
"id": "da9e8e07-bb47-4270-b0af-16e2e3dabd29",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1808,
-272
],
"parameters": {
"color": 4,
"width": 560,
"height": 208,
"content": "## Step 7: Upload File to AWS S3\n- The generated image is uploaded into your S3 bucket and folder. \n- The file is given a unique name (e.g., `image_2025-08-17_12-30.png`). \n- Once uploaded, you can: \n - Share the S3 file link \n - Use it in your applications or websites \n\n\ud83d\udc49 Make sure your bucket allows the right access policy (public or private). "
},
"typeVersion": 1
},
{
"id": "967a41d5-1d28-4ff8-93f5-aff3b6cdeb38",
"name": "Delete a folder",
"type": "n8n-nodes-base.awsS3",
"disabled": true,
"position": [
752,
-464
],
"parameters": {
"resource": "folder",
"folderKey": "={{ $('Edit Fields').item.json.folder_name }}",
"operation": "delete",
"bucketName": "=bucket{{ $workflow.id }}"
},
"credentials": {
"aws": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "3aa92356-4bf3-4039-b431-ffc9e28deef9",
"name": "Delete uploaded image",
"type": "n8n-nodes-base.awsS3",
"disabled": true,
"position": [
304,
-464
],
"parameters": {
"fileKey": "={{ $('Edit Fields').item.json.folder_name }}/image_{{ $now.format('yyyy-MM-dd') }}.png",
"options": {},
"operation": "delete",
"bucketName": "=bucket{{ $workflow.id }}"
},
"credentials": {
"aws": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "7ab94a69-9ca2-4ee0-8db9-db2037fe087a",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-800
],
"parameters": {
"width": 496,
"height": 288,
"content": "## Step 8: Delete an Object\n- This step lets you **remove a specific file (object) from your S3 bucket**. \n- Typical use cases: \n - Replacing outdated images. \n - Cleaning up test runs. \n- Input required: \n - **Bucket Name** (where the file is stored) \n - **Object Key** (file path, e.g., `ai-images/marketing/image_2025-08-17_12-30.png`) \n\n\ud83d\udc49 Be careful: this action is permanent and cannot be undone. \n"
},
"typeVersion": 1
},
{
"id": "74d397eb-4f59-4709-8fd2-650b5a67f0f5",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-816
],
"parameters": {
"width": 496,
"height": 304,
"content": "## Step 9: Delete a Folder\n- This step allows you to **delete an entire folder (prefix) in S3**. \n- It will remove all objects inside that folder. \n- Typical use cases: \n - Clearing old project assets. \n - Cleaning up after workflow tests. \n- Input required: \n - **Bucket Name** \n - **Folder Path** (e.g., `ai-images/marketing/`) \n\n\ud83d\udc49 Note: AWS S3 doesn\u2019t have real folders\u2014just prefixes. Deleting a folder means removing **all objects with that prefix**. "
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "903b5b9d-560c-40db-83dc-ac2acd5a3cf3",
"connections": {
"Edit Fields": {
"main": [
[
{
"node": "Create AWS S3 Bucket",
"type": "main",
"index": 0
},
{
"node": "Delete uploaded image",
"type": "main",
"index": 0
}
]
]
},
"Upload a file": {
"main": [
[]
]
},
"Create a folder": {
"main": [
[
{
"node": "Prompt Generation Agent",
"type": "main",
"index": 0
}
]
]
},
"Generate an image": {
"main": [
[
{
"node": "Upload a file",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Prompt Generation Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Create AWS S3 Bucket": {
"main": [
[
{
"node": "Create a folder",
"type": "main",
"index": 0
}
]
]
},
"Delete uploaded image": {
"main": [
[
{
"node": "Delete a folder",
"type": "main",
"index": 0
}
]
]
},
"Prompt Generation Agent": {
"main": [
[
{
"node": "Generate an image",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Edit Fields",
"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.
awsopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
[](https://www.youtube.com/watch?v=el0dDJ4Ah3k) This tutorial walks you through setting up an automated workflow that generates AI-powered images from prompts and securely stores them in AWS S3. It leverages the new AI Tool Node and OpenAI models for prompt-to-image generation.
Source: https://n8n.io/workflows/7485/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.
BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
The best content automation template in the market is now even better—with “deep research” on time-sensitive topics\! Unlike most n8n content automation templates that are mainly for “demo purposes,”
Digital marketers, content creators, social media managers, and businesses who want to use AI marketing automation for YouTube Shorts without spending hours on production. This AI workflow helps anyon