title: Should I replace my AWS Android SDK calls to DynamoDB with Retrofit?
body: <p>I have a specific repo class used to make AWS DynamoDB database calls full of methods similar to the next:</p>
  <pre><code>public List&lt;TestType&gt; getTestTypes()
  {
      List&lt;TestType&gt; scanResult = null;
      DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
  
      try {
          scanResult = awsConnection.getMapper().scan(TestType.class, scanExpression);
      } catch (Exception e) {
          AWSHelper.logError(e);
      }
  
      return scanResult;
  }
  </code></pre>
  <p>I use <code>AWSRepository</code>, which is located in a repo package. It's full of AWS DynamoDB calls (which are done in the background) and the class starts like this:</p>
  <pre><code>public class AWSRepository implements IAWSDAO
  {
      private static AWSRepository instance;
      static AWSConnection awsConnection;
  
      private AWSRepository()
      {
          awsConnection = new AWSConnection();
      }
  
      public static synchronized AWSRepository getInstance()
      {
          if(instance == null) instance = new AWSRepository();
          return instance;
      }
  
      ...AWS call methods...
  }
  </code></pre>
  <p>And then the AWSConnection class:</p>
  <pre><code>class AWSConnection
  {
      private DynamoDBMapper mapper;
      private AmazonDynamoDBClient ddbClient;
  
      private static String poolId;
      private static final Regions databaseRegion = Regions.EU_WEST_1;
  
      AWSConnection()
      {
          Context context = AppSettings.getAppContext();
          Cryptography crypto = new Cryptography();
          String cryptedPoolId = &quot;xxx&quot;;
          poolId = crypto.decrypt(cryptedPoolId, TMSecurity.getCryptoParams());
  
          this.setMapper(initializeAWSIdentityPool_DynamoDBMapper(context));
          this.setDdbClient(initializeAWSIdentityPool_AmazonDynamoDBClient(context));
      }
  
      DynamoDBMapper getMapper()
      {
          return mapper;
      }
  
      private void setMapper(DynamoDBMapper mapper)
      {
          this.mapper = mapper;
      }
  
      AmazonDynamoDBClient getDdbClient()
      {
          return ddbClient;
      }
  
      private void setDdbClient(AmazonDynamoDBClient ddbClient)
      {
          this.ddbClient = ddbClient;
      }
  
      // initialize connection
  
      private static DynamoDBMapper initializeAWSIdentityPool_DynamoDBMapper(Context context)
      {
          CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
                  context,
                  poolId,
                  databaseRegion
          );
  
          AmazonDynamoDBClient ddbClient = Region.getRegion(databaseRegion)
                  .createClient(
                          AmazonDynamoDBClient.class,
                          credentialsProvider,
                          new ClientConfiguration()
                  );
  
          return DynamoDBMapper.builder().dynamoDBClient(ddbClient).build();
      }
  
      private static AmazonDynamoDBClient initializeAWSIdentityPool_AmazonDynamoDBClient(Context context)
      {
          CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
                  context,
                  poolId,
                  databaseRegion
          );
  
          return Region.getRegion(databaseRegion)
                  .createClient(
                          AmazonDynamoDBClient.class,
                          credentialsProvider,
                          new ClientConfiguration()
                  );
      }
  }
  </code></pre>
  <p><code>build.gradle</code></p>
  <pre><code>...
  api group: 'com.amazonaws', name: 'aws-android-sdk-cognito', version: '2.20.1'
  api group: 'com.amazonaws', name: 'aws-android-sdk-core', version: '2.33.0'
  api group: 'com.amazonaws', name: 'aws-android-sdk-ddb', version: '2.33.0'
  api group: 'com.amazonaws', name: 'aws-android-sdk-ddb-mapper', version: '2.33.0'
  ...
  </code></pre>
  <p>This is working just fine, but I've heard whenever you need to make such calls it's a good practice to use a REST client (like Retrofit for example), and I'm trying to include all possible best practices into my app, so I'm in doubt about my case.</p>
  <p>My confusion comes because I've asked AWS tech staff and they've told me I can leave it just like it is now, with no rest client with no problem at all, that AWS is ready to work this way (with no rest client) so my question is the next:</p>
  <p>Should I really include a REST client like Retrofit?</p>
  <p>What would be the real benefits to invest the necessary time?</p>
  <p>Could I leave it just like it is now or am I &quot;violating&quot; any best practice this way with AWS?</p>