Overview
To enable large XML file uploads via presigned URLs, you need to configure AWS S3 and SNS. The frontend handles uploads through presigned URLs, and SNS notifications trigger automatic processing when files land in S3. This guide walks through creating and configuring the required AWS resources.Prerequisites
- AWS account with appropriate permissions
- AWS CLI installed (optional, but recommended)
- Access to AWS Console
Step 1: Create S3 Bucket
Open S3 Console
Navigate to AWS S3 Console
Create Bucket
Click Create bucket and configure:
- Bucket name: Choose a unique name (e.g.,
open-wearables-xml) - AWS Region: Select your preferred region (e.g.,
eu-north-1) - Block Public Access: Keep all boxes checked (recommended)
- Bucket Versioning: Disabled (optional)
- Encryption: Enable with SSE-S3 (recommended)
Using AWS CLI
Using AWS CLI
Step 2: Create SNS Topic
Open SNS Console
Navigate to AWS SNS Console
Using AWS CLI
Using AWS CLI
Step 3: Update SNS Topic Access Policy
The SNS topic needs permission to receive publish events from S3.Add S3 Publish Permission
Add the following statement to the policy’s
Statement array (update the ARNs with your values):Step 4: Add S3 Event Notification
Configure S3 to send notifications to the SNS topic when files are uploaded.Create Event Notification
Scroll to Event notifications → Click Create event notificationConfigure:
- Name: e.g.,
xml-upload-notification - Event types: Check All object create events (or specifically
s3:ObjectCreated:Post) - Suffix:
.xml(optional, to only notify for XML files) - Destination: Select SNS topic
- SNS topic: Select your topic (e.g.,
owear)
Using AWS CLI
Using AWS CLI
Step 5: Create SNS Subscription
Create an HTTPS subscription so SNS delivers notifications to your backend.Configure Subscription
- Topic ARN: Select your topic (e.g.,
owear) - Protocol: HTTPS
- Endpoint: Your backend’s SNS notification URL, e.g.:
Create Subscription
Click Create subscription. AWS will send a
SubscriptionConfirmation request to your endpoint. The backend handles this automatically and confirms the subscription.The backend must be publicly accessible for SNS to reach it. If developing locally, use a tool like ngrok to expose your local server.
Step 6: Update Environment Variables
Add the AWS configuration to your.env file:
How to Get AWS Credentials
How to Get AWS Credentials
Create IAM User with S3 and SNS Permissions
- Go to IAM Console
- Click Users → Add users
- User name:
open-wearables-app - Select Access key - Programmatic access
- Click Next: Permissions
- Attach policies:
AmazonS3FullAccess(or create a custom policy with specific bucket access)AmazonSNSFullAccess(or create a custom policy with specific topic access)
- Click through to create the user
- Copy the Access key ID and Secret access key immediately (you won’t see the secret again)
Step 7: Restart Services
After updating the.env file, restart your services:
Verify Setup
Test your configuration:Test Upload
Try uploading a small XML file using the presigned URL endpoint. The frontend handles this automatically, or you can use the upload script for manual testing:See the Apple XML Import Guide for details.
Troubleshooting
SNS Subscription Stuck on Pending
SNS Subscription Stuck on Pending
Possible causes:
- Backend is not publicly accessible
- Endpoint URL is incorrect
- Backend returned an error during confirmation
- Verify your backend is reachable from the internet
- Check the endpoint URL matches
/api/v1/sns/notification - Check backend logs for confirmation errors
- Delete the subscription and create a new one
Notifications Not Triggering Processing
Notifications Not Triggering Processing
Possible causes:
- S3 event notification not configured correctly
- SNS topic access policy doesn’t allow S3 to publish
- Wrong bucket or topic ARN in configuration
- Verify the event notification in S3 bucket properties
- Check the SNS access policy allows
s3.amazonaws.comto publish - Test by manually uploading a file to S3 and checking backend logs
Access Denied Errors
Access Denied Errors
Possible causes:
- IAM user doesn’t have required permissions
- Wrong AWS credentials in
.env - Bucket or topic in different region
- Verify IAM user has S3 and SNS permissions
- Double-check
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY - Ensure
AWS_REGIONmatches where your bucket and topic are located
Cost Optimization
S3 Storage
- Uploaded XML files remain in S3 for your records
- Set up Lifecycle Rules to archive or delete old files if needed
- Consider moving to Glacier for long-term archival
SNS Notifications
- SNS free tier includes 100,000 HTTP/HTTPS notifications per month
- Check AWS SNS pricing for current limits and rates beyond free tier
Data Transfer
- Keep S3 bucket and servers in the same AWS region
- Use presigned URLs to avoid routing data through your server
Request Costs
- S3 and SNS costs are negligible for typical usage
- See AWS S3 pricing for current rates
Security Best Practices
- Use IAM Roles: If running on EC2/ECS, use IAM roles instead of access keys
- Restrict Bucket Access: Only allow specific IAM users/roles to access the bucket
- Enable Encryption: Use SSE-S3 or SSE-KMS for data at rest
- Monitor Access: Enable CloudTrail logging for S3 and SNS
- Rotate Credentials: Regularly rotate AWS access keys
Related Guides
- Apple XML Import Guide - Using the presigned URL endpoint
- How to Add a Provider - Extending the platform
- Backend E2E Integration - Testing your setup

