Complete guide to set up AWS S3 credentials in n8n for file storage and automation workflows คู่มือการตั้งค่า AWS S3 สำหรับ n8n เพื่อจัดเก็บไฟล์และระบบอัตโนมัติ
Overview: This guide covers the complete process: Create AWS account → Secure it → Create IAM user + keys → Create S3 bucket → Add least-privilege policy → Wire keys into n8n → Test upload. ภาพรวม: คู่มือนี้ครอบคลุมกระบวนการทั้งหมด: สร้างบัญชี AWS → รักษาความปลอดภัย → สร้าง IAM user + keys → สร้าง S3 bucket → เพิ่ม policy ขั้นต่ำ → เชื่อมต่อกับ n8n → ทดสอบการอัปโหลด
1
Create and Secure the AWS Accountสร้างและรักษาความปลอดภัยบัญชี AWS
Go to aws.amazon.com and Create an AWS account ไปที่ aws.amazon.com และสร้างบัญชี AWS
Verify email, add credit card, choose Basic support ยืนยันอีเมล เพิ่มบัตรเครดิต เลือก Basic support
Sign in as Root user once เข้าสู่ระบบในฐานะ Root user หนึ่งครั้ง
Turn on MFA for root: IAM → Users → Security recommendations → "Enable MFA for root" เปิด MFA สำหรับ root: IAM → Users → Security recommendations → "Enable MFA for root"
2
Create an IAM User for n8n and Its Access Keyสร้าง IAM User สำหรับ n8n และ Access Key
Open IAM → Users → Create user เปิด IAM → Users → Create user
Name: n8n-s3-uploader. No console access needed. Create user ชื่อ: n8n-s3-uploader ไม่ต้องการ console access สร้าง user
Open the new user → Permissions → Add permissions → Attach policies directly → click Create policy (we'll add a tight policy in step 4) เปิด user ใหม่ → Permissions → Add permissions → Attach policies directly → คลิก Create policy (เราจะเพิ่ม policy ในขั้นตอนที่ 4)
Open the user → Security credentials → Create access key → use "Application running outside AWS" เปิด user → Security credentials → Create access key → ใช้ "Application running outside AWS"
Copy Access key ID and Secret access key. Store securely. You will need both in n8n คัดลอก Access key ID และ Secret access key เก็บไว้อย่างปลอดภัย จะต้องใช้ทั้งคู่ใน n8n
Important: Save your Access Key ID and Secret Access Key immediately. AWS will not show the secret key again after this step. สำคัญ: บันทึก Access Key ID และ Secret Access Key ทันที AWS จะไม่แสดง secret key อีกครั้งหลังจากขั้นตอนนี้
3
Create the S3 Bucketสร้าง S3 Bucket
Bucket Name Generator / เครื่องมือสร้างชื่อ Bucket
Enter project name to generate
S3 → Create bucket S3 → Create bucket
Bucket name: global unique, e.g. yourproject-assets-prod (use generator above) ชื่อ Bucket: ต้องไม่ซ้ำทั่วโลก เช่น yourproject-assets-prod (ใช้เครื่องมือสร้างข้างบน)
Keep Block all public access ON for private buckets เก็บ Block all public access เปิดไว้ สำหรับ bucket ส่วนตัว
Create bucket สร้าง bucket
4
Grant Least-Privilege Permissions to That Userกำหนดสิทธิ์ขั้นต่ำให้กับ User
Create a policy that allows only this bucket. Replace the bucket name everywhere. สร้าง policy ที่อนุญาตเฉพาะ bucket นี้เท่านั้น แทนที่ชื่อ bucket ทุกที่
IAM → Policies → Create policy → JSON IAM → Policies → Create policy → JSON
If you plan to set ACL: public-read from n8n, also add: หากคุณวางแผนที่จะตั้ง ACL: public-read จาก n8n ให้เพิ่ม: { "Effect": "Allow", "Action": ["s3:PutObjectAcl"], "Resource": "arn:aws:s3:::yourproject-assets-prod/*" }
Save as n8n-s3-uploader-policy, then Attach it to the n8n-s3-uploader user. บันทึกเป็น n8n-s3-uploader-policy แล้วแนบกับ n8n-s3-uploader user
5
Create AWS Credentials in n8nสร้าง AWS Credentials ใน n8n
In n8n: Credentials → New ใน n8n: Credentials → New
Add another AWS S3 node with Operation: Get Presigned URL. Set an expiry (e.g. 3600 seconds). Use that URL to view the file. เพิ่ม AWS S3 node อีกตัวด้วย Operation: Get Presigned URL ตั้งเวลาหมดอายุ (เช่น 3600 วินาที) ใช้ URL นั้นเพื่อดูไฟล์
Public Access (Not Recommended for Most Cases) / การเข้าถึงสาธารณะ (ไม่แนะนำในกรณีส่วนใหญ่):
Turn off Block public access at the bucket, add a bucket policy to allow reads, and/or upload with ACL: public-read. Example bucket policy: ปิด Block public access ที่ bucket เพิ่ม bucket policy เพื่ออนุญาตการอ่าน และ/หรือ อัปโหลดด้วย ACL: public-read ตัวอย่าง bucket policy: