<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>s3 &amp;mdash; Nat Knight</title>
    <link>http://natknight.xyz/tag:s3</link>
    <description>Reflections, diversions, and opinions from a progressive ex-physicist programmer dad with a sore back.</description>
    <pubDate>Sun, 24 May 2026 15:19:07 -0700</pubDate>
    <item>
      <title>TIL: Local development against &#34;S3&#34;</title>
      <link>http://natknight.xyz/til-local-development-against-s3</link>
      <description>&lt;![CDATA[#til #s3 #dockercompose&#xA;&#xA;I had to update a Django service to use S3 instead of local file storage recently. Here&#39;s how I set up Minio (a self-hostable S3-compatible data store) for local development.&#xA;&#xA;!--more--&#xA;&#xA;I use Docker Compose (well, Finch Compose, but same difference) to run local versions of Postgres and S3.&#xA;&#xA;Here&#39;s the docker-compose.yaml file for Minio:&#xA;&#xA;services:&#xA;  minio:&#xA;    image: minio/minio&#xA;    ports:&#xA;      &#34;64040:9000&#34; # API port&#xA;      &#34;64041:9001&#34; # Web dashboard port&#xA;    volumes:&#xA;      miniodata:/data&#xA;    environment:&#xA;      MINIOROOTUSER: minioadmin&#xA;      MINIOROOTPASSWORD: minioadmin&#xA;    command: server /data --console-address &#34;:9001&#34;&#xA;&#xA;volumes:&#xA;  miniodata:&#xA;&#xA;Note that:&#xA;&#xA;We&#39;re setting a default username and password  for local development. Obviously use proper secrets management for a more serious environment.&#xA;We&#39;re re-mapping the service&#39;s ports to a random high port since other services sometimes try to bind 9000 or 9001.&#xA;&#xA;Once you&#39;ve docker compose up&#39;d this, you can log in to the admin console at localhost:64041 and create your development bucket and access keys.&#xA;&#xA;In your application you&#39;ll need to configure:&#xA;&#xA;An S3 url:&#xA;  use http://127.0.0.1:64040 for running natively or&#xA;  http://minio:9000 if you&#39;re in a different Docker Compose container&#xA;An S3 region: use us-east-1&#xA;An S3 bucket name: use whatever you created via the admin&#xA;An access key and secret key: use the keys you created via the admin&#xA;&#xA;This should also work for developing against S3 compatible services like:&#xA;&#xA;Backblaze B2&#xA;Cloudflare R2&#xA;Digital Ocean Spaces&#xA;Oracle Cloud&#xA;Scaleway Object Storage&#xA;&#xA;etc.&#xA;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="http://natknight.xyz/tag:til" class="hashtag"><span>#</span><span class="p-category">til</span></a> <a href="http://natknight.xyz/tag:s3" class="hashtag"><span>#</span><span class="p-category">s3</span></a> <a href="http://natknight.xyz/tag:dockercompose" class="hashtag"><span>#</span><span class="p-category">dockercompose</span></a></p>

<p>I had to update a Django service to use S3 instead of local file storage recently. Here&#39;s how I set up <a href="https://min.io/">Minio</a> (a self-hostable S3-compatible data store) for local development.</p>



<p>I use Docker Compose (well, <a href="https://runfinch.com/docs/getting-started/compose/">Finch Compose</a>, but same difference) to run local versions of Postgres and S3.</p>

<p>Here&#39;s the <code>docker-compose.yaml</code> file for Minio:</p>

<pre><code class="language-yaml">services:
  minio:
    image: minio/minio
    ports:
      - &#34;64040:9000&#34; # API port
      - &#34;64041:9001&#34; # Web dashboard port
    volumes:
      - minio_data:/data
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    command: server /data --console-address &#34;:9001&#34;

volumes:
  minio_data:
</code></pre>

<p>Note that:</p>
<ul><li>We&#39;re setting a default username and password  for local development. <strong>Obviously use proper secrets management for a more serious environment</strong>.</li>
<li>We&#39;re re-mapping the service&#39;s ports to a random high port since other services sometimes try to bind <code>9000</code> or <code>9001</code>.</li></ul>

<p>Once you&#39;ve <code>docker compose up</code>&#39;d this, you can log in to the admin console at <code>localhost:64041</code> and create your development bucket and access keys.</p>

<p>In your application you&#39;ll need to configure:</p>
<ul><li>An S3 url:
<ul><li>use <code>http://127.0.0.1:64040</code> for running natively or</li>
<li><code>http://minio:9000</code> if you&#39;re in a different Docker Compose container</li></ul></li>
<li>An S3 region: <a href="https://github.com/minio/minio/discussions/15063">use <code>us-east-1</code></a></li>
<li>An S3 bucket name: use whatever you created via the admin</li>
<li>An access key and secret key: use the keys you created via the admin</li></ul>

<p>This should also work for developing against S3 compatible services like:</p>
<ul><li><a href="https://www.backblaze.com/docs/cloud-storage-s3-compatible-api">Backblaze B2</a></li>
<li><a href="https://developers.cloudflare.com/r2/api/s3/api/">Cloudflare R2</a></li>
<li><a href="https://www.digitalocean.com/products/spaces">Digital Ocean Spaces</a></li>
<li><a href="https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/s3compatibleapi.htm">Oracle Cloud</a></li>
<li><a href="https://www.scaleway.com/en/docs/object-storage/">Scaleway Object Storage</a></li></ul>

<p>etc.</p>
]]></content:encoded>
      <guid>http://natknight.xyz/til-local-development-against-s3</guid>
      <pubDate>Wed, 19 Feb 2025 19:45:06 +0000</pubDate>
    </item>
  </channel>
</rss>