AWS S3

Upload and download from S3 buckets

Introduction

The Blecon AWS S3 integration securely stores device events in S3 buckets. It also allows devices to download the contents of S3 buckets.

With this integration, you can easily log any amount of device data for further processing, and allow devices to download configuration or firmware.

Uploading Data

The S3 integration places device events in the bucket in JSON format. It names the event files as follows:

/<year>/<month>/<day>/<device_id>/<event_id>

Downloading Data

The S3 integration supports two methods for downloading data from a bucket.

Method: Device ID

device.request.<namespace>.s3_download_id

The response will be the contents of /<device_id> from the bucket, if any.

Method: Filename

device.request.<namespace>.s3_download_filename

The filename should be supplied as an ASCII string in the request's payload. The response will be the contents of that location.

Preparing your AWS account

Log into or create an AWS account.

Note Region

Note the region in use, which is found in the top right of the AWS Console.

Create Bucket

Navigate to the S3 service in the AWS Console, and create a new bucket. You will need to choose a globally unique name.

Create IAM Policy

Noting the bucket name you created, create a policy like the below.

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "VisualEditor0",
			"Effect": "Allow",
			"Action": "s3:*",
			"Resource": [
				"arn:aws:s3:::<BUCKET NAME>",
				"arn:aws:s3:::<BUCKET_NAME>/*"
			]
		}
	]
}

For ease of creating, select the JSON editor, paste the below, and insert your bucket name where indicated.

Create IAM Role

Now that we've created the policy, we can create a role, and attach the policy to it.

Navigate to the IAM service in the AWS Console and select Create Role. For Trusted Entity, choose AWS account and enter 202578976232.

Click next, then find the policy you created in the previous step, and attach it to the role.

Click next, and give the role a meaningful name, then click Save.

Find the role in the list of roles, and copy the ARN.

Configuring the Integration

Now you should have everything you need to configure the Blecon integration:

  • Bucket Name

  • IAM Role ARN

  • Region

  • Bucket Name

The namespace is your choice. Device requests must use this namespace to be routed to this integration.

If you have questions, feel free to contact us!

Last updated

Get Support

Ask a question