Integrating Ignition with AWS S3 via boto3

I am FTPing camera inspection images into an S3 bucket. I am interested in using boto3 in scripts to SELECT images from my buckets based on metadata (datetime) and then visualize in an Ignition client. Visualization is not an issue. Just do not understand how to get the boto3 to work with Ignition.

I tried using the Python SDK (placing folders/files into the pylib) but no luck and the Java SDK (trying to create a module) is a little much for me.

Anyone has had any luck/or tried using the AWS S3 SDK known as boto3?

Boto3 was written from the ground up to provide native support in Python versions 2.6.5+, 2.7 and 3.3+.

Unless you’re testing in Ignition 8 (Jython 2.7) there’s no hope of this working in Ignition - and even then, I can’t find any clear information about whether the SDK is “pure” Python or actually relies on “native” C-based code (ie, CPython 2.7 would work, but Ignition’s embedded Jython 2.7 would not).

Thanks for the reply. I had pretty much ran into a wall and you have now confirmed what I was thinking.

To provide additional information, I am working with a Ignition 7.9 running on a Windows 2008 (SP2) instance on AWS.

The work around was to use Cloudberry which allows the manipulation of the S3 objects as files stored in a mapped network drive. I then made the necessary changes to ignition.conf drive (as detailed in IA´s documentation) and I can now run the os library directory/file functions (gateway script) on it.

Furthermore, Filezilla FTP Server allows me to point at the S3 mapped directory structure and save files as is if I was saving directly to the server instance. So it now appears to work.

I am still testing and will provide additional information within the next two weeks.

Thanks again.

1 Like

I wasn’t sure whether to create a new thread or bring back this one, but I am basically trying to do the same thing in Ignition 8 (S3 & Sitewise). I haven’t seen much yet in regards to Jython compatibility but will update if I find something one way or the other.

1 Like

Could you update us on this, please?

For those wondering, boto3 does work on Ignition 8. You just need to place the site-packages created by building boto3 in jython into your Ignition gateway’s site-packages folder. Don’t forget to create a credentials and config file on the gateway as well. Then use import boto3 and start using it in gateway scoped scripting.

Use this links for reference

Screenshot of all the files created by building boto3 in jython.

1 Like

Thanks, this is helpful info, I will give it a try.

I attempted to do this, but am getting errors on using the multiprocessing module. This was supposed to be included in python 2.5, but potentially the module uses C extensions?

  File "C:...\pylib\site-packages\s3transfer\compat.py", line 101, in <module>
    from multiprocessing.managers import BaseManager
ImportError: No module named multiprocessing

Would you be able to provide more direction on how you were able to accomplish this?

For reference, the script did not error on import boto3, but on creating a client.

import boto3

client = boto3.client('s3') # error here

Did you download Jython 2.7 to build or Python? Because your folder path says \pylib…mine is just Lib

image

I didn’t try with Python. Just know that Jython worked the first time without any issues.

That is the filepath on my computer when it pulls the py modules from the Ignition gateway, but yes I did use python to install. Java runtime environment is strongly discouraged at my organization, so I can’t open .jar files. Any idea if OpenJDK can work for this purpose?

As a note, the previous version of boto3 (boto) can be installed and is compatible with python 2. We’ll see if this works out as well…

I can’t upload a zip file of my site-packages folder…its 15MB. max size allowed to upload is 4MB. Maybe message me and I can send you the zip some other way.