Gallery
hema-maps
Rio Tinto Track Navigation - Meeting Notes
Share
Explore

icon picker
S3 Map Upload Guide

This guide outlines the setup and usage of a public S3 bucket for distributing map files used by the Android app. It explains how files are stored with UUID-based paths for obscurity, how to configure bucket permissions, and how to automate uploads using a Python script.

S3 Bucket Configuration

Go to the Permissions tab of the bucket
Edit the Block Public Access settings for this bucket, only checking these two options:
Block public access to buckets and objects granted through new access control lists (ACLs)
Block public access to buckets and objects granted through any access control lists (ACLs)
Edit the Bucket policy, replacing the <bucket-name>:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowGetObjectForReleases",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::<bucket-name>/releases/*/metadata.json",
"arn:aws:s3:::<bucket-name>/releases/*/*.mmpk"
]
}
]
}
This bucket policy will grant public read access to the metadata and mmpk files under the releases folder. Users can access the objects only when the object path is known.

S3 Bucket Structure

📁 releases
├── 📁 2025-01-23-da4920de-fd0d-4efe-8701-ce0c8a22d773
│ ├── metadata.json
│ └── RioTinto.mmpk
├── 📁 2025-04-23-b01faa86-17dc-4250-bc03-15717190539d
│ ├── metadata.json
│ └── RioTinto.mmpk
└── 📁 latest
└── metadata.json // copied from most recent version
<releaseDate-uuid> - The auto-generated folder/prefix by the upload script in <YYYY-MM-DD-UUID> format. This contains the metadata and mmpk files.
metadata.json - A file that holds information about the release version.
{
"mapVersion": "1.0", // mmpk version
"releaseDate": "2025-04-23", // auto-generated by upload script
"uuid": "b01faa86-17dc-4250-bc03-15717190539d" // auto-generated by upload script
}
*.mmpk - The MMPK file for the release version.

Web

Create IAM User for Upload Script

Go to the IAM service and create a user
Username: hema-rt-uploader
Attach a managed policy directly
Click Create Policy:
Specify permissions, replacing the <bucket-name>:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUploadPolicy",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::<bucket-name>",
"arn:aws:s3:::<bucket-name>/*"
]
}
]
}
Policy name: HemaRTUploaderPolicy
Return to the user creation process, refresh the policy list, and attach the newly created policy
Complete the user creation and securely save the access key ID and secret access key

Upload Script

hema-rt_upload-script.py
6 kB
hema-rt_upload-script.py automates:
Uploading of the *.mmpk and metadata.json files to a versioned folder
Copying metadata.json to /latest folder
Prerequisites:
Install Python 3.9
Install Boto3
Configure with the created IAM credentials ()
aws configure
Prepare the mmpk file
Prepare the metadata.json file with this content:
{
"mapVersion": "1.0"
}
Usage:
python hema-rt_upload-script.py --bucket <bucket-name> --mmpk <mmpk_path> --metadata <metadata_path>
// Example: python hema-rt_upload-script.py --bucket hema-rt-dev --mmpk RioTinto.mmpk --metadata metadata.json
Successful Run Preview:
Screenshot 2025-04-24 at 5.09.11 PM.png

Download Link

With the Upload Script, a metadata.json file will be added/updated in the /latest folder with the given UUID and the timestamp. e.g.
{
"mapVersion": "1.0",
"releaseDate": "2025-04-23",
"uuid": "b01faa86-17dc-4250-bc03-15717190539d"
}
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.