commit
1aa3269274
4 changed files with 28 additions and 6 deletions
|
@ -28,6 +28,10 @@ jobs:
|
|||
- put: <resource name>
|
||||
```
|
||||
|
||||
## AWS Credentials
|
||||
|
||||
The `access_key_id` and `secret_access_key` are optional and if not provided the EC2 Metadata service will be queried for role based credentials.
|
||||
|
||||
## Options
|
||||
|
||||
The `options` parameter is synonymous with the options that `aws cli` accepts for `sync`. Please see [S3 Sync Options](http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html#options) and pay special attention to the [Use of Exclude and Include Filters](http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters).
|
||||
|
|
10
assets/check
10
assets/check
|
@ -10,8 +10,14 @@ bucket=$(echo "$payload" | jq -r '.source.bucket')
|
|||
prefix="$(echo "$payload" | jq -r '.source.path // ""')"
|
||||
|
||||
# export for `aws` cli
|
||||
export AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
export AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
|
||||
# Due to precedence rules, must be unset to support AWS IAM Roles.
|
||||
if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then
|
||||
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
|
||||
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
|
||||
fi
|
||||
|
||||
# Consider the most recent LastModified timestamp as the most recent version.
|
||||
timestamps=$(aws s3api list-objects --bucket $bucket --prefix "$prefix" --query 'Contents[].{LastModified: LastModified}')
|
||||
|
|
10
assets/in
10
assets/in
|
@ -21,8 +21,14 @@ path=$(echo "$payload" | jq -r '.source.path // ""')
|
|||
options=$(echo "$payload" | jq -r '.source.options // [] | join(" ")')
|
||||
|
||||
# export for `aws` cli
|
||||
export AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
export AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
|
||||
# Due to precedence rules, must be unset to support AWS IAM Roles.
|
||||
if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then
|
||||
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
|
||||
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
|
||||
fi
|
||||
|
||||
echo "Downloading from S3..."
|
||||
eval aws s3 sync "s3://$bucket/$path" $dest $options
|
||||
|
|
10
assets/out
10
assets/out
|
@ -21,8 +21,14 @@ path=$(echo "$payload" | jq -r '.source.path // ""')
|
|||
options=$(echo "$payload" | jq -r '.source.options // [] | join(" ")')
|
||||
|
||||
# export for `aws` cli
|
||||
export AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
export AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
|
||||
# Due to precedence rules, must be unset to support AWS IAM Roles.
|
||||
if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then
|
||||
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
|
||||
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
|
||||
fi
|
||||
|
||||
echo "Uploading to S3..."
|
||||
eval aws s3 sync $source "s3://$bucket/$path" $options
|
||||
|
|
Loading…
Reference in a new issue