AWS将区域从East1切换到West2 [英] AWS Switch Region from East1 to West2

查看:360
本文介绍了AWS将区域从East1切换到West2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用Amazon Web Services的应用程序。我们对其进行了设计,以便将图像和视频(S3)发送到East1区域,而将图像和视频的元数据(DynamoDB)发送到West2区域。
但是我们无法让它从使用east1切换到west2。

We have an application that uses Amazon Web Services. We have designed it such that images and videos (S3) are sent to East1 region, while images and videos' metadata (DynamoDB) are sent to West2 region. But we can't get it to switch from using the east1 to west2.

初始化AWS时,有以下内容:

When we initialized our AWS, we have this:

self.provider = [AWSCognitoCredentialsProvider credentialsWithRegionType:AWSRegionUSEast1
                                                               accountId:AWS_ACCOUNT_ID
                                                          identityPoolId:COGNITO_POOL_ID
                                                           unauthRoleArn:COGNITO_ROLE_UNAUTH
                                                             authRoleArn:COGNITO_ROLE_AUTH];
self.east1Configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1
                                                         credentialsProvider:self.provider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = self.east1Configuration;


self.west2Configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSWest2
                                                        credentialsProvider:self.provider];

现在,当我们要发送视频和图像元数据时,我们还尝试将serviceConfiguration设置为west:

Now when we want to send video and image metadata, we also tried to set the serviceConfiguration to west:

[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = self.west2Configuration;

但是它不起作用。它不会切换到west2。
我希望我有道理,谢谢。

But it's not working. It won't switch to west2. I hope I make sense, Thank you.

推荐答案

defaultServiceConfiguration 只能设置一次(只有分配的第一个配置才有效)。为了在配置之间切换,您需要在 AWSS3 AWSDynamoDB上调用-initWithConfiguration: 而不是 + defaultS3 + defaultDynamoDB

defaultServiceConfiguration can only be set once (only the first configuration assigned will be valid). In order to switch between configurations, you need to call - initWithConfiguration: on AWSS3 and AWSDynamoDB instead of + defaultS3 and + defaultDynamoDB.

请注意,当使用-initWithConfiguration:时,需要保留对服务客户端对象的强引用。对于 + defaultS3 + defaultDynamoDB ,SDK会保留强引用(这些是单例方法)。就像您要创建配置对象 @property 一样,您也可以使服务客户端 @property

Please note that when you use - initWithConfiguration:, you need to retain a strong reference to the service client object. For + defaultS3 and + defaultDynamoDB, the SDK maintains the strong references (these are singleton methods). Just like you are making configuration objects @property, you can make the service client @property as well.

这篇关于AWS将区域从East1切换到West2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆