File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,10 +124,18 @@ echo "Archive size: ${ARCHIVE_SIZE}"
124124# --- Upload ---
125125echo " Uploading ${ARCHIVE_NAME} to S3 bucket '${S3_BUCKET} '..."
126126# Use aws-cli to upload the archive to the S3-compatible storage.
127- aws s3 cp \
128- " ${ARCHIVE_PATH} " \
129- " s3://${S3_BUCKET} /${ARCHIVE_NAME} " \
130- --endpoint-url " ${S3_ENDPOINT} "
127+ # Configure AWS CLI to handle Content-Length properly
128+ export AWS_ACCESS_KEY_ID=" ${S3_ACCESS_KEY} "
129+ export AWS_SECRET_ACCESS_KEY=" ${S3_SECRET_KEY} "
130+ export AWS_DEFAULT_REGION=" ${S3_REGION:- us-east-1} "
131+
132+ # Use s3api put-object instead of s3 cp to have more control over headers
133+ aws s3api put-object \
134+ --bucket " ${S3_BUCKET} " \
135+ --key " ${ARCHIVE_NAME} " \
136+ --body " ${ARCHIVE_PATH} " \
137+ --endpoint-url " ${S3_ENDPOINT} " \
138+ --content-type " application/gzip"
131139
132140echo " Backup upload complete: ${ARCHIVE_NAME} (${ARCHIVE_SIZE} )"
133141
You can’t perform that action at this time.
0 commit comments