简体   繁体   中英

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.

Sure, you can do that.

Check out this section on how they configure credentials for the TransferUtility . Here they are using Cognito as the credentials provider.

let credentialProvider = AWSCognitoCredentialsProvider(regionType: YOUR-IDENTITY-POOL-REGION, identityPoolId: "YOUR-IDENTITY-POOL-ID")  

Instead you can use a static credentials provider which uses your IAM user's access key ID and secret:

let credentialsProvider = AWSStaticCredentialsProvider(accessKey: "YOUR-ACCESS-KEY-ID", secretKey: "YOUR-SECRET-KEY")

When you instantiate the S3 service you would provide the credentials provider interface as an argument to the AWSServiceConfiguration . As they do with the transfer utility:

//Register a transfer utility object
AWSS3TransferUtility.register(
    with: AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)!
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM