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, 2019 in AWS by datageek
• 3,090 points
7,541 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, 2019 by datageek
• 3,090 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
• 58,020 points
2,119 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
4,668 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,170 points
3,291 views
+3 votes
6 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
• 69,220 points
20,068 views
0 votes
1 answer
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, 2019 in AWS by datageek
• 3,090 points
1,656 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,090 points
768 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP