title: Instance Differents AWS Buckets using aws-sdk-react-native
body: <p>I have two different buckets in S3 (with their respectives ACCESS_KEY and SECRET_ACCESS_KEY, so I need instance them in a same function. Currently I have a function in order to instance the current Bucket (depending of environment), as follow </p>
  
  <pre><code>import S3 from "aws-sdk/clients/s3";
  import { S3_BUCKET, S3_SECRET_ACCESS_KEY, S3_ACCESS_KEY } from 'react-native-dotenv' 
  
  const getSignedURL = key =&gt; {
      s3I = new AWS.S3({
          accessKeyId: S3_ACCESS_KEY,
          secretAccessKey: S3_SECRET_ACCESS_KEY,
          Bucket: S3_BUCKET
      })
      return key !== undefined &amp;&amp; key !== '' &amp;&amp; key !== null
          ? s3I.getSignedUrl('getObject', {
              Bucket: S3_BUCKET,
              Key: key
          })
          : ''
  }
  
  export default {
    getSignedURL
  };
  
  </code></pre>
  
  <p>And works very well, but only retrieve the images for the current bucket (i.e. develop).</p>
  
  <p>How can I instance both?</p>
  
  <p>Thanks</p>
  
  <p><strong>POST DATA</strong>
  I've tried using OR in the S3 Object but didn't work (only retrieved the first):</p>
  
  <pre><code>s3I = new AWS.S3({
          accessKeyId: S3_ACCESS_KEY_PROD || S3_ACCESS_KEY_DEV,
          secretAccessKey: S3_SECRET_ACCESS_KEY_PROD || S3_SECRET_ACCESS_KEY_DEV,
          Bucket: S3_BUCKET_PROD || S3_BUCKET_DEV
      })
  </code></pre>
  
  <p><strong>POST DATA 2</strong>
  Also I've tried as follow, without success:</p>
  
  <pre><code>const getSignedURL = key =&gt; {
      s3IProd = new AWS.S3({
          accessKeyId: S3_ACCESS_KEY_PROD,
          secretAccessKey: S3_SECRET_ACCESS_KEY_PROD,
          Bucket: S3_BUCKET_PROD
      })
      s3IDev = new AWS.S3({
        accessKeyId: S3_ACCESS_KEY_DEV,
        secretAccessKey: S3_SECRET_ACCESS_KEY_DEV,
        Bucket: S3_BUCKET_DEV
    })
      return key !== undefined &amp;&amp; key !== '' &amp;&amp; key !== null
          ? s3IProd.getSignedUrl('getObject', {
              Bucket: S3_BUCKET_PROD,
              Key: key
          }) &amp;&amp; s3IDev.getSignedUrl('getObject', {
            Bucket: S3_BUCKET_DEV,
            Key: key
          })
          : ''
  }
  </code></pre>