Search code examples
iosobjective-camazon-s3amazon-cloudfront

Upload content to S3 through CloudFront


I'm working on an app which requires to upload images to S3. Now I am doing like this:

S3PutObjectRequest *por = [[S3PutObjectRequest alloc] initWithKey:nameOfThePicture inBucket:nameOfTheBucket];
    por.contentType = @"image/jpg";
    por.data        = imageData;

    // Put the image data into the specified s3 bucket and object.
    S3PutObjectResponse *putObjectResponse = [self.s3 putObject:por];
    por.delegate = self;

Uploading an image directly to S3 is too slow and I have configured the CloudFront service. Now, I'd like to upload an image through CloudFront to the origin bucket in S3. Is possible to do it? If yes, how could I do it?

Really thanks,

Victor


Solution

  • No. CloudFront is a one-way affair — you can retrieve objects from S3 through CloudFront, but you cannot upload objects to S3 through CloudFront.