title: Hosting a Angular 6 app in AWS S3 bucket with proxy
body: <p>I have an <code>Angular</code> App which is calling <code>API</code> from different server (CORS) I've set up Proxy to do so.</p>
  
  <p>When I run <code>npm start</code> it will run <code>ng serve --port 80 --proxy-config proxy.conf.json</code></p>
  
  <p>My <code>package.json</code> file is as below</p>
  
  <pre><code>{
    "name": "appname",
    "version": "0.0.0",
    "scripts": {
      "ng": "ng",
      "start": "ng serve --port 80 --proxy-config proxy.conf.json",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
      -- dependencies --
    },
    "devDependencies": {
      -- devDependencies --
    }
  }
  </code></pre>
  
  <p>The <code>proxy.config.json</code> file contains <code>API</code> endpoint configuration as below.</p>
  
  <pre><code>{
      "/api":{
          "target": "http://url_to_my_api_server",
          "secure": false,
          "changeOrigin": true
      }
  }
  </code></pre>
  
  <p>I've uploaded the project to <code>AWS</code> <code>EC2</code> (<code>Ubuntu</code>, <code>Node 10.9.0</code>, <code>NPM 6.4.0</code>) Instance and followed <a href="https://www.youtube.com/watch?v=N-6LtzJezsk" rel="nofollow noreferrer">THIS</a> tutorial to deploy it using <code>serverless</code>. Its created an <code>S3</code> bucket and I can access the frontend. <code>HTML</code>,<code>CSS</code> and <code>JavaScript</code> are loading properly, But images are not. If I open the images it's showing <code>Forbidden 403</code> error.</p>
  
  <p>Below is my <code>S3 Bucket</code> Policy</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Sid": "PublicReadGetObject",
              "Effect": "Allow",
              "Principal": "*",
              "Action": [
                  "s3:GetObject"
              ],
              "Resource": [
                  "arn:aws:s3:::s3-bucket-name/*"
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Another problem is <code>API</code> Requests which I was doing using <code>Proxy</code> are also showing the same error.</p>
  
  <p>How to host the website properly on <code>S3</code> bucket and make the <code>API</code> calls with the <code>Proxy</code> (I don't want to disclose the <code>API</code> Endpoint to the user).</p>
  
  <p>Is there any other way to host the site?</p>