The issue is definitely timezone-related, and this is a common mistake with OCI Object Storage PARs. Let me clarify all three focus areas:
1. PAR Expiration Time Handling:
The --time-expires parameter in OCI CLI strictly expects UTC format (ISO 8601 with ‘Z’ suffix). When you provided 2025-02-15T13:30:00Z, the system interpreted this as UTC time. However, if you calculated this timestamp based on your local Eastern Time (UTC-5), you effectively shortened your PAR lifetime by 5 hours. Over 7 days, this adds up, but the real issue is if you used a local timestamp thinking it was UTC - that would create exactly the 5-day vs 7-day discrepancy you’re seeing.
2. Time Zone Handling Best Practices:
Always work in UTC for PAR expiration:
# Generate correct UTC timestamp for 7 days from now
EXPIRY_DATE=$(date -u -d "+7 days" +"%Y-%m-%dT%H:%M:%SZ")
oci os preauth-request create --bucket-name partner-uploads \
--name "partner-access-$(date +%s)" \
--access-type AnyObjectWrite \
--time-expires "$EXPIRY_DATE"
Alternatively, use relative time in your automation:
from datetime import datetime, timedelta
expiry = (datetime.utcnow() + timedelta(days=7)).strftime('%Y-%m-%dT%H:%M:%SZ')
3. Bucket Access Logs Analysis:
Your access logs showing 403 errors starting February 11th confirm the PAR expired then. To verify:
# List all PARs to see actual expiration
oci os preauth-request list --bucket-name partner-uploads
# Check specific PAR details
oci os preauth-request get --bucket-name partner-uploads \
--par-id <your-par-id>
The output will show timeExpires in UTC. Compare this to when 403s started appearing in logs.
Additional Troubleshooting:
- Enable detailed logging: `oci os bucket update --bucket-name partner-uploads --object-events-enabled true
- Monitor PAR usage before expiration to plan renewals
- Consider using bucket lifecycle policies for automatic cleanup
- For production workflows, create PARs with buffer time (e.g., 7.5 days instead of exactly 7)
Prevention Strategy:
Implement a PAR renewal system that checks expiration 24 hours in advance and creates a new PAR with overlapping validity. Store PAR metadata (creation time, expiration, purpose) in a tracking database to avoid timezone confusion.
For your immediate fix: Create a new PAR using the UTC timestamp generation method above, and notify your partners of the new URL. The old PAR cannot be extended once created.