# Can use Amazon S3 to store image

**URL:** <https://forum.farmbot.org/t/can-use-amazon-s3-to-store-image/2869>\
**Category:** Feature Requests\
**Created:** [November 17, 2017, 8:41am UTC](https://forum.farmbot.org/t/can-use-amazon-s3-to-store-image/2869 "2017-11-17T08:41:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snzip](https://forum.farmbot.org/letter_avatar_proxy/v4/letter/s/f05b48/32.png) [@snzip](https://forum.farmbot.org/u/snzip)\
**Post date:** [November 17, 2017, 8:41am UTC](https://forum.farmbot.org/t/can-use-amazon-s3-to-store-image/2869/1 "2017-11-17T08:41:22Z")

</div>

Hi Team,  
Google storage can not be reached in China. I would like to host own farmweb. Is there a way to switch to other storage? like AWS S3 or Aliyun ，  
thanks,

---

<div class="post-metadata">

**Author:** ![RickCarlino](https://forum.farmbot.org/user_avatar/forum.farmbot.org/rickcarlino/32/3593_2.png) [@RickCarlino](https://forum.farmbot.org/u/RickCarlino)\
**Post date:** [November 18, 2017, 12:06am UTC](https://forum.farmbot.org/t/can-use-amazon-s3-to-store-image/2869/2 "2017-11-18T00:06:34Z")

</div>

@snzip

This is _probably_ possible, but I have never used Aliyun, so my ability to help you is limited. It would requiring changing the codebase in one of the following ways:

1. **Find an AWS compatible vendor that is usable in China and change the codebase to use that instead.** Many vendors, like [Google Cloud Storage](https://cloud.google.com/storage/) and [Digital Ocean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) offer storage APIs that are _exactly the same as Amazon AWS_. This means that in most cases, you can use Google Cloud Storage, Amazon S3, or DigitalOcean Spaces interchangeably. The API is the same, you just need to change the [URL that the server uses](https://github.com/RickCarlino/farmbot-web-app/blob/master/app/models/image.rb#L32) (👈) . I do not know if Aliyun offers an S3 compatible service, and can’t provide much detail beyond that.
2. **Use `fog-aliyun` instead of `fog-google`.** We use the [Fog](https://github.com/fog/fog) and [Paperclip](https://github.com/thoughtbot/paperclip) libraries for image management. Fog has many plugins, such as [fog-aliyun](https://github.com/fog/fog-aliyun). Again, I can’t say much there other than you would need to remove `fog-google` from the project, replace it with `fog-aliyun` and [uppdate this configuration object to use Aliyun instead of Google](https://github.com/RickCarlino/farmbot-web-app/blob/master/app/models/image.rb#L17,L37). You might also need to update code in [this controller action](https://github.com/RickCarlino/farmbot-web-app/blob/master/app/controllers/api/images_controller.rb#L33,L55).

Please let me know if you try that approach, it is one that I am sure many other Chinese users would benefit from. If you are able to cleanly substitute Aliyun, we might be able to add simplified support in a future version. This change would require a minor-to-moderate amount of changes to the image handling code.

---

<div class="post-metadata">

**Author:** ![EstherLewis](https://forum.farmbot.org/letter_avatar_proxy/v4/letter/e/c37758/32.png) [@EstherLewis](https://forum.farmbot.org/u/EstherLewis)\
**Post date:** [April 23, 2019, 2:59pm UTC](https://forum.farmbot.org/t/can-use-amazon-s3-to-store-image/2869/3 "2019-04-23T14:59:32Z")

</div>

You are right and I prefer that you use digitalOcean as I am also using it for some of my projects although I am not using the conventional digitalOcean instance and instead, I am using the managed DigitalOcean server which is powered by Cloudways. But, keeping this aside I do think that digitalOcean provides an excellent uptime as well due to it’s worldwide data centers.

---

<div class="post-metadata">

**Author:** ![pestcontrol](https://forum.farmbot.org/user_avatar/forum.farmbot.org/pestcontrol/32/2030_2.png) [@pestcontrol](https://forum.farmbot.org/u/pestcontrol)\
**Post date:** [April 25, 2019, 2:51pm UTC](https://forum.farmbot.org/t/can-use-amazon-s3-to-store-image/2869/4 "2019-04-25T14:51:32Z")

</div>

thanks for the information
