You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用aws_s3扩展从S3导入数据到RDS PostgreSQL失败求助

Troubleshooting RDS S3 Import HTTP 404 Error (Requested file does not exist)

Let’s break down the most likely issues causing this 404 error—more often than not, it’s rooted in small mismatches or overlooked configuration details rather than a major setup failure:

  • Double-check your S3 path and filename accuracy
    S3 object names are case-sensitive, so file.csv and File.csv are treated as entirely different objects. If your file lives in a subfolder (like data/imports/file.csv), you need to include that full path in the aws_commons.create_s3_uri call—not just file.csv. Also make sure the bucket-name parameter exactly matches your actual S3 bucket name (S3 bucket names are strictly lowercase, so no typos there).

  • Verify your IAM policy’s resource matches the target bucket
    Your policy specifies resources for arn:aws:s3:::my-bucket and arn:aws:s3:::my-bucket/*—so your command’s bucket-name must be my-bucket (not a placeholder or misspelled name). If your actual bucket has a different name, update either the policy or the command to align them perfectly.

  • Ensure RDS and S3 are in the same region
    The region parameter in aws_commons.create_s3_uri needs to match your S3 bucket’s exact region (e.g., us-east-1, not an availability zone like us-east-1a). Cross-region imports can work but require extra steps, so start with matching regions to eliminate this variable.

  • Confirm the S3 object actually exists
    Run a quick check with the AWS CLI to validate the file is present:

    aws s3 ls s3://your-bucket-name/file.csv --region your-region
    

    Or navigate directly to the S3 console to confirm the file’s path and name are exactly what you’re using in the import command.

  • Validate the IAM role’s trust policy
    You’ve attached the correct permission policy, but does the role trust the RDS service to assume it? The trust policy should look like this:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Service": "rds.amazonaws.com"
          },
          "Action": "sts:AssumeRole"
        }
      ]
    }
    

    Without this, RDS can’t use the role to access S3, which might manifest as a 404 error (even though the core issue is permission-related, not file existence).

  • Recheck that the S3 Import feature is active on your RDS instance
    Head to the RDS console, select your instance, and check the "Features" tab to confirm s3Import is enabled and in an "Available" state. Sometimes enabling the feature requires a brief instance restart to take full effect, so if you just turned it on, give that a try.

Start with the first three checks—they’re the most common culprits for this error. Once you’ve ruled those out, move on to the permission and configuration validations.

内容的提问来源于stack exchange,提问作者user10916892

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:27:59