There are two scenarios where I find AWS S3, the most popular object store, most fit for solutions including:
- Keeping DB, file backups or even any kind of backups as a cold storage solution.
- Storing static files also sometimes referred as assets being a “backend” bucket for the AWS CloudFront (CDN) service.
Not long ago, while doing the daily checkup for recent full DB backups, I’ve noticed the latest ones were missing. The cronjob bash script error log was printing out the following error: An error occurred (RequestTimeTooSkewed) when calling the UploadPart operation: The difference between the request time and the current time is too large.
.
Though there is no all-purpose solution, here some things you could try.
AWS and Amazon, time and clock are used interchangeably.
Prerequisites
- AWS Account
- S3 bucket
- AWS CLI
Solution(s)
The issue itself points out that the machine’s system time (clock) is out of sync regarding the AWS one.
update system clock
Step 1. First confirm Amazon’s S3 system time and compare it with your machine or whatever device you are trying to run the aws S3
CLI command or even SDK.
# AWS S3
curl http://s3.amazonaws.com -v
# local
date
Find the system time / clock under the Date:
line. If the remote and local clocks don’t match, next step is to sync time asap.
Step 2. Sync time using either a NTP client (default for Linux), or update time/date settings (most common option if running macOS or Windows).
Step 2a.1. Install the NTP client.
# Linux (Ubuntu-based) / WSL (Windows Subsystem for Linux)
apt-get install ntp -y
# Linux (RHEL-based)
yum -y install ntp
# macOS
brew install ntp
Step 2a.2. Update system time.
ntpdate ntp.ubuntu.com
Step 2a.3. Restart the NTP service.
service ntp restart
Step 2b.1. Update macOS and Windows date and time settings.
macOS: System Settings → General → Date & Time → check Set time and date automatically
.
Windows: Start → Settings → Time & language → Date & time → check Set time automatically
& Set time zone automatically
.
The last resort (reboot)
Whatever you are running on a local machine, VM, or Docker, try to reboot.
Obviously, for those running Docker on macOS and Windows, or even WSL (Windows Subsystem for Linux):
- Update system packages.
- Update Docker / WSL.
- Reboot.
Conclusion
If you have another great solution feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.