# How to get urls for uploaded files?

**URL:** <https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369>\
**Category:** AWS Storage Discussion\
**Tags:** s3\
**Created:** [February 8, 2021, 8:54pm UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369 "2021-02-08T20:54:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![HerForFun998](https://awshq.com/letter_avatar_proxy/v4/letter/h/65b543/32.png) [@HerForFun998](https://awshq.com/u/HerForFun998)\
**Post date:** [February 8, 2021, 8:54pm UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/1 "2021-02-08T20:54:58Z")

</div>

I’m new to aws so this might be trivial but bear with me please.  
So I want to upload images and other types of files to s3 bucket from the browser ,as i understand i need to get a pre signed url using my credentials from the server side and send it to the browser so the client can upload the file to the bucket, the bucket will be public for to read .  
So my question is how to get the file url so any one can access it ?  
I’ve read that i should construct it using the file key and the bucket name…  
(http://s3-REGION-.amazonaws.com/BUCKET-NAME/KEY) …  
Is there other ways to do it ?

---

<div class="post-metadata">

**Author:** ![interactionjackson](https://awshq.com/letter_avatar_proxy/v4/letter/i/dec6dc/32.png) [@interactionjackson](https://awshq.com/u/interactionjackson)\
**Post date:** [February 8, 2021, 9:19pm UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/2 "2021-02-08T21:19:13Z")

</div>

need more details. i’d download the file and use the aws cli to sync my bucket with my downloads folder.

if i was making a browser plug in i would have made an api i can use that invokes a lambda and returns the presigned url that i use to preform the upload.

---

<div class="post-metadata">

**Author:** ![ruskixakep](https://awshq.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@ruskixakep](https://awshq.com/u/ruskixakep)\
**Post date:** [February 8, 2021, 9:58pm UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/3 "2021-02-08T21:58:08Z")

</div>

If you want it to look nicer, you’ll need some additional layer in front of your bucket, for example a Cloudfront distribution with a linked domain name.

With CF you won’t have to make your bucket public btw, as files will be served from the CF edge locations and S3 bucket will be acting as an origin and will be only accessible by the CF.

---

<div class="post-metadata">

**Author:** ![thenickdude](https://awshq.com/letter_avatar_proxy/v4/letter/t/f475e1/32.png) [@thenickdude](https://awshq.com/u/thenickdude)\
**Post date:** [February 8, 2021, 11:39pm UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/4 "2021-02-08T23:39:54Z")

</div>

You can point a domain name to the bucket using a CNAME, which allows you to access the bucket like “[mybucket.mywebsite.com/file.txt](http://mybucket.mywebsite.com/file.txt)” instead:

[https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#VirtualHostingCustomURLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#VirtualHostingCustomURLs)

However to get HTTPS support you must put CloudFront in front of the bucket:

[https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-https-requests-s3/](https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-https-requests-s3/)

---

<div class="post-metadata">

**Author:** ![rundmsef](https://awshq.com/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rundmsef](https://awshq.com/u/rundmsef)\
**Post date:** [February 9, 2021, 2:35am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/5 "2021-02-09T02:35:26Z")

</div>

You may want to check out AWS’s [Serverless Image Handler](https://aws.amazon.com/solutions/implementations/serverless-image-handler/). It handles all the mechanics of serving files by setting up an API Gateway endpoint, caching with Cloudfront, etc. The docs do a pretty good job of describing how to set it all up.

For the front-end, you’ll want to use the AWS SDK for S3. Amplify also has a decent-enough interface for [uploading files to S3](https://docs.amplify.aws/lib/storage/getting-started/q/platform/js) that can get you up and running quickly.

---

<div class="post-metadata">

**Author:** ![SuperPagod](https://awshq.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@SuperPagod](https://awshq.com/u/SuperPagod)\
**Post date:** [February 9, 2021, 3:48am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/6 "2021-02-09T03:48:46Z")

</div>

> [@ruskixakep](#):
>
> If you want it to look nicer, you’ll need some additional layer in front of your bucket, for example a Cloudfront distribution with a linked domain name. With CF you won’t have to make your bucket public btw, as files …

Hi

how will you combine the cloudfront and the generated presigned url of the s3?

---

<div class="post-metadata">

**Author:** ![Nikhil\_M](https://awshq.com/letter_avatar_proxy/v4/letter/n/e19b73/32.png) [@Nikhil\_M](https://awshq.com/u/Nikhil_M)\
**Post date:** [February 9, 2021, 4:26am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/7 "2021-02-09T04:26:36Z")

</div>

> [@SuperPagod](#):
>
> Hi how will you combine the cloudfront and the generated presigned url of the s3?

Cloudfront has its own presigned URL mechanism.

---

<div class="post-metadata">

**Author:** ![ruskixakep](https://awshq.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@ruskixakep](https://awshq.com/u/ruskixakep)\
**Post date:** [February 9, 2021, 4:28am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/8 "2021-02-09T04:28:40Z")

</div>

> [@SuperPagod](#):
>
> Hi how will you combine the cloudfront and the generated presigned url of the s3?

You can do basically anything with a lambda function hooked up to the “origin request” event on the CloudFront distribution. More specific suggestions would require more specific feature description.

---

<div class="post-metadata">

**Author:** ![SuperPagod](https://awshq.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@SuperPagod](https://awshq.com/u/SuperPagod)\
**Post date:** [February 9, 2021, 5:26am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/9 "2021-02-09T05:26:33Z")

</div>

> [@Nikhil\_M](#):
>
> Cloudfront has its own presigned URL mechanism.

thanks!

---

<div class="post-metadata">

**Author:** ![SuperPagod](https://awshq.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@SuperPagod](https://awshq.com/u/SuperPagod)\
**Post date:** [February 9, 2021, 5:26am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/10 "2021-02-09T05:26:36Z")

</div>

> [@ruskixakep](#):
>
> You can do basically anything with a lambda function hooked up to the “origin request” event on the CloudFront distribution. More specific suggestions would require more specific feature description.

thanks!

---

<div class="post-metadata">

**Author:** ![printHelloworld234](https://awshq.com/letter_avatar_proxy/v4/letter/p/779978/32.png) [@printHelloworld234](https://awshq.com/u/printHelloworld234)\
**Post date:** [February 9, 2021, 7:47am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/11 "2021-02-09T07:47:14Z")

</div>

It’s very easy to do that select the bucket , unblock all the permission and save  
Then select the or file or image in the bucket and make the public and then u r good to go with ur image URL which will be objecturl and can be accessed by anyone.

---

<div class="post-metadata">

**Author:** ![SamjadMooppan](https://awshq.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@SamjadMooppan](https://awshq.com/u/SamjadMooppan)\
**Post date:** [February 9, 2021, 8:54am UTC](https://awshq.com/t/how-to-get-urls-for-uploaded-files/12369/12 "2021-02-09T08:54:02Z")

</div>

[https://aws.amazon.com/premiumsupport/knowledge-center/read-access-objects-s3-bucket/](https://aws.amazon.com/premiumsupport/knowledge-center/read-access-objects-s3-bucket/)

That should help you
