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 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 automates: Uploading of the *.mmpk and metadata.json files to a versioned folder Copying metadata.json to /latest folder Setup the upload script dependencies: Configure with the created IAM credentials () Prepare the metadata.json file with this content: 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
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"
}