Upload Remote from S3 in Specific AP Region

Options
Giovanna_Schoen
Giovanna_Schoen Member Posts: 1
edited March 13 in Developer APIs

Dear, Cloudinary.

I have simple general bucket in ap-southeast-3 (Jakarta) which I want to migrate the data from. But after several hours of failed attempts, I tried to create a simple private s3 in us-west-1 and setup the required permissions again. This time it was successful. So I doubt, whether my failed attempts were because of the region of the bucket or something else? If that was the case, then how to use the bucket from ap-southeast-3?

Here is my configurations in the ap-southeast-3 one.

  1. Block all public access: ON.
  2. Object Ownership: Bucket owner prefered.
  3. Empty file in .wellknown/cloudinary/<my cloudinary cloud name> [CHECK]
  4. Bucket policy:
{

  "Version": "2012-10-17",

  "Id": "PolicyForCloudFrontPrivateContent",

  "Statement": [

    {

      "Sid": "AllowCloudFrontServicePrincipal",

      "Effect": "Allow",

      "Principal": {

        "Service": "cloudfront.amazonaws.com"

      },

      "Action": "s3:GetObject",

      "Resource": "arn:aws:s3:::vidsphere-minimal/*",

      "Condition": {

        "StringEquals": {

          "AWS:SourceArn": #something-something

        }

      }

    },

    {

      "Sid": "AWSConsoleStmt-vidsphere-minimal-cloudinary",

      "Effect": "Allow",

      "Principal": {

        "AWS": "arn:aws:iam::232482882421:root"

      },

      "Action": "s3:GetObject",

      "Resource": "arn:aws:s3:::vidsphere-minimal/*"

    }

  ]

}

Tested with the sdk like such:

import cloudinary from "./configured-cloudinary";
const bucketName = process.env.AWS_BUCKET_NAME;

test("upload", async () => {
  const key = "flower.jpg";
  const target = `s3://${bucketName}/${key}`;
  const result = await cloudinary.uploader.upload(target);
  return expect(result).toBeTruthy();
})

// test result:
FAIL: cloudinary.test.ts
Test upload
x upload

"You can't directly access the requested s3 bucket. For more information: https://cloudinary.com/documentation/upload_images#upload_from_a_private_storage_url"


Tagged:

Answers

  • Tom
    Tom Member, Cloudinary Staff Posts: 66
    Options

    Hey @Giovanna_Schoen ,

    Thanks for reaching out.

    I'm checking this for you and will get back soon.

    Kind Regards,

    Thomas

  • Tamara
    Tamara Member, Cloudinary Staff Posts: 100
    Options

    Hi @Giovanna_Schoen ,

    That should be ok now. Can you please try and let me know if everything works okay for you now?

    Thank you for your patience. 

    Best,

    Tamara