ios - Using AWS sdk on IOS without using Identity Pool
问题描述
I want to use AWS sdk on IOS to transfer files on S3. To setup AWS sdk on IOS it requires AWS cognito service to have an identity pool for that user but I just want to use AWS sdk to transfer files to s3 using access key and secret access key.
So is it possible to use amazon sdk for IOS without having to use amazon cognito and other service for that matter.
Also when I use AWS sdk on .Net it doesnt require any other service just access key and scret key.
解决方案
当然,你可以这样做。
查看本节,了解他们如何为 TransferUtility 配置凭据。在这里,他们使用 Cognito 作为凭证提供者。
let credentialProvider = AWSCognitoCredentialsProvider(regionType: YOUR-IDENTITY-POOL-REGION, identityPoolId: "YOUR-IDENTITY-POOL-ID")
相反,您可以使用使用 IAM 用户的访问密钥 ID 和密钥的静态凭证提供程序:
let credentialsProvider = AWSStaticCredentialsProvider(accessKey: "YOUR-ACCESS-KEY-ID", secretKey: "YOUR-SECRET-KEY")
当您实例化 S3 服务时,您将提供凭证提供程序接口作为AWSServiceConfiguration
. 正如他们对传输实用程序所做的那样:
//Register a transfer utility object
AWSS3TransferUtility.register(
with: AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)!
)
推荐阅读
- r - 如何从 R cox 回归中提取 TRUE/FALSE 层结果?
- java - NumberFormatException:从文件读取时输入字符串“\N”
- c# - Kendo MVC DropdownTree 不显示所选值
- docker - 如何运行 Docker 映像的多个实例?
- amazon-web-services - 在 AWS 中存储服务器文件的正确位置在哪里
- html - 在标签和输入上使用 id 标签有什么区别?
- c - CreateRemoteThread 上的进程注入器崩溃
- java - 按下按钮后如何使用自己的 ActionListener 类将文本附加到 JTextArea
- configuration - 如何在高级 REST 客户端独立应用程序中删除已保存的项目?
- ruby - 在骰子游戏中确定多轮获胜者的功能问题