Praveenkumar
Praveenkumar

Reputation: 24476

Getting AWSAccountID

Has anyone worked around with Amazon Web Services (AWS) with iOS SDK 2. I know as per Amazon SDK Team,

Version 2 of the AWS Mobile SDK for iOS has reached General Availability (GA) and is no longer in Developer Preview. Version 1 is deprecated as of September 29, 2014 and will continue to be available until December 31, 2014 in our aws-sdk-ios-v1 repository. If you are building new apps, we recommend you use Version 2.

So, i am trying to upgrade the application with newer version (2.0) of the AWS iOS SDK. As per the [sample application it requires following for authentication as credentials,

NSString *const AWSAccountID = @"Your-AccountID";
NSString *const CognitoPoolID = @"Your-PoolID";
NSString *const CognitoRoleAuth = nil;
NSString *const CognitoRoleUnauth = @"Your-RoleUnauth";

I have filled this with some values which is available on console. But, all the time getting following log,

2014-10-17 18:33:04.056 S3TransferManagerSample[5343:70b] __37-[SecondViewController downloadFiles]_block_invoke154 Error: [Error Domain=com.amazonaws.AWSSTSErrorDomain Code=0 "The operation couldn’t be completed. (com.amazonaws.AWSSTSErrorDomain error 0.)" UserInfo=0x7b028500 {Type=Sender, Message=Not authorized to perform sts:AssumeRoleWithWebIdentity, __text=(
    "\n    ",
    "\n    ",
    "\n    ",
    "\n  "
), Code=AccessDenied}]

Where to get these credentials properly, no proper guidelines and documentations are there to get this. Even nothing properly explained on Amazon Cognito console to get these creditials.

Has anyone done this previously, kindly guide me to get this.

Many Thanks

Upvotes: -1

Views: 508

Answers (1)

perpil
perpil

Reputation: 1584

You need to create a Cognito Identity Pool to obtain that information.

  1. Go here https://console.aws.amazon.com/cognito/home?region=us-east-1
  2. Click New Identity Pool
  3. Complete the 3 steps of the wizard to create an identity pool
  4. It will display the values you will need to update the constants too.

If you have already created an identity pool, you should be able to get the identity pool id and your aws account id from the console. Account id is here: https://console.aws.amazon.com/iam/home?#security_credential (don't include the hyphens) and you can get the role arns for the roles you created by clicking on the role you created here: https://console.aws.amazon.com/iam/home?#roles

Also, be sure to follow all of the steps in the setup guide: http://docs.aws.amazon.com/mobile/sdkforios/developerguide/setup.html

Specifically this one:

Drag and drop the following JSON files, located in the service-definitions directory, into your project.

autoscaling-2011-01-01.json
cib-2014-06-30.json
css-2014-06-30.json
dynamodb-2012-08-10.json
ec2-2014-06-15.json
elasticloadbalancing-2012-06-01.json
email-2010-12-01.json
kinesis-2013-12-02.json
mobileanalytics-2014-06-30.json
monitoring-2010-08-01.json
s3-2006-03-01.json
sdb-2009-04-15.json
sns-2010-03-31.json
sqs-2012-11-05.json
sts-2011-06-15.json

Without doing this step, you will get cryptic error messages.

Upvotes: 3

Related Questions