# Does using a ProxyPass on a ec2 instance toward S3 bucket can cause a problem?

**URL:** <https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727>\
**Category:** AWS Storage Discussion\
**Tags:** ec2, s3\
**Created:** [April 14, 2016, 8:26pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727 "2016-04-14T20:26:00Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nulpart](https://awshq.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@Nulpart](https://awshq.com/u/Nulpart)\
**Post date:** [April 14, 2016, 8:26pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/1 "2016-04-14T20:26:00Z")

</div>

I need to use a proxypass (in Ubuntu) to get video on a s3 bucket.

Does the bandwidth get charge on the both s3 and ec2? Do I lose an advantage of s3 by doing this.

I am doing this to avoid the dreaded ‘SECURITY\_ERR: DOM Exception 18’ in HTML5.

* * *

**Related discussions:**

- [Tool for finding dangling resources](https://awshq.com/t/tool-for-finding-dangling-resources/21439)
- [Is there any way to move an S3 bucket to another AWS account without changing its URL?](https://awshq.com/t/is-there-any-way-to-move-an-s3-bucket-to-another-aws-account-without-changing-its-url/21521)
- [Alternative to snapshots for backing up RDS databases?](https://awshq.com/t/alternative-to-snapshots-for-backing-up-rds-databases/17493)
- [Need an optimized sandbox setup for coding agents](https://awshq.com/t/need-an-optimized-sandbox-setup-for-coding-agents/21770)
- [Is AWS Glacier Deep Archive a good choice for archiving 80 TB of movie footage?](https://awshq.com/t/is-aws-glacier-deep-archive-a-good-choice-for-archiving-80-tb-of-movie-footage/21469)

---

<div class="post-metadata">

**Author:** ![Toger](https://awshq.com/letter_avatar_proxy/v4/letter/t/f14d63/32.png) [@Toger](https://awshq.com/u/Toger)\
**Post date:** [April 14, 2016, 8:48pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/2 "2016-04-14T20:48:46Z")

</div>

You won’t get charged for bandwidth to S3, but you’ll still get charged for API calls. Consider running Cloudfront in front of S3 with an appropriate CNAME instead.

Also consider that S3’s ip address can change and many tools don’t re-resolve the IP address during runtime.

---

<div class="post-metadata">

**Author:** ![andthatsarap](https://awshq.com/letter_avatar_proxy/v4/letter/a/779978/32.png) [@andthatsarap](https://awshq.com/u/andthatsarap)\
**Post date:** [April 14, 2016, 10:09pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/3 "2016-04-14T22:09:13Z")

</div>

Be very sure you have an S3 endpoint set up in your VPC, otherwise you’ll be connecting to S3 over the internet.

---

<div class="post-metadata">

**Author:** ![Nulpart](https://awshq.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@Nulpart](https://awshq.com/u/Nulpart)\
**Post date:** [April 14, 2016, 10:50pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/4 "2016-04-14T22:50:16Z")

</div>

> [@Toger](#):
>
> You won’t get charged for bandwidth to S3, but you’ll still get charged for API calls. Consider running Cloudfront in front of S3 with an appropriate CNAME instead. Also consider that S3’s ip address can change and many …

S3 uri can change? Did not know that.

My plan b was Cloudfront, but i have not set it up in a while.

Thx for the reply.

---

<div class="post-metadata">

**Author:** ![Toger](https://awshq.com/letter_avatar_proxy/v4/letter/t/f14d63/32.png) [@Toger](https://awshq.com/u/Toger)\
**Post date:** [April 14, 2016, 11:02pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/5 "2016-04-14T23:02:43Z")

</div>

> [@Nulpart](#):
>
> S3 uri can change? Did not know that. My plan b was Cloudfront, but i have not set it up in a while. Thx for the reply.

Well the IP can change, and tools like varnish / haproxy (and probably nginx) do a one-time resolution and hold on to it. Then your app fails when the IP changes.

---

<div class="post-metadata">

**Author:** ![adamlindsay](https://awshq.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@adamlindsay](https://awshq.com/u/adamlindsay)\
**Post date:** [April 14, 2016, 11:48pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/6 "2016-04-14T23:48:53Z")

</div>

> [@Toger](#):
>
> Well the IP can change, and tools like varnish / haproxy (and probably nginx) do a one-time resolution and hold on to it. Then your app fails when the IP changes.

HAProxy and Nginx can each do run time resolving. HAProxy gained this ability in 1.6 and requires certain params on the server line. Nginx will do it if you use params in the proxy\_pass.

[http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html#proxy\_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass)  
[http://blog.haproxy.com/2015/10/14/whats-new-in-haproxy-1-6/](http://blog.haproxy.com/2015/10/14/whats-new-in-haproxy-1-6/)

---

<div class="post-metadata">

**Author:** ![SupermansOlderBro](https://awshq.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@SupermansOlderBro](https://awshq.com/u/SupermansOlderBro)\
**Post date:** [April 15, 2016, 3:24am UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/7 "2016-04-15T03:24:58Z")

</div>

> [@andthatsarap](#):
>
> Be very sure you have an S3 endpoint set up in your VPC, otherwise you’ll be connecting to S3 over the internet.

Do they charge extra for an s3 endpoint in vpc?

---

<div class="post-metadata">

**Author:** ![VegaWinnfield](https://awshq.com/letter_avatar_proxy/v4/letter/v/c77e96/32.png) [@VegaWinnfield](https://awshq.com/u/VegaWinnfield)\
**Post date:** [April 15, 2016, 3:57am UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/8 "2016-04-15T03:57:24Z")

</div>

> [@andthatsarap](#):
>
> Be very sure you have an S3 endpoint set up in your VPC, otherwise you’ll be connecting to S3 over the internet.

Kind of. As long as you’re in the same region the traffic stays within the AWS network even though you’re using publicly reputable IPs. The real advantage of an S3 endpoint is that you can access the service from private subnets. In this case the instance will need a route to an IGW anyway so there’s not really any benefit.

---

<div class="post-metadata">

**Author:** ![thspimpolds](https://awshq.com/letter_avatar_proxy/v4/letter/t/47e85d/32.png) [@thspimpolds](https://awshq.com/u/thspimpolds)\
**Post date:** [April 15, 2016, 10:19am UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/9 "2016-04-15T10:19:36Z")

</div>

> [@SupermansOlderBro](#):
>
> Do they charge extra for an s3 endpoint in vpc?

No and it’s far more predictable in its speed

---

<div class="post-metadata">

**Author:** ![thspimpolds](https://awshq.com/letter_avatar_proxy/v4/letter/t/47e85d/32.png) [@thspimpolds](https://awshq.com/u/thspimpolds)\
**Post date:** [April 15, 2016, 10:20am UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/10 "2016-04-15T10:20:29Z")

</div>

> [@VegaWinnfield](#):
>
> Kind of. As long as you’re in the same region the traffic stays within the AWS network even though you’re using publicly reputable IPs. The real advantage of an S3 endpoint is that you can access the service from …

There is more predictable speed with the endpoint. It’s not faster or slower in a significant way, just more predictable.

---

<div class="post-metadata">

**Author:** ![andthatsarap](https://awshq.com/letter_avatar_proxy/v4/letter/a/779978/32.png) [@andthatsarap](https://awshq.com/u/andthatsarap)\
**Post date:** [April 15, 2016, 10:56am UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/11 "2016-04-15T10:56:56Z")

</div>

> [@VegaWinnfield](#):
>
> Kind of. As long as you’re in the same region the traffic stays within the AWS network even though you’re using publicly reputable IPs. The real advantage of an S3 endpoint is that you can access the service from …

Valid. I guess where I was struggling was in a semi-private subnet, where instances were accessing the internet through a NAT instance, and when there as a ton of S3 activity, it would get totally crushed.

---

<div class="post-metadata">

**Author:** ![SupermansOlderBro](https://awshq.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@SupermansOlderBro](https://awshq.com/u/SupermansOlderBro)\
**Post date:** [April 15, 2016, 1:35pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/12 "2016-04-15T13:35:08Z")

</div>

> [@thspimpolds](#):
>
> No and it’s far more predictable in its speed

Cool thanks! Is there any reason not to then?

---

<div class="post-metadata">

**Author:** ![Toger](https://awshq.com/letter_avatar_proxy/v4/letter/t/f14d63/32.png) [@Toger](https://awshq.com/u/Toger)\
**Post date:** [April 15, 2016, 4:37pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/13 "2016-04-15T16:37:34Z")

</div>

> [@adamlindsay](#):
>
> HAProxy and Nginx can each do run time resolving. HAProxy gained this ability in 1.6 and requires certain params on the server line. Nginx will do it if you use params in the proxy\_pass. …

I’ve had trouble getting the HAProxy mode to work properly, but assuming thats something else wrong with my environment I just want to raise awareness of the IP changing behavior (and DNS permacaching) and make sure people check their tools work properly against it.

---

<div class="post-metadata">

**Author:** ![thspimpolds](https://awshq.com/letter_avatar_proxy/v4/letter/t/47e85d/32.png) [@thspimpolds](https://awshq.com/u/thspimpolds)\
**Post date:** [April 15, 2016, 8:27pm UTC](https://awshq.com/t/does-using-a-proxypass-on-a-ec2-instance-toward-s3-bucket-can-cause-a-problem/1727/14 "2016-04-15T20:27:59Z")

</div>

> [@SupermansOlderBro](#):
>
> Cool thanks! Is there any reason not to then?

Not really except you don’t see level 7 visibility if you need to see it
