Skip to content

Uploading Data to S3

Ioto provides convenience APIs to make uploading data or files to S3 easy.

Features

  • Upload files to S3
  • Upload dynamically generated data to S3

API Quick Tour

Uploading a File

To upload a file, use awsPutFileTS3:

status = awsPutFileToS3("us-east-1", "MyBucket", "file.dat", "./file.data");

This call will upload the file "./file.data" to the bucket "MyBucket" on S3. The file will be saved in the bucket as "file.dat". The returned status will be a HTTP status code of 200 if successful.

Uploading a Data Block

To upload a data block to AWS S3, use the awsPutToS3 API.

char data[1024];
int status = awsPutToS3("us-east-1", "MyBucket", "filename", data, sizeof(data));

This will upload the data buffer to the given "filename" in the "MyBucket" on S3. The returned status will be a HTTP status code of 200 if successful.

When executing, this call will block the current fiber, but other fibers continue to run. When complete, the call will return.

Enabling IAM Keys

To enable generation of temporary IAM keys, set the keys property of the services.cloud property in the config.json5 configuration file to true.

When defined, Ioto will retrieve from the Ioto service a set of IAM credentials that can be used to sign AWS API requests. These are based on the IAM role IotoDeviceAccess in the device cloud.