Amazon S3

Download from Amazon S3 using JavaScript and Visualforce

Download from Amazon S3 using Javascript

In continuation to the post where I explained how to upload to Amazon S3 using Javascript  , this post will focus on downloading the document from Amazon S3 using native JavaScript and Visualforce page.

Copy and paste the below JavaScript code in the VF page which would enable you to download the specified file. Change the text mentioned in Red

<script src=""></script>

    <script type="text/javascript">

        accessKeyId: "YOUR AWS ACCESS KEY ID",
        secretAccessKey: "YOUR AWS SECRET ACCESS KEY",
        region_config: "eu-west-1" 
var s23 = new AWS.S3();
var y="Name of the file which is to be downloaded";

var params = {Bucket: 'BUCKET NAME', Key: y};
s23.getSignedUrl('getObject', params, function (err, url) {,"_self");

If you have any question don't hesitate to mention them in comments!!

About Saurabh Dua


  1. Getting Error

    The specified key does not exist
    even i have file.

  2. That is really nice to hear. thank you for the update and good luck. main Image

  3. Note that a file transfer administration saves your information in its web worker for a pre-chosen timeframe. file transfer

  4. It throws an error.
    The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-


Powered by Blogger.