# Self-hosted Mender - Config for Amazon CloudFront?

**URL:** https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960
**Category:** General Discussions
**Created:** [August 23, 2019, 2:13pm UTC](https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960 "2019-08-23T14:13:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![will](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@will](https://hub.mender.io/u/will)
#### Post date: [August 23, 2019, 2:13pm UTC](https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960/1 "2019-08-23T14:13:13Z")

</div>

Has anybody got self-hosted Mender working with Amazon CloudFront?

I have S3 setup OK with  
`DEPLOYMENTS_AWS_URI: https://s3.eu-central-1.amazonaws.com`  
I can upload artifacts via the UI no problem.

However I would like deployments to download from a CloudFront URL like  
[https://d2cj8bq76uwdq0.cloudfront.net](https://d2cj8bq76uwdq0.cloudfront.net)

I could not find a config variable for setting the download url.

Is there any way to do this?

thanks  
–Will

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [August 23, 2019, 2:36pm UTC](https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960/2 "2019-08-23T14:36:25Z")

</div>

The Mender server utilizes S3 API to generate a [presigned Object URL](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/s3-example-presigned-urls.html), and this URL is provided to the client.

As far as I know there is no configuration option to tell the client to use a cloudfrount URL, but it is also unclear to me if it even would work with [presigned Object URLs](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/s3-example-presigned-urls.html) if there was.

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [August 23, 2019, 2:38pm UTC](https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960/3 "2019-08-23T14:38:47Z")

</div>

It seems that it would be possible (quick internet search 🙂 ),

> **[How to use S3 signed URLs with CloudFront](https://advancedweb.hu/2018/11/15/s3_signed_urls_cloudfront/)**
>
> S3 signed URLs offer a flexible way to share private content. Learn how to use them through CloudFront

---

<div class="post-metadata">

### Author: ![xulong.z](https://avatars.discourse-cdn.com/v4/letter/x/5f9b8f/32.png) [@xulong.z](https://hub.mender.io/u/xulong.z)
#### Post date: [August 14, 2024, 4:52am UTC](https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960/4 "2024-08-14T04:52:07Z")

</div>

Hi @will ,

Have you got it to work?

In my case, Mender prefixed the bucket name to the external URL. Do you know how to get rid of it by any chance?

> [@DEPLOYMENTS\_AWS\_EXTERNAL\_URI with CloudFront](https://hub.mender.io/t/deployments-aws-external-uri-with-cloudfront/7102):
>
> Hi, I’d like the devices to access the artefacts via AWS CloudFront domain. I’ve configured mender-deployments service with the following environment variables: In the client devices, I got an error: dial tcp: lookup [coolon-mender-artifacts.d342gnwfeb7kek.cloudfront.net](http://coolon-mender-artifacts.d342gnwfeb7kek.cloudfront.net) on 8.8.8.8:53: no such host" How to remove the “coolon-mender-artifacts” part from the CloudFront URL?

---

<div class="post-metadata">

### Author: ![alfrunes](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/alfrunes/32/703_2.png) [@alfrunes](https://hub.mender.io/u/alfrunes)
#### Post date: [August 14, 2024, 7:52am UTC](https://hub.mender.io/t/self-hosted-mender-config-for-amazon-cloudfront/960/5 "2024-08-14T07:52:43Z")

</div>

Unfortunately, Mender will always try to inject the bucket name in the URL, either in the hostname or the path segment of the URL depending on the value of the `DEPLOYMENTS_AWS_FORCE_PATH_STYLE` config option.  
Although I haven’t tried it myself, you could try to use path-style URL and [setup a redirect rule](https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html) for your bucket that strips the bucket name from the key prefix. I’m not sure how Cloudfront will deal with the redirect though.
