How to write a string to amazon s3 bucket?

0 votes
I would like to know how can I add a string as a file on amazon s3? From whatever I found, I got to know that we can upload a file to s3. What is the best way to upload data without creating a file?
Jun 14 in AWS by datageek
• 3,040 points
30 views

1 answer to this question.

0 votes

without creating a file on S3, can you write a string? I don't think you can't really do that. On Amazon S3, the only way to store data is using objects. But I found this when I was researching for the same. There is a simple way to do it with PHP, simply send the string as the body of the object, specifying the name of the new file in the key -

$s3->putObject(array(
        'Bucket'       => [Bucket name],
        'Key'          => [path/to/file.ext],
        'Body'         => [Your string goes here],
        'ContentType'  => [specify mimetype if you want],
    ));

This will create a new file according to the specified key, which has content as specified in the string.

answered Jun 14 by datageek
• 3,040 points

Related Questions In AWS

0 votes
1 answer

How to copy .csv file from Amazon S3 bucket?

Boto3 is the library to use for ...READ MORE

answered Jul 6, 2018 in AWS by Priyaj
• 56,540 points
383 views
0 votes
1 answer

How do I write an S3 Object to a file?

While IOUtils.copy() and IOUtils.copyLarge() are great, I would prefer the old ...READ MORE

answered Jul 13, 2018 in AWS by Hammer
• 360 points
128 views
0 votes
1 answer

How to upload a file to Amazon S3 without passing it my server?

This article pretty much explains the entire ...READ MORE

answered Aug 14, 2018 in AWS by Archana
• 4,090 points
75 views
+3 votes
5 answers

How to move files from amazon ec2 to s3 bucket using command line

Hey, 3 ways you can do this: To ...READ MORE

answered Oct 9, 2018 in AWS by Omkar
• 67,520 points
2,662 views
0 votes
1 answer

How To Upload Images to Amazon S3 Using Perl?

That code won't upload the file - it's simply ...READ MORE

answered Mar 15 in AWS by datageek
• 3,040 points
55 views
0 votes
1 answer

Is it possible to use own scheduler with Amazon ECS?

ECS provides Blox, a collection of open ...READ MORE

answered Nov 5, 2018 in AWS by datageek
• 3,040 points
31 views