DigitalOcean dashboard

Use Amazon AWS S3 or Digital Ocean's object storage to store media files

03/03/2018
mDfRg
web

Having used Jekyll as the blog engine I decided to store my entire web page in the git repository. Version control lets me fiddle with design and writing drafts, but what about big files? Nowadays a blog shall not lack media, not to mention a thumbnail. But pushing images to git repo is not a desired solution. Instead, try to

Installation

Add Spaces in DigitalOcean dashborad

  • choose region
  • name it Go to API->Spaces acces keys-> Generate New Key
The secret key will be displayed only once, so write it in the password manager!

Install s3cmd

sudo apt-get install python-pip
sudo pip install s3cmd
s3cmd --configure

Configure it. Below is the example of config (your Acces and secret key will vary). Change ny3 region accordingly.

Access Key []: EXAMPLE7UQOTHDTF3GK4
Secret Key []: b8e1ec97b97bff326955375c5example
Default Region [US]:
S3 Endpoint [s3.amazonaws.com]: nyc3.digitaloceanspaces.com
DNS-style bucket+hostname:port template for accessing a bucket []: %(bucket)s.nyc3.digitaloceanspaces.com
Path to GPG program [/usr/bin/gpg]:/usr/bin/gpg2
Use HTTPS protocol [Yes]: Yes
HTTP Proxy server name:

Usage

Put images to your object storage space:

s3cmd put -r s3cmd01.png s3://mindefragnet/posts/object-storage/ --acl-public

Note the --acl-public flag. Otherwise the uploaded file will be private and not visible outside your account. You will see something like this: s3cmd

Now copy the public URL of the object and use it as a regular image, like this

![s3cmd](http://kostasz.hekko.pl/files/mindefrag.net/posts/object-storage/s3cmd01.png)