Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

I could upload a file to a private S3 bucket successfully using following command:

aws s3 cp "myfile.txt" "s3://myfolder/myfile.txt" --region=us-east-1 --output=json

I would like to issue a AWS CLI command to return me a temporary URL download for myfile.txt and does anyone know how to?

I googled and look like I have to do some signing to get temporary URL such as: http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html

1 Answer

0 votes
by (18.2k points)

You can generate a URL using s3 pre-sign in AWS CLI. Try the following command:

AWS s3 presign s3://mybucket/myobject

 This command will generate a URL that will expire in 3600 seconds

You can also provide a custom time period for the expiration using --expires-in as shown below

$ aws s3 presign s3://test-bucket/test-file.txt --expires-in 900

Learn more about AWS by going through AWS course and master this trending technology.

Related questions

0 votes
2 answers

Want to get 50% Hike on your Salary?

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

0 votes
1 answer

Browse Categories

...