From c92c63b3a9ae8658181a9a7d57556f244380fa6a Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Thu, 4 Jun 2015 09:08:04 -0400 Subject: [PATCH] AWS: Use s3 sync to optimize upload to s3 when nothing changed --- cluster/aws/util.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index 29cdc97395e..b3c325e03a5 100644 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -298,15 +298,20 @@ function upload-server-tars() { local -r staging_path="devel" - echo "+++ Staging server tars to S3 Storage: ${AWS_S3_BUCKET}/${staging_path}" + local -r local_dir="${KUBE_TEMP}/s3/" + mkdir ${local_dir} + echo "+++ Staging server tars to S3 Storage: ${AWS_S3_BUCKET}/${staging_path}" local server_binary_path="${staging_path}/${SERVER_BINARY_TAR##*/}" - aws s3 cp "${SERVER_BINARY_TAR}" "s3://${AWS_S3_BUCKET}/${server_binary_path}" + cp -a "${SERVER_BINARY_TAR}" ${local_dir} + cp -a "${SALT_TAR}" ${local_dir} + + aws s3 sync --exact-timestamps ${local_dir} "s3://${AWS_S3_BUCKET}/${staging_path}/" + aws s3api put-object-acl --bucket ${AWS_S3_BUCKET} --key "${server_binary_path}" --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"' SERVER_BINARY_TAR_URL="${s3_url_base}/${AWS_S3_BUCKET}/${server_binary_path}" local salt_tar_path="${staging_path}/${SALT_TAR##*/}" - aws s3 cp "${SALT_TAR}" "s3://${AWS_S3_BUCKET}/${salt_tar_path}" aws s3api put-object-acl --bucket ${AWS_S3_BUCKET} --key "${salt_tar_path}" --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"' SALT_TAR_URL="${s3_url_base}/${AWS_S3_BUCKET}/${salt_tar_path}" } @@ -441,10 +446,10 @@ function kube-up { find-release-tars - upload-server-tars - ensure-temp-dir + upload-server-tars + ensure-iam-profiles get-password