I need to connect to Amazon’s SimpleDB in my Android app. The sample project provided with Amazon’s Android SDK places the credentials in a file called AwsCredentials.properties, which is in the project source. The source code then makes these calls to access and use them:
Properties properties = new Properties();
properties.load( getClass().getResourceAsStream( "AwsCredentials.properties" ) );
String accessKeyId = properties.getProperty( "accessKey" );
String secretKey = properties.getProperty( "secretKey" );
...
credentials = new BasicAWSCredentials( properties.getProperty( "accessKey" ), properties.getProperty( "secretKey" ) );
Is this the proper and secure way to do it?
I wouldn’t do it that way. It is suitable for quickly putting something together but storing AWS credentials in a properties files is not the secure way to do it. Amazon actually provide an useful write-up on how to access AWS securely from a mobile device. I would also suggest looking at the KeyStore provided by Android.
I have written more details about using IAM users for mobile AWS credentials in my response to your other question.