Automated system to back up local Windows files to AWS S3 | AWS CLI | Task Scheduler(.bat)
HTML-код
- Опубликовано: 7 сен 2024
- set up a system where the local machine uploads files to S3
Step-by-Step Guide
Step 1: Install and Configure AWS CLI on Windows
Download and install AWS CLI
Step 2: Configure AWS CLI
Step 3: Set Up an S3 Bucket
Log in to the AWS Management Console.
Navigate to S3 and create a new bucket:
Go to S3.
Click Create bucket.
Enter a unique bucket name and select your preferred region.
Configure other settings as needed and click Create bucket.
Step 4: Create a Backup Script
Create a script on your Windows machine to upload files to S3. Save it as s3backup.bat.
Step 5: Schedule the Script Using Windows Task Scheduler
S3 Event Notifications using SNS topic & receive alerts on email by SES
• S3 Event Notifications...
👍
source code please
@echo off
setlocal
set "AWS_PROFILE=default" :: Use your AWS CLI profile name
set "S3_BUCKET_NAME=your-bucket-name"
set "SOURCE_DIR=C:\...you location"
echo Backing up files from %SOURCE_DIR% to s3://%S3_BUCKET_NAME%
aws s3 sync %SOURCE_DIR% s3://%S3_BUCKET_NAME% --delete
endlocal