Uploading base64 encoded Image to Amazon S3 via Node.js

For people who are still struggling with this issue. Here is the approach I used with native aws-sdk : var AWS = require(‘aws-sdk’); AWS.config.loadFromPath(‘./s3_config.json’); var s3Bucket = new AWS.S3( { params: {Bucket: ‘myBucket’} } ); Inside your router method (ContentType should be set to the content type of the image file): var buf = Buffer.from(req.body.imageBinary.replace(/^data:image\/\w+;base64,/, … Read more

How do API Keys and Secret Keys work? Would it be secure if I have to pass my API and secret keys to another application?

Basically elaborating on what’s outlined here. Here’s how it works: let’s say we have a function that takes a number from zero through nine, adds three and, if the result is greater than ten, subtracts ten. So f(2) = 5, f(8) = 1, etc. Now, we can make another function, call it f’, that goes … Read more

How to delete files recursively from an S3 bucket

With the latest aws-cli python command line tools, to recursively delete all the files under a folder in a bucket is just: aws s3 rm –recursive s3://your_bucket_name/foo/ Or delete everything under the bucket: aws s3 rm –recursive s3://your_bucket_name If what you want is to actually delete the bucket, there is one-step shortcut: aws s3 rb … Read more

How to upload a file to directory in S3 bucket using boto

NOTE: This answer uses boto. See the other answer that uses boto3, which is newer. Try this… import boto import boto.s3 import sys from boto.s3.key import Key AWS_ACCESS_KEY_ID = ” AWS_SECRET_ACCESS_KEY = ” bucket_name = AWS_ACCESS_KEY_ID.lower() + ‘-dump’ conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) bucket = conn.create_bucket(bucket_name, location=boto.s3.connection.Location.DEFAULT) testfile = “replace this with an actual filename” print … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)