user10916892
user10916892

Reputation: 997

AWS - S3 to RDS(postgres) import using aws_s3 extension (provided by RDS) is failing

I have successfully created a role with policy attached to that role which allows required actions on the bucket. Policy document is:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "s3import",
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::my-bucket",
                "arn:aws:s3:::my-bucket/*"
            ]
        }
    ]
}

And then i attached this role to my RDS instance with feature s3Import.

This is the command i ran.

SELECT aws_s3.table_import_from_s3(
   'table name',
   '', 
   'DELIMITER ''|''',
   aws_commons.create_s3_uri(
       'bucket-name',
       'file.csv',
       'region')
);

I am getting this error:

SQL Error [XX000]: ERROR: HTTP 404. Requested file does not exist.

Is anything missing here ?

Upvotes: 2

Views: 2426

Answers (1)

Marcin
Marcin

Reputation: 238051

Based on the comments.

Based on the error message provided, the issue was not due to access deny to S3, but rather due to wrong file name used in create_s3_uri.

The solution was to use the correct file name.

Upvotes: 1

Related Questions