# How to reslove "Failed to create connection to S3 bucket" error

**URL:** <https://community.palantir.com/t/how-to-reslove-failed-to-create-connection-to-s3-bucket-error/7310>\
**Category:** Ask the Community\
**Tags:** code-repositories\
**Created:** [October 2, 2026, 7:41am UTC](https://community.palantir.com/t/how-to-reslove-failed-to-create-connection-to-s3-bucket-error/7310 "2026-10-02T07:41:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparkyoda](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@sparkyoda](https://community.palantir.com/u/sparkyoda)\
**Post date:** [October 2, 2026, 7:41am UTC](https://community.palantir.com/t/how-to-reslove-failed-to-create-connection-to-s3-bucket-error/7310/1 "2026-10-02T07:41:10Z")

</div>

I have been able to use this code to read files in media set in code repository in the public foundry:

```auto
with control_file_input.get_media_item(item.mediaItemRid) as stream:

                xml_bytes = stream.read()

```

In recent several days, the code will generate error message at the 2nd line: Failed to create connection to host `host='pcloud-mio-REDACTED.s3.us-east-1.amazonaws.com', port=443`

Can I adjust my settings in some way to solve this error?

---

<div class="post-metadata">

**Author:** ![maxh](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@maxh](https://community.palantir.com/u/maxh)\
**Post date:** [October 6, 2026, 8:21pm UTC](https://community.palantir.com/t/how-to-reslove-failed-to-create-connection-to-s3-bucket-error/7310/2 "2026-10-06T20:21:21Z")

</div>

Have you tried passing use\_signed\_url=False to read through Foundry’s media service instead of downloading directly using a signed URL?

```auto
with control_file_input.get_media_item(
    item.mediaItemRid, use_signed_url=False
) as stream:
    xml_bytes = stream.read()

```

---

<div class="post-metadata">

**Author:** ![sparkyoda](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@sparkyoda](https://community.palantir.com/u/sparkyoda)\
**Post date:** [October 7, 2026, 9:16am UTC](https://community.palantir.com/t/how-to-reslove-failed-to-create-connection-to-s3-bucket-error/7310/3 "2026-10-07T09:16:48Z")

</div>

> [@maxh](#):
>
> ```auto
> with control_file_input.get_media_item(
> item.mediaItemRid, use_signed_url=False
> ) as stream:
> xml_bytes = stream.read()
> 
> ```

This really solved the issue. The original code without ‘use\_signed\_url=False’ had been working fine but suddenly failed a week ago. The sudden changes of the defaults of infrastructure happen quite often. It is really a headache in my testing. Thanks again!
