<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Timo Eckhardt on Medium]]></title>
        <description><![CDATA[Stories by Timo Eckhardt on Medium]]></description>
        <link>https://medium.com/@timo_e_aus_e?source=rss-ef87ce5f42af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aJTGflht3C7T7h9POBa9BA.jpeg</url>
            <title>Stories by Timo Eckhardt on Medium</title>
            <link>https://medium.com/@timo_e_aus_e?source=rss-ef87ce5f42af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:03:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@timo_e_aus_e/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Effectively Testing Our AWS S3 Utilization Using The S3Mock]]></title>
            <link>https://medium.com/adobetech/effectively-testing-our-aws-s3-utilization-using-the-s3mock-f139ebf81572?source=rss-ef87ce5f42af------2</link>
            <guid isPermaLink="false">https://medium.com/p/f139ebf81572</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[adobe]]></category>
            <dc:creator><![CDATA[Timo Eckhardt]]></dc:creator>
            <pubDate>Tue, 12 Dec 2017 15:31:00 GMT</pubDate>
            <atom:updated>2017-12-12T15:31:00.847Z</atom:updated>
            <content:encoded><![CDATA[<p>At Adobe we’re building services for the cloud. Hundreds of these are serving customer data and enable workflows for <a href="https://www.adobe.com/creativecloud.html">Creative Cloud</a>, <a href="https://acrobat.adobe.com/">Document Cloud</a> or <a href="https://www.adobe.com/marketing-cloud.html">Marketing Cloud</a>. These services are hosted in cloud providers such as Amazon Web Services or Microsoft Azure and we use provider-specific APIs and services like AWS Simple Storage Service or Azure Blob storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GKpeG1891v4tfYveZeSm1w.jpeg" /></figure><p>Practicing continuous integration and continuous deployment, we need our test automation to run as fast as possible and as early as possible. The majority of such tests will be Unit Tests to verify isolated blocks of code.</p><p>On top of that, you want to test service functionality as a whole, also during the build. That means that this service has to be up and running and able to interact with all its collaborators, including services managed by the cloud provider. Basically this is what the <a href="https://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid">Test Pyramid</a> is about.</p><h3>Testing against AWS S3 API</h3><p>Back in the days, we ran such service tests against the service to be tested, which connects against managed backend services as such AWS S3. Doing so, we faced some disadvantages:</p><ul><li>These tests are potentially long-running as they depend directly on managed services that include network latency, especially when running the build and tests on a local developer machine.</li><li>Tests rely on the availability and reachability of managed services. If a test run, for whatever reason, cannot access managed services the build will fail as a result and we’re potentially not able to roll out new versions.</li></ul><p>What we wanted to have, ideally, is a service that implements AWS S3 APIs and which can be started during the build with a minimal footprint.</p><p>There are various S3 API implementations out there, but none of those we evaluated were able to give us all of the S3 functionality we needed. In short the features we need are:</p><ul><li>Getting and manipulating S3 Objects</li><li>Getting and manipulating S3 Buckets</li><li>Multipart uploads and copy of S3 Objects</li><li>KMS based encryption</li><li>HTTPS support</li></ul><p>At this point we decided to implement our own mock implementation of AWS S3 API, the S3Mock.</p><h3>Features</h3><p>S3Mock implements basic functionality of Amazon’s AWS S3 API. The following is an overview of implemented S3 operations and features.</p><h4>HTTPS Support</h4><p>S3Mock provides an HTTP and an HTTPS endpoint. Defaults are</p><ul><li>9191 (HTTPS)</li><li>9090 (HTTP)</li></ul><p>Ports can be configured on startup by defining variables</p><pre>server.port=9191 (HTTPS)</pre><pre>http.port=9090 (HTTP)</pre><p>The SSL certificate used is a self-signed one for localhost which may need to be ignored by the caller.</p><h4>Working with S3 Objects</h4><ul><li>HTTP <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html">GET</a> to retrieve an existing object, including range requests.</li><li>HTTP <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html">HEAD</a> to retrieve metadata for an existing object.</li></ul><p>Supported object metadata are:</p><ul><li>ETag</li><li>Content-Type</li><li>Content-Length</li><li>Last-Modified</li><li>Content-Range for range requests</li></ul><p>Manipulating S3 objects:</p><ul><li>HTTP <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html">PUT</a> operations for creating, updating or copying objects including <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html">Multipart Uploads</a>.</li><li>HTTP <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html">DELETE</a> for deleting existing objects.</li></ul><h4>Working with Buckets</h4><p>Get Buckets:</p><ul><li>HTTP GET <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/v2-RESTBucketGET.html">listing all objects</a> inside an existing Bucket.</li><li>HTTP GET <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/SOAPListAllMyBuckets.html">listing all available</a> Buckets.</li><li>HTTP HEAD <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketHEAD.html">to check Bucket existence</a>.</li></ul><p>Manipulating Buckets:</p><ul><li>HTTP PUT for <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html">creating Buckets</a>.</li><li>HTTP DELETE for <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETE.html">deleting Buckets</a>.</li></ul><p>Create initial Buckets:</p><p>S3Mock will create the set of Buckets on startup passed in <em>initialBuckets</em> environment variable.</p><pre>initialBuckets=Bucket-1,Bucket-2</pre><h4>KMS</h4><p>Every HTTP request being invoked is filtered for server side encryption headers.</p><p>If <em>x-amz-server-side-encryption</em> is <em>aws:kms</em> then <em>x-amz-server-side-encryption-aws-kms-key-id</em> has to specify a registered KMS key reference. If this key reference was not found (or is empty) S3Mock will return <em>HTTP 400 Bad Request</em>.</p><p>Registering KMS key references is done by setting the <em>validKmsKeys</em> environment variable specifying key references (comma-separated):</p><pre>validKmsKeys = arn:aws:kms:us-east-1:47110815:key/c51fdeea-f623-4a2b-90b5-15d72963cf9d, arn:aws:kms:us-east-1:47110815:key/c4353c4c-3318-460a-bdcc-b0a57bd8d9d8</pre><h3>Getting started</h3><h4>Run within a Test</h4><p>The standalone server is available in Maven-central. Add the following dependency to start using it:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;com.adobe.testing&lt;/groupId&gt;<br>    &lt;artifactId&gt;s3mock&lt;/artifactId&gt;<br>    &lt;version&gt;1.0.4&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/test&gt;<br>&lt;/dependency&gt;</pre><p>In your test, you can use the JUnit rule <em>com.adobe.testing.s3mock.S3MockRule</em> to automatically start and stop the S3Mock server and to get a properly configured <em>AmazonS3</em> instance to interact with S3Mock via HTTPS.</p><pre>@ClassRule<br>public static S3MockRule S3_MOCK_RULE = new S3MockRule();</pre><pre>private final AmazonS3 s3 = S3_MOCK_RULE.createS3Client();</pre><p>Alternatively you can start the server within your code:</p><pre>com.adobe.testing.s3mock.S3MockApplication#start();</pre><p>This will start S3Mock listening on the default ports. To use random free ports, use:</p><pre>S3MockApplication s3Mock = com.adobe.testing.s3mock.S3MockApplication#start(&quot;--server.port=0&quot;, &quot;--http.port=0&quot;);<br>int httpsPort = s3Mock.getPort();<br>int httpPort = s3Mock.getHttpPort();</pre><pre>// do your tests<br>// ...</pre><pre>// shutdown server<br>s3Mock.stop();</pre><h4>Run as a Docker container</h4><p>The Docker image is available on Docker Hub at <a href="https://hub.docker.com/r/adobe/s3mock/">https://hub.docker.com/r/adobe/s3mock/</a>.</p><pre>docker run -p 9090:9090 -p 9191:9191 -t adobe/s3mock</pre><p>This will start S3Mock within a Docker Container exposing the ports 9191 (for HTTPS) and 9090 (for HTTP).</p><h4>Using The AmazonS3 from AWS Java SDK</h4><pre>final AmazonS3 httpAmazonS3 = AmazonS3ClientBuilder.standard()<br>  .withCredentials(awsCredentials) // use any credentials here<br>  .withEndpointConfiguration(<br>    new EndpointConfiguration(<br>      &quot;http://localhost:9090/&quot;,<br>      Region.US_Standard.getFirstRegionId()<br>    )<br>  .build();</pre><h3>Contributions</h3><p>Adobe S3Mock is an Open Source Project under <em>Apache License 2.0</em> and is available on <a href="https://github.com/adobe/S3Mock">Github</a>. Any contributions are welcome!</p><p><a href="https://github.com/adobe/S3Mock">adobe/S3Mock</a></p><p>To contribute, fork the repository, make your changes, and create a pull Request against the forked repository. Adobe engineers will review your changes and release new versions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f139ebf81572" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adobetech/effectively-testing-our-aws-s3-utilization-using-the-s3mock-f139ebf81572">Effectively Testing Our AWS S3 Utilization Using The S3Mock</a> was originally published in <a href="https://medium.com/adobetech">Adobe Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>