Skip to content

Commit

Permalink
K8SPXC-1475 add missing lib for 5.7 backup (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
hors authored Jan 30, 2025
1 parent 7eb0c5e commit 27f3e0e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions percona-xtradb-cluster-5.7-backup/lib/pxc/aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -o errexit

export AWS_SHARED_CREDENTIALS_FILE='/tmp/aws-credfile'
export AWS_ENDPOINT_URL="${ENDPOINT:-https://s3.amazonaws.com}"
export AWS_REGION="${DEFAULT_REGION:-us-west-2}"

if [ -n "$VERIFY_TLS" ] && [[ $VERIFY_TLS == "false" ]]; then
AWS_S3_NO_VERIFY_SSL='--no-verify-ssl'
fi

is_object_exist() {
local bucket="$1"
local object="$2"

aws $AWS_S3_NO_VERIFY_SSL s3api head-object --bucket $bucket --key "$object" || NOT_EXIST=true
if [[ -z "$NOT_EXIST" ]]; then
return 1
fi
}

s3_add_bucket_dest() {
{ set +x; } 2>/dev/null
aws configure set aws_access_key_id "$ACCESS_KEY_ID"
aws configure set aws_secret_access_key "$SECRET_ACCESS_KEY"
set -x
}

0 comments on commit 27f3e0e

Please sign in to comment.