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.


Note: only a member of this blog may post a comment.

Powered by Blogger.