title: S3 says secure however I can read contents without any keys
body: <p>So I'm trying to securely store my production keys in an S3 Bucket and have the EC2 load them.
  Here's what it looks like. It's saying <code>Bucket and objects not public</code>.</p>
  <p><a href="https://i.stack.imgur.com/4VsXF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4VsXF.png" alt="enter image description here" /></a></p>
  <p>So I proceed to enter this code to retrieve the bucket information.</p>
  <pre><code>const aws = require('aws-sdk');
  const s3 = new aws.S3(); // Pass in opts to S3 if necessary
  
  var getParams = {
    Bucket: 'secret-bucket-name', // your bucket name,
    Key: 'keys-temp.js' // path to the object you're looking for
  }
  
  s3.getObject(getParams, function(err, data) {
    // Handle any error and exit
    if (err){
      console.log(&quot;err&quot;,err);
      return err;
    }
  
    // No error happened
    // Convert Body from a Buffer to a String
  
    let objectData = data.Body.toString('utf-8'); // Use the encoding necessary
    console.log(&quot;objectData&quot;,objectData);
  });
  </code></pre>
  <p>And everything works smoothly. It grabs the keys no problem. Only, this is on my local server not my AWS server. Is this not exposing my keys to the public?</p>
  <p>Is this the right way to go about saving production keys? Or am I missing something?</p>