I am trying to build a small vue.js app that uses aws-sdk to get all the Lightsial instances. However, I keep getting this error.
:8081/#/:1 Access to XMLHttpRequest at 'https://lightsail.us-west-2.amazonaws.com/' from origin 'http://localhost:8081' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Here is my vue component script
import { AmplifyEventBus } from 'aws-amplify-vue'
import { components } from 'aws-amplify-vue'
import AWS from 'aws-sdk'
import Lightsail from 'aws-sdk/clients/lightsail'
import Auth from '@aws-amplify/auth';
import awsconfig from '../aws-exports';
export default {
components: {
    AWS, Lightsail
  },
  data() {
    return {
     
    }
  },
  mounted() {
  var myCredentials = 
    {
      accessKeyId : '***************',
      secretAccessKey : '****************'
    }
  AWS.config.update({
    credentials: myCredentials, region: 'us-west-2'
  });
    var lightsail = new AWS.Lightsail();
    lightsail.getInstances(function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
    });
  }
}I am also using aws-amplify-vue in this app for user authentication
 
     
    