iOS AWS v2 S3 Transfer Manager must use specified endpoint

后端 未结 3 1077
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 15:12

I am developing an iOS app using AWS as its backend. Since I expect users to be world wide, I need to switch where the app should download photos in order to increase latenc

3条回答
  •  無奈伤痛
    2021-01-16 16:05

    Answer for AWS v2

    Although it seems as if you properly set the AWSServiceConfiguration by using the region in your code, you're still using the default AWSS3TransferManager (var transferManager = AWSS3TransferManager.defaultS3TransferManager()). Instead, use the custom init specified in the docs to set that transfer manager's configuration to the serviceConfiguration you've already created.


    Answer for AWS v1

    If you create a bucket like EUWest1 and APNorthEast1 that is not US Standard, you cannot use typical path-style syntax ("http://s3.amazonaws.com" or no specified endpoint required) to access the bucket.

    Assuming downloadRequest is an S3GetObjectRequest, before performing the transferManager's download, you should set the endpoint of the S3GetObjectRequest to match the bucket region.

    For EUWest1, you can set the endpoint to:

    [downloadRequest setEndpoint:@"s3-eu-west-1.amazonaws.com.com"];
    

    For APNorthEast1, you can set the endpoint to:

    [downloadRequest setEndpoint:@"s3-ap-northeast-1.amazonaws.com"];
    

    The entire list of endpoints is available here

提交回复
热议问题