Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I am using AWS ec2 instance. On this instance, I'm resulting in some files. These operations are done by user data.

Now I want to store those files on s3 by writing code in user data itself.

  • So how can I store those files on s3?

  • Have any tutorials on it?


1 Answer

0 votes
by (44.4k points)

Using the most recent AWS CLI ( you can use the following commands to copy files from your Ec2 Instance or even your local machine to S3 storage.

aws s3 cp myfolder s3://mybucket/myfolder --recursive

You'll then get something like:

upload: myfolder/file1.txt to s3://mybucket/myfolder/file1.txt 

upload: myfolder/subfolder/file1.txt to s3://mybucket/myfolder/subfolder/file1.txt

If this is your first usage of the aws CLI tool then you'll need to run:

aws configure

This will ask you to enter your access key & secret along with specifying a default region.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

+1 vote
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers


108k users

Browse Categories