GuidesGitHubAirheads Developer CommunityLog In

Downloading UXI Data from S3 with Amazon CLI / SDK

For test result data, objects will be created every 5 minutes or every 25 000 records, whichever is first.
For issue data, objects will be created every 1 minute or every 25 000 records, whichever is first.

Amazon CLI
You can refer to the official Amazon documentation for getting started with the CLI for the platform of your choice and documentation for all the various commands.

Here is an example to download all test result objects matching a prefix to your Desktop.

$ aws s3 cp s3://<your bucket name>/Aruba-UXI/test_results.s3.<your dashboard uid>/year=2022/month=06/day=06/hour=19/ ~/Desktop/ --recursive

Amazon SDK
Amazon has a powerful SDK. Please refer to the official guides and documentation to get the SDK setup and started.

Once set up, you can use the SDK to get the test results or issues from your S3 buckets for your own analysis. Below is an example to get the latest objects over the last hour.

import boto3
import os
from datetime import datetime

my_bucket_name = '<your bucket name>'
my_prefix = 'Aruba-UXI/test_results.s3.<your dashboard uid>/'

year = str(datetime.utcnow().year)
month = str('%02d' % datetime.utcnow().month)
day = str('%02d' % datetime.utcnow().day)
hour = str('%02d' % datetime.utcnow().hour)

my_full_prefix = my_prefix+'year='+year+'/month='+month+'/day='+day+'/hour='+hour

my_bucket = s3.Bucket(my_bucket_name)

for obj in my_bucket.objects.filter(Prefix = my_full_prefix):
  if not os.path.exists(os.path.dirname(obj.key)):
    print ('Creating diretcory ...')
    print ('   '+os.path.dirname(obj.key))
  my_bucket.download_file(obj.key, obj.key) 
  print ('saving file...')
  print ('   '+obj.key)

What’s Next

For more information, you can refer to our help article