Create the permission in IAM:
...
{
"Effect": "Allow",
"Action": [
"s3:putObject"
],
"Resource": "arn:aws:s3:::my_corporate_bucket/*"
}
...
Tips:
- You can get the resource ARN just by clicking the bucket and clicking into the button “Copy Bucket ARN”
- take a look into the link: api on amazon the name of the allowed operations are the fuction ones
- other way to get the permissions is using the “simulate policy” inside the AIM Rule you are creating. ( remember to use the field resource when you have specific rule)
To create an object, using the API
const aws = require('aws-sdk');
var s3 = new aws.S3();
/* The following example creates an object. If the bucket is versioning enabled, S3 returns version ID in response. */
var params = {
Body: <Binary String>,
Bucket: "examplebucket",
Key: "objectkey"
};
s3.putObject(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
ETag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
VersionId: "Bvq0EDKxOcXLJXNo_Lkz37eM3R4pfzyQ"
}
*/
});
thanks for sharing this information.have shared this link with others keep posting such information..