Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create an AWS S3 bucket using NodeJS and AWS Cli
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
s3.createBucket({Bucket: 'myBucket'}, function() {
var params = {Bucket: 'myBucket', Key: 'myKey', Body: 'Hello!'};
s3.putObject(params, function(err, data) {
if (err)
else console.log("Successfully uploaded data to myBucket/myKey");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment