CodeRage XII: Amazon S3 and Cloud API

by Nov 12, 2017

CodeRage XII was great! Plenty of contents and great fun. It was not the first time I have been doing a session on using Delphi Cloud API to integrate with Amazon Simple Storage Service (S3). This year I thought it would be cool to go a little bit further and implement custom "TAmazonS3" component to make it easier to work with Amazon S3 in Delphi.

Cloud API is a set of classes implemented in Delphi that provide access to storage, queue and table services in both Amazon Web Services and Microsoft Azure.

On the "Cloud" tab in the RAD Studio Tool Palette you can find two connection components to connect to either Amazon or Azure. They are used to enter security credentials for a given service. The rest of the process is not visual. Delphi or C++Builder developer needs to instantiate a cloud service proxy class in code passing to its constructor a reference to a connection component. It calls for a simplification. In the session I have demonstrated "TAmazonS3" component that is derived from the "TAmazonConnectionInfo" component and provides "API" property that is a convenient way to lazy-create a reference to "TAmazonStorageService" class which acts as a proxy to different S3 REST APIs. There is also a helper class that adds functionality to easily upload and download Delphi strings to and from Amazon S3 service.

The source code of the component and sample demo apps are available for download from here.