How do I build an S3 uploader and retrieve S3 data in Angular2 with the aws-sdk
<p>It seems that everyone can explain how to send a file to S3, but unfortunately I haven't found anything about how to store the data from S3 back into my Angular2 MEAN stack application. I'm guessing this means i'm missing something simple. </p>

<p>Currently, I can upload to S3, but I get back the js object a couple seconds later and even though I've tried subscribing to the bucket.upload, nothing I do seems to work to capture the s3 bucket info. </p>

<p>Can someone help me see what I may be missing here? </p>

<p>Here is what I am doing.</p>

<p>My template:</p>

<pre><code>&lt;div class="form-group"  &gt;
&lt;input type="file" (change)="uploadToS3($event)" #input /&gt;
&lt;/div&gt;
</code></pre>

<p>My Component:</p>

<pre><code>export class ProfileImgUploadComponent implements OnInit {
// This class and template is to upload img to S3 and assign to profile
@Input() profile: Profile;
pic_main_loc = '';
file: File;
items: any[] = [];

policy: String;
s3signature: String;


constructor(private router: Router, private awsService: AWSUploadService, private http: Http ) {}

ngOnInit() {
    //console.log(this.profile.first_name)
}

uploadToS3(file: any){

    require('aws-sdk/dist/aws-sdk');

    var AWS = window.AWS;
    var file = file.target.files[0];

    AWS.config.credentials = new AWS.Credentials("myID", "MyPassword");

    var bucket = new AWS.S3({params: {Bucket: 'pcvidistorage1'}});
    var params = {Key: file.name, ContentType: file.type, Body: file, "x-amz-acl": "public-read"};


    console.log(params);

    bucket.upload(params, function (err, data)
    {
        console.log(file.name);
        console.log(err, data);
        console.log('i am here');
        return data
    });

}

//Map file on change
onChange(event) {
    var files = event.srcElement.files;
    this.file = files[0];
    console.log(this.file);
}
</code></pre>